Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with collision star game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
marz




PostPosted: Sat Jun 07, 2003 11:45 am   Post subject: Help with collision star game

Hiya! Alright, now for my exam, I have chosen to do a very crappy like game, but hey, it will get me the marks I need. However, I need help badly! Sad Yeah, so at the end of my animation, my game automatically starts. It is about stars falling out of the sky and a ball has to didge them. Now I need to know how you can make the ball dodge the stars, and if you get hit three times, then die. I dont know how to do that. Here is my game so far. Help greatly appriciated! Very Happy


star falling.t
 Description:

Download
 Filename:  star falling.t
 Filesize:  0 Bytes
 Downloaded:  349 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
marz




PostPosted: Sat Jun 07, 2003 11:52 am   Post subject: sorry

Ok, sorry that extenstion didnt work. Here is my actuall game
code:
setscreen("graphics,nocursor,noecho")
var move1, move2, move3 : int
Draw.Fill (1, 1, 18, 18)
loop
    move2 := Rand.Int (0, 500)
    move3 := 10
    move1 := Rand.Int (0, 700)
    for decreasing c : 31 .. 18
        Draw.Star (move1, move2, move3, move3, c)
        delay (100)
        Draw.Star (move1, move2, move3, move3, 18)
        move3 := move3 + 8
    end for
var s,font1, star1x, star1y, star2x, star2y, star3x, star3y, star4x, star4y, chop, speed : int
speed := 300
Draw.Fill (1, 1, 16, 16)
font1 := Font.New ("Tomaha:12")
assert font1 > 0
Font.Draw ("A Starry Night... ", 300, 250, font1, 77)
delay (4000)
Draw.Cls
Draw.Fill(16,16,16,16)   
%stars
s := 10
loop
    Draw.FillStar (15, 460, 35, 480, 92)
    Draw.FillStar (20, 465, 30, 475, 92)
    delay(100)
    Draw.FillBox (20, 465, 30, 475, 16)
    Draw.FillStar (55, 435, 65, 445, 92)
    delay(100)
    Draw.FillBox (55, 435, 65, 445, 16)
    Draw.FillStar (105, 465, 115, 475, 67)
    Draw.FillStar (150, 450, 160, 460, 68)
    Draw.FillStar (450, 450, 460, 460, 69)
    Draw.FillStar (390, 380, 400, 390, 70)
    Draw.FillStar (155, 410, 175, 430, 71)
    Draw.FillStar (380, 420, 400, 440, 93)
    Draw.FillStar (350, 450, 360, 460, 74)
    Draw.FillStar (240, 430, 260, 450, 75)
    Draw.FillStar (470, 350, 480, 360, 9)
    Draw.FillStar (680, 440, 690, 450, 76)
    Draw.FillStar (620, 450, 630, 460, 77)
    Draw.FillStar (580, 430, 560, 450, 78)
    Draw.FillStar (540, 470, 550, 480, 101)
    Draw.FillStar (320, 470, 330, 480, 103)
    Draw.FillStar (250, 470, 260, 480, 103)
    delay (100)
    Draw.FillStar (15, 460, 35, 480, 1)
    Draw.FillStar (20, 465, 30, 475, 1)
    Draw.FillStar (90, 420, 100, 430, 1)
    Draw.FillStar (55, 435, 65, 445, 1)
    Draw.FillStar (100, 460, 120, 480, 1)
    Draw.FillStar (105, 465, 115, 475, 1)
      Draw.FillStar (15, 460, 35, 480, 41)
    delay (100)
    Draw.FillBox (15, 460, 35, 480, 16)
    Draw.FillStar (20, 465, 30, 475, 41)
    delay (100)
    Draw.FillBox (20, 465, 30, 475, 16)
    Draw.FillStar (50, 430, 70, 450, 41)
    delay (100)
    Draw.FillBox (50, 430, 70, 450, 16)
    Draw.FillStar (55, 435, 65, 445, 41)
    delay (100)
    Draw.FillBox (55, 435, 65, 445, 16)
    Draw.FillStar (100, 460, 120, 480, 41)
    delay (100)
    Draw.FillBox (100, 460, 120, 480, 16)
    Draw.FillStar (105, 465, 115, 475, 41)
    delay (150)
    Draw.FillBox (105, 465, 115, 475, 16)
    delay (100)
    Draw.FillStar (15, 460, 35, 480, 41)
    delay (100)
    Draw.FillBox (15, 460, 35, 480, 16)
    Draw.FillStar (20, 465, 30, 475, 41)
    delay (100)
    Draw.FillBox (20, 465, 30, 475, 16)
    Draw.FillStar (70, 270, 90, 290, 41)
    delay (100)
    Draw.FillBox (70, 270, 90, 290, 16)
    Draw.FillStar (25, 190, 95, 135, 41)
    delay (100)
    Draw.FillBox (25, 190, 95, 135, 16)
   
    Draw.FillStar (100, 460, 120, 480, 41)
    delay (100)
    Draw.FillBox (100, 460, 120, 480, 16)
    Draw.FillStar (105, 465, 115, 475, 41)
    delay (100)
    Draw.FillBox (105, 465, 115, 475, 16)
          Draw.FillStar (15, 460, 35, 480, 41)
    delay (100)
    Draw.FillBox (15, 460, 35, 480, 16)
    Draw.FillStar (20, 465, 30, 475, 41)
    delay (100)
    Draw.FillBox (20, 465, 30, 475, 16)
   
    Draw.FillStar (50, 430, 70, 450, 41)
    delay (100)
    Draw.FillBox (50, 430, 70, 450, 16)
    Draw.FillStar (55, 435, 65, 445, 41)
    delay (100)
    Draw.FillBox (55, 435, 65, 445, 16)
    Draw.FillStar (440, 410, 460, 430, 10)
    delay (100)
    Draw.FillBox (440, 410, 460, 430, 16)
    Draw.FillStar(320, 430, 330, 440, 89)
    delay (150)
    Draw.FillBox (320, 430, 330, 440, 16)
    delay (100)
      Draw.FillStar (15, 460, 35, 480, 41)
    delay (100)
    Draw.FillStar (520, 430, 530, 440, 96)
    Draw.FillStar (520, 430, 530, 440, 53)
    delay (100)
    Draw.FillBox (20, 465, 30, 475, 53)
    s := s + 1
    exit when s = 30
Draw.Fill (1, 1, 16, 16)
Font.Draw ("Except the stars start to fall out of the sky... ", 190, 190, font1, 12)
delay (4000)
Draw.Fill (1, 1, 77, 77)
Draw.Fill (1, 1, 16, 16)
font1 := Font.New ("Tomaha:15")
assert font1 > 0
Font.Draw ("Can you dodge the stars?... ", 290, 300, font1, 76)
delay (4000)
Font.Draw("Find out and PLAY!",190, 180, font1, 77)
Draw.Fill(1,1,16,16)
Draw.Cls
Draw.Fill (1, 1, 21, 21)
star1x := 280
star1y := 500
star2x := 390
star2y := 650
star3x := 500
star3y := 820
star4x := 610
star4y := 980
loop
    %star1
    for x : 1..500 by speed
        Draw.FillStar (star1x, star1y, star1x + 40, star1y + 40, 75)
        Draw.FillStar (star1x, star1y, star1x + 40, star1y + 40, 16)
    end for

    %box2
    for x : 1..500 by speed
        Draw.FillStar (star2x, star2y, star2x + 40, star2y + 40, 79)
        Draw.FillStar (star2x, star2y, star2x + 40, star2y + 40, 16)
    end for


    %box3
    for x : 1..500 by speed
        Draw.FillStar (star3x, star3y, star3x + 40, star3y + 40, 77)
        Draw.FillStar (star3x, star3y, star3x + 40, star3y + 40, 16)
    end for


    %box4
    for x : 1..500 by speed
        Draw.FillStar (star4x, star4y, star4x + 40, star4y + 40, 74)
        Draw.FillStar (star4x, star4y, star4x + 40, star4y + 40, 16)
    end for


    %box1
    for x : 1..500 by speed
        Draw.FillStar (star1x, star1y, star1x + 40, star1y + 40, 75)
        Draw.FillStar (star1x, star1y, star1x + 40, star1y + 40, 16)
    end for


    %box2
    for x: 1..500 by speed
        Draw.FillStar (star2x, star2y, star2x + 40, star2y + 40, 79)
        Draw.FillStar (star2x, star2y, star2x + 40, star2y + 40, 16)
    end for
   
    %box3
    for x :1..500 by speed
        Draw.FillStar (star3x, star3y, star3x + 40, star3y + 40, 77)
        Draw.FillStar (star3x, star3y, star3x + 40, star3y + 40, 16)
    end for


    %box4
    for x : 1..500 by speed
        Draw.FillStar (star4x, star4y, star4x + 40, star4y + 40, 74)
        Draw.FillStar (star4x, star4y, star4x + 40, star4y + 40, 16)
    end for
 
    if star1y + 40 < 0 or star2y + 40 < 0 or star3y + 40 < 0 or star4y + 40 < 0
            then
        chop := Rand.Int (1, 4)
        if chop = 1 and star1y + 40 < 0 then
            star1x := 280
            star1y := 500
        elsif chop = 2 and star1y + 40 < 0 then
            star1x := 390
            star1y := 500
        elsif chop = 3 and star1y + 40 < 0 then
            star1x := 500
            star1y := 500
        elsif chop = 4 and star1y + 40 < 0 then
            star1x := 610
            star1y := 500
        elsif chop = 1 and star2y + 40 < 0 then
            star2x := 280
            star2y := 500
        elsif chop = 2 and star2y + 40 < 0 then
            star2x := 390
            star2y := 500
        elsif chop = 3 and star2y + 40 < 0 then
            star2x := 500
            star2y := 500
        elsif chop = 4 and star2y + 40 < 0 then
            star2x := 610
            star2y := 500
        elsif chop = 1 and star3y + 40 < 0 then
            star3x := 280
            star3y := 500
        elsif chop = 2 and star3y + 40 < 0 then
            star3x := 390
           star3y := 500
        elsif chop = 3 and star3y + 40 < 0 then
            star3x := 500
            star3y := 500
        elsif chop = 4 and star3y + 40 < 0 then
            star3x := 610
            star3y := 500
        elsif chop = 1 and star4y + 40 < 0 then
            star4x := 280
            star4y := 500
        elsif chop = 2 and star4y + 40 < 0 then
            star4x := 390
            star4y := 500
        elsif chop = 3 and star4y + 40 < 0 then
            star4x := 500
            star4y := 500
        elsif chop = 4 and star4y + 40 < 0 then
            star4x := 610
            star4y := 500
        end if
    end if
    star1y := star1y - 1
    star2y := star2y - 1
    star3y := star3y - 1
    star4y := star4y - 1
    Draw.Fill (1, 1, 16, 16)
