Jump to content

Collide player and colored rectangle


PiDEV
 Share

Recommended Posts

Hi,

 

I have code:

function create(){ mapObjects = game.add.group();    mapObjects.enableBody = true;    // Add some boxes    var boxs = mapObjects.create(400, 400, 'crate');    boxs.body.immovable = true;    boxs = mapObjects.create(700, 700, 'crate');    boxs.body.immovable = true;}function update(){game.physics.arcade.collide(you.sprite, mapObjects);}

This works great. It's colliding images with my player.

 

But how do I create a colored rectangle (not image) and collide it with player?

 

Thanks

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...