Game help - images and collision
Author |
Message |
1337
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
guruguru
![](http://www.vialattea.net/esperti/immagini/einstein.gif)
|
Posted: Wed May 26, 2004 10:01 pm Post subject: (No 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 |
|
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Wed May 26, 2004 10:16 pm Post subject: (No subject) |
|
|
well guruguru appears to have atleast attempted to answer something
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 |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
|
|