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

Username:   Password: 
 RegisterRegister   
 Collision Detection
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jono11




PostPosted: Thu Apr 29, 2004 10:29 am   Post subject: Collision Detection

Hello. I am a grade 12 computer science student working on a partnership project. The game we have decided to make is a stealth game that is similar to Splinter Cell (on a much lower level) from an above view. We are having difficulties with our collision detection though. We cannot grasp the concepts to get it working. We had this idea to have each level as an array and our players and guards as an array. If the x or y value of the player equals the x or y of either an object or a guards range of detection
then you can not move in that direction (for an object such as a desk) or you are caught (if the guard sees you) However, what would the range of the array be for each object...would you have to incorparate all the pixels of the object or just certain ones. I hope this is clear enough and await your response. If there is any difficulties trying to comprehend the concept I have outlined please tell me so. Thank you very much for your time...

Jono
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Thu Apr 29, 2004 10:36 am   Post subject: (No subject)

not every pixel, just general tile such as

00000
01100
00000
00000

where 1s represent any tile onto which you can't move. This binary map is aligned with play map and before player makes the move, his new x/y location is compared to the binary map and if the tile is free (0) he is free to move, otherwise he would collide into an object
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
jono11




PostPosted: Sun May 02, 2004 3:01 pm   Post subject: Other suggestions

Thanks for the help. I have one more question. How would I compare the values. In my if statement would I use the x any y variables for character to compare pixels, set the 1's (or I guess TRUE) statements as true and then say if true then x=0 (so they are restricted to move) or compare pixels. Any suggestions on that would be help, maybe to which idea is easiest and most efficient. Also if anyone new gets this message and has another format to try that could also be beneficial. Thanks a lot again...

Jono
Display posts from previous:   
   Index -> Programming, Java -> Java 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: