Slick Forums

Discuss the Slick 2D Library
It is currently Wed May 22, 2013 3:06 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Sun Jul 01, 2012 11:07 pm 
Offline

Joined: Sun Jun 17, 2012 6:17 pm
Posts: 4
I've attempted to create collisions between bodies, but I'm not sure if I've created my first 'body' correctly.

My total entity is 53x26
From 14, 1 to 52, 10 should be a rectangle
From 14, 14 to 51, 11 should be a rectangle
From 15, 15 to 50, 21 should be another rectangle
From 27, 22 to 44, 25 should be another rectangle

I've given it a try but I'm not sure that's it's correct, some clarification would help.
Code:
CompoundShape player_body = new CompoundShape();
        player_body.add(new Rectangle(38f, 9f).setOffset(14f, 1f, 0f));
        player_body.add(new Rectangle(37f, 3f).setOffset(14f, 11f, 0f));
        player_body.add(new Rectangle(35f, 6f).setOffset(15f, 15f, 0f));
        player_body.add(new Rectangle(17f, 3f).setOffset(27f, 22f, 0f));
       
        Body<?> new_body = new Body(player_body, player.getPositionX(), player.getPositionY())
        { };
       
        world.add(new_body);


Thanks a bunch!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group