end loop
 end loop
 end loop


Andy




PostPosted: Sat Jun 07, 2003 11:52 am   Post subject: (No subject)

hmmm, very intresting game...
of NOTHING dude, you your attatchment is blank
AsianSensation




PostPosted: Sat Jun 07, 2003 12:01 pm   Post subject: (No subject)

Yeah, there are a lot of tutorials on collision detection, both circle and triangle, also Input.KeyDown, or if your not using 4.0.3(some letter), then getch will let you get input, there is also a tutorial on that.
void




PostPosted: Sat Jun 07, 2003 1:11 pm   Post subject: (No subject)

dude...no offense...but thats one pretty crappy game..ur falling stars are so glitchy that u can barely see them...and you have no ball....after 6/7 months of doing turing you SHOULD know how to use getch with the ords of the arrow keys or Input.KeyDown...its not that hard...there is a tutorial on that...and also...their is a tutorial on smooth animation AND one on collision detection...read them!!...i assure u that if u read them...then ur program will be AT LEAST 3 X as good as it is now, your questoins will be more precise (thus esier to answer)...AND you will get a higher grade than before (at least about 10% higher)...so yea....GO READ TUTORIALS
Andy




PostPosted: Sat Jun 07, 2003 2:03 pm   Post subject: (No subject)

damn, sorry that i have to do this but, marz, but i have to agree with void on this one, your game does suck. go to the tutorial section and read all the tutorials and then maybe your game wouldn't suck anymore.
PaddyLong




PostPosted: Sat Jun 07, 2003 6:57 pm   Post subject: (No subject)

void... I would have to disagree with your statements about after 6/7 months of using turing you should know how to use getch and the ords of arrow keys...

those are things for specific tasks ... I think it is more important to learn the logics of programming before you start trying to learn specific things like getch and ords of arrow keys...
Homer_simpson




PostPosted: Sat Jun 07, 2003 9:04 pm   Post subject: (No subject)

i owned turing after 2 weeks of using it... Wink
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Sat Jun 07, 2003 9:11 pm   Post subject: (No subject)

and catalyst owned everyone after 4 months
programming isn't that hard, that is if you want to learn it.
void




PostPosted: Sun Jun 08, 2003 10:28 am   Post subject: (No subject)

PaddyLong...i think ur an idiot for disagreeing with me..and ur reasoning for doing so is dumber than the fact that you actually disagreed.....using getch is something u learn along with get and put...the first two things in turing...if you used what u call "programming logistics" then...you would think...what is the only way i can get 1 Key input from the user...so that i can use the arrow keys....hmm....WHY NOT GETCH....and for the arrow keys...use ord..something i learned in the first week of using turing..and something my CS teacher taught us back in november....NOT TOO HARD NOW IS IT???....this is using logics....NO ONE TOLD HIM TO MEMORIZE THE ASCII CODES AND OTHER SUCH "SPECIFICS"....in programing there are VERY few specifics...and 50% if that is created by people with logic...and memorized by those without...so if you would please not be such a dumbass...much appreciation
**The preceding did not express the feelings of CompSci.ca or any of its webmasters or members (other than me...void..the heartless feind)
void




PostPosted: Sun Jun 08, 2003 12:19 pm   Post subject: (No subject)

code:

var w : int := Window.Open ("fullscreen,nocursor")
var x, y, colr : int
colorback (black)
cls
loop
    randint (x, 1, maxx - 50)
    randint (colr, 1, maxcolor)
    for decreasing a : maxy .. 1
        drawfillstar (x, a, x + 50, a + 50, colr)
        delay (1)
        drawfillstar (x, a, x + 50, a + 50, 256)
    end for
end loop

wow...if you take out the huge intro...i think my program and urs do the same thing....very interesting isnt it?
Andy




PostPosted: Sun Jun 08, 2003 12:58 pm   Post subject: (No subject)

LOL, go void, way to kill the lil programmer's confidence
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: