Viikkokisa - Solaris

phons
Guru
Posts: 1056
Joined: Wed May 14, 2008 10:11 am

Re: Viikkokisa - Solaris

Post by phons »

No juu tunnustan ottaneeni tuon törmäyksen sieltä, siis sen missä katsotaan osuuko ukkeli kattoon vai mahaan tai ei minnekkään. :oops:
Image
User avatar
valscion
Moderator
Moderator
Posts: 1599
Joined: Thu Dec 06, 2007 7:46 pm
Location: Espoo
Contact:

Re: Viikkokisa - Solaris

Post by valscion »

No onko sillä nyt väliä jos esimerkeistä kopioi? Oisihan siitä kumminkin saanut ottaa _mallia_....
cbEnchanted, uudelleenkirjoitettu runtime. Uusin versio: 0.4.1 — Nyt myös sorsat GitHubissa!
NetMatch - se kunnon nettimättö-deathmatch! Avoimella lähdekoodilla varustettu
vesalaakso.com
nevssons
Devoted Member
Posts: 503
Joined: Sun Jan 13, 2008 5:02 pm

Re: Viikkokisa - Solaris

Post by nevssons »

OonSuomesta wrote:No onko sillä nyt väliä jos esimerkeistä kopioi? Oisihan siitä kumminkin saanut ottaa _mallia_....
Mavi toukka saa päättä kohtalon, niin tästä ei tarvitse kiistellä?
EDIT:

Pieni paljastus: Pelini nimeksi tulee BOX

Koodarina kohtalainen, henkilönä vittumainen
Image
MAVmaggot
Advanced Member
Posts: 468
Joined: Fri Aug 31, 2007 10:18 pm
Location: bitspace

Re: Viikkokisa - Solaris

Post by MAVmaggot »

Ei haittaa, voisihan saman koodin kirjoittaa mallista ja se ei ole silloin kopioimista kuten OonSuomesta sanoi.
Character
Active Member
Posts: 113
Joined: Thu Nov 27, 2008 2:16 pm

Re: Viikkokisa - Solaris

Post by Character »

Päätinpä osallistua tällä pikkupelillä.. Nuolista ohjaa, ylänuoli hyppää.

Code: Select all

Framelimit 40

Type WALLS
    Field width
    Field height
    Field x
    Field y
    Field img
End Type

Const GRAVITY=0.05

sky=MakeImage(ScreenWidth(),ScreenHeight())

DrawToImage sky
For s=0 To 100
PutPixel Rand(0,ImageWidth(sky)),Rand(0,ImageHeight(sky)),255
Next s
DrawToScreen

player=MakeImage(20,20)

DrawToImage player
Color 0,255,0
Box 0,0,ImageWidth(player),ImageHeight(player),OFF
DrawToScreen

Global score

x#=ImageWidth(player)
y#=ScreenHeight()-ScreenHeight()/3-ImageHeight(player)
drop#=0
score=0
addwall=Timer()
scoreplus=Timer()

Repeat

    DrawImage sky,0,0

    If Timer()>scoreplus+1000 Then
        score=score+1
        scoreplus=Timer()
    EndIf

    If Timer()>addwall+1000 Then
        wall.WALLS=New(WALLS)
        wall\width=Rand(20,100)
        wall\height=Rand(20,100)
        wall\x=ScreenWidth()
        wall\y=ScreenHeight()-ScreenHeight()/3-wall\height
        wall\img=MakeImage(wall\width,wall\height)
        DrawToImage wall\img
            Color cbBlackSkin
                Box 0,0,ImageWidth(wall\img),ImageHeight(wall\img),ON
            Color 0,255,0
                Box 0,0,ImageWidth(wall\img),ImageHeight(wall\img),OFF
        DrawToScreen
    addwall=Timer()
    EndIf

    For wall.WALLS = Each WALLS
        DrawImage wall\img,wall\x,wall\y
            wall\x=wall\x-5
        If ImagesOverlap(player,x,y,wall\img,wall\x,wall\y) Then Goto failed
    Next wall

    Color cbBlackSkin
    Box 0,ScreenHeight()-ScreenHeight()/3,ScreenWidth(),ScreenHeight()-ScreenHeight()/3

    DrawImage player,x,y

    x=x-LeftKey()*5+RightKey()*5

    drop#=drop#-GRAVITY
    y#=y#-drop

    If y#>ScreenHeight()-ScreenHeight()/3-ImageHeight(player) Then
        y#=ScreenHeight()-ScreenHeight()/3-ImageHeight(player): drop=0
    EndIf

    If UpKey() And y#>ScreenHeight()-ScreenHeight()/3-ImageHeight(player)-1 Then
        drop=4
    EndIf

    If x<0 Then x=0 
    If x>ScreenWidth()-ImageWidth(player) Then x=ScreenWidth()-ImageWidth(player)

    SetWindow "Your score: "+score

DrawScreen

Forever

failed:

txt$="Failed! Your score is "+score+" seconds."

Repeat

    Color cbRed

    Text ScreenWidth()/2-TextWidth(txt)/2,ScreenHeight()/2-TextHeight(txt)/2,txt

    DrawScreen

Until EscapeKey()
EDIT:

Laitoin framelimitin.

Last edited by Character on Wed Jan 07, 2009 9:16 pm, edited 2 times in total.
User avatar
skinkken
Advanced Member
Posts: 453
Joined: Sat Sep 01, 2007 4:00 pm
Location: Helsinki

Re: Viikkokisa - Solaris

Post by skinkken »

Character, Laitappa tuohon peliin framelimit koska nopeilla koneilla peli pyörii mahdottoman nopeasti.
Valmiit pelit: House of Horrors , Battle Zone , Über Ball , Itdoti , Space Chaos , Bloxxplosives
Projekti jota teen ehkä joskus vielä: viewtopic.php?f=11&t=2636 <-- Tämä rivi päivitetty 14.1.2013
phons
Guru
Posts: 1056
Joined: Wed May 14, 2008 10:11 am

Re: Viikkokisa - Solaris

Post by phons »

No siinä syy miksi tämä oli ihan mahdoton. :D
Image
nevssons
Devoted Member
Posts: 503
Joined: Sun Jan 13, 2008 5:02 pm

Re: Viikkokisa - Solaris

Post by nevssons »

Pahoittelen etten ehtinyt (jaksanut) tehdä peliäni loppuun.
Koodarina kohtalainen, henkilönä vittumainen
Image
Post Reply