tomfog

Collision groups and kinematic sprites

Recommended Posts

Hi

I'm new to phaser and have been trying to use some of the examples as a starting point. I'm planning on using the "Pick Up Object" example, but restrict the area that the tetris shapes are placed in - so that they land on a solid platform. I would then add 3 x buttons to add more of the shapes onto the screen. Example here: https://phaser.io/examples/v2/p2-physics/pick-up-object

Would the best way to achieve this be to build the solid platform using a kinematic sprite as documented here: http://phaser.io/examples/v2/p2-physics/kinematic-body

If not, what is the best way define the area that the shapes are placed in - so they do not fall behind or in front of the platform and buttons?

 

Thanks!

Tom

Share this post


Link to post
Share on other sites

Update: I have tried the following with no luck:

solidBlock = game.add.sprite(167, 400, 'solidBlock');

game.physics.p2.enable( [ solidBlock ]);

// first I tried this
solidBlock.body.static = true;

// then I tried this
solidBlock.body.kinematic = true;

Any help or advice would be much appreciated!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.