Computer Science Canada

Game help - images and collision

Author:  1337 [ Wed May 26, 2004 9:41 pm ]
Post subject:  Game help - images and collision

For my final project at my school in Gr 11, I decided to make a game. Everything looks good, but when I am using my images for dropping balls, how do I make it so that once it touches the bottom, it can detect it, so that the user knows he/she lost. And another question, while it's dropping, and the user has to catch the ball, how do you make it disapear when it's caught? This is image based, so everything is used in jpgs.

thank you

Author:  guruguru [ Wed May 26, 2004 10:01 pm ]
Post subject: 

1)

code:

var imageX, imageY : int
var image := Pic.FileNew ("mypic.jpg")

loop
    cls
    imageY -= 5
    if imageY <= 0 then
        put "You lost!"
    else
        Pic.Load(blah)
    end if
end loop


2)

code:

if ballCaught then
    Draw.FillBox (imageX, imageY, imageX + width, imageY + height, white)
              OR
    imageY := maxy
end if

Author:  Tony [ Wed May 26, 2004 10:16 pm ]
Post subject: 

well guruguru appears to have atleast attempted to answer something Laughing

to check for collision with the bottom of the screen you just compare the Y value of the ball with 0 (or where you bottom is) and if its under ball radius, it has hit the line)

as for the ball disappearing act... you will be keeping them in an array (you'll have more then one ball, right?) so when user catches it, the array element is dropped and it just doesn't get drawn in the next frame


: