Game programming

Moderators: None (Apply to moderate this forum)
Number of threads: 2047
Number of posts: 5331

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Re: How to detect what side of an object you collide with. Posted by Sephiroth2 on 13 Apr 2001 at 5:56 AM
: I have been trying to get my collision detection to work, but I'm having problems. I can detect when they collide just fine, but I don't know how to determine which side of the player collided with. It is a side-view game (kind of like Mario). I want to be able to tell when the player is touching one of the sides, the top, or the bottom of the block. Do you have any ideas of how to solve this problem? Thanks.
:
To find out which side that is, check each side in succession to find the blocks. For example, to check if the player is colliding on the left, you'd check if there is a block along the left side of the player. But do not include the whole edge, you should cut off some pixels on each side of the edge, or you'll have problem.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.