Jump to content

  • Log In with Google      Sign In   
  • Create Account


Lars-Kristian

Member Since 20 Jul 2012
Offline Last Active Nov 02 2012 02:35 AM

#4987487 Whats a good way to do collision detection in a simple JFrame game?

Posted by Lars-Kristian on 06 October 2012 - 01:36 PM

If you have a basic understanding about vectors this link will help you a lot:
http://www.metanetso.../tutorialA.html

Under the "calculating the projection vector" section.

You can:
1. Find the the smallest projection vector.
2. Move the ball on the outside of the paddle.(The length of the projection vector)
3. Reverse the acceleration of the ball in the direction of the collision.

Note: It can also be useful too not allow movement of the paddle if the ball hits the top or bottom side of the paddle, so that the ball and paddle does not collide 2 time in a row.

This is not the simplest method too find the collision, but it is very useful when it comes too collision handling.

If this does not make sense, please let me know. xD


#4962335 Easy programming language

Posted by Lars-Kristian on 23 July 2012 - 01:28 PM

I think Python is really fun to start with, and PyGame is easy to learn.
The best about pygame.org is that you can download games that others have made, and take a look at there source code.


PARTNERS