Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Collision Detection
Author Message
jono11

Posted: 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

Tony

Posted: 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
Tony's programming blog. DWITE - a programming contest.
jono11

Posted: 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: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 3 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: