This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Collision Detection Help

 
Justin Blackwell
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I'm programming a 2D sidescroller/platformer written on Java using Slick2D. The past couple weeks, I've had a lot of trouble with collision detection/response.

Detection & Response I'm Looking For
Rectangle-on-rectangle collision detection, with the response being to move the involved sprites away from each other. If one or both sprites are defined as static (represented by isStatic), don't move that sprite.

Code
Here's my code relating to it in my Sprite class:


The Problem
My problem is when either sprite in the collision is not perfectly square. How could I modify this code to work with non-square rectangles?
If I'm way off course with this code, if someone else has better, working code, I'd accept that too.

Thanks in advance!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic