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

Username:   Password: 
 RegisterRegister   
 Game help - images and collision
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
1337




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
guruguru




PostPosted: 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
Tony




PostPosted: Wed May 26, 2004 10:16 pm   Post subject: (No 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: