Reputation: 21
I am new to the world of libgdx
and the world of game programming in general. I want to create a game, but not any game. I have created some basic game like breaks, and pong. But I still cant go any further, I google for good articles, but I always have problems with collision, especially between entities! I want to create a game with slopes like sonic.
Upvotes: 1
Views: 1493
Reputation: 21
I recommend you to use box2d if you know the basics. if you know how to use a rectangle, sprite batch, camera etc. Then you should proceed to Box2d if you don't just take some good tutorial and try to make the application without any extension.this will make your concept clear and you will easily able to grasp the logic behind the game.
Upvotes: 0
Reputation: 440
Why not use Box2D (libGDX extension) ? It's perfect for platformers.
Upvotes: 5
Reputation: 1419
Create Your bounds using rectangle class in Libgdx and test them using Intersector class.
This class has many function to test overlapping of rectangles, circles etc..
Upvotes: 3
Reputation: 539
Do you know how to create rectangles. I assume that you know about rectangles. if you want to check collision of two rectangles you can do as follows:
Rectangle a = new Rectangle(), b = new Rectangle();
in constructor set rectangles
a.setRectangle(yourX, yourY, yourWidth, yourHeight);
b.setRectangle(yourX, yourY, yourWidth, yourHeight);
in render check collision like this:
if(a.overlaps(b))
{
//do your work
}
Upvotes: 4
Reputation: 2305
U can use OverlapTester class given in SuperJumper Project by LibGdx
Upvotes: 3