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

Username:   Password: 
 RegisterRegister   
 Collision detection using Sprites
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
hskhan




PostPosted: Sun Jun 15, 2003 5:12 pm   Post subject: Collision detection using Sprites

Hello Guys and Gals. I have been attempting to create collision detection for my game - frogger (well, its actually crabber Wink - had to make it original).

The problem is that I use sprites, so i cannot identify where my car's location is. The program works fine. Just have to figure out this collision detection. Have no fear, i already consulted the tutorial on collisions without success Very Happy

Can some one kindly create the collision detection for one of the cars. Thats all i'll need - i'll use it as a template for the others. Thank you, and enjoy the game Very Happy.



hammadkhan.zip
 Description:
collision problem

Download
 Filename:  hammadkhan.zip
 Filesize:  308.33 KB
 Downloaded:  396 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Jun 15, 2003 6:33 pm   Post subject: (No subject)

even if you you sprites, you still need to keep variables for X/Y location of the sprite itself... use that and width/height of the sprite to construct a box around your image, then use rectangle collision detection Smile
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
hskhan




PostPosted: Sun Jun 15, 2003 6:59 pm   Post subject: (No subject)

tony wrote:
even if you you sprites, you still need to keep variables for X/Y location of the sprite itself... use that and width/height of the sprite to construct a box around your image, then use rectangle collision detection Smile

i didnt want to do that. could you kindly do so for only one of the cars, i really hate sprites. i dont even know how to do what you just said. it would be much appreciated. Sad
Andy




PostPosted: Sun Jun 15, 2003 7:00 pm   Post subject: (No subject)

well u should go to the tips section and read up some collision detection tutorials instead of getting others to do ur work for u
hskhan




PostPosted: Sun Jun 15, 2003 7:02 pm   Post subject: (No subject)

dodge_tomahawk wrote:
well u should go to the tips section and read up some collision detection tutorials instead of getting others to do ur work for u


how can i make sprites output the coordinates? seems like they are stuck in there, and cant be used by the global variables.
Andy




PostPosted: Sun Jun 15, 2003 7:04 pm   Post subject: (No subject)

what are u trying to do? move the sprites?
Andy




PostPosted: Sun Jun 15, 2003 7:06 pm   Post subject: (No subject)

o and btw, turing's sprite mudule doesn't work very well, its very very buggy so i wouldn't use it if i were u, my best bet is to make ur own module
have the names of the sprites in a textfile, and have an array for the sprite IDs by reading it off the textfile
hskhan




PostPosted: Sun Jun 15, 2003 7:09 pm   Post subject: (No subject)

the sprites move fine, but i simply need to add collision to it. the problem is that i cannot gain access to the variables inside the sprites. once i get access to them, i'll be a-ok.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Jun 15, 2003 8:25 pm   Post subject: (No subject)

ok... how do you move your Sprites? using X and Y variables...

use same variables for collision detection
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
hskhan




PostPosted: Sun Jun 15, 2003 8:49 pm   Post subject: (No subject)

^but they are inside the sprites. i need to put the collision in the main prog. could you please see my prog and tell me how. im extremely confused. your time and knowledge would be greatly appreciated. thanks.
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  [ 10 Posts ]
Jump to:   


Style:  
Search: