Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Libgdx - Pong Collision Detection with Rectangles on: 2013-10-04 19:58:26
Hey guys,

First time posting here. I've been looking over various bits of code from different tutorials out there and decided to make a simple pong game using libdgx. However, I ran into a problem when setting up collision detection. I tried searching around but I can't seem to find what I'm looking for (not sure what I would search for with my issue).

Anyway, sometimes when the ball collides with the player at a certain point, usually on the bottom part of the player, the ball will "slip through" the player rectangle and bounce inside of it until it gets to the end of the player. Then it slips out.

This is just what the game looks like.

And this is my issue.

Here's my code:

If someone would just point me in the right direction or provide any help on this it would be greatly appreciated.
I'm a noob at this so if you guys have any tips on improving code or anything like that, that would be cool too!

EDIT: I'm an idiot. I'm not checking for a collision before I make a move... I think. I'll post an update once I work it out.

Pages: [1]
EgonOlsen (75 views)
2018-06-10 19:43:48

EgonOlsen (56 views)
2018-06-10 19:43:44

EgonOlsen (76 views)
2018-06-10 19:43:20

DesertCoockie (256 views)
2018-05-13 18:23:11

nelsongames (156 views)
2018-04-24 18:15:36

nelsongames (155 views)
2018-04-24 18:14:32

ivj94 (896 views)
2018-03-24 14:47:39

ivj94 (157 views)
2018-03-24 14:46:31

ivj94 (809 views)
2018-03-24 14:43:53

Solater (173 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!