Jump to content

Can't check collision with layer


lehm
 Share

Recommended Posts

Hi guys, this is my first post so if this is somewhere it's not suppose to be i'm really sorry.

I created a layer with Tiled and want to set collision between the sprite and all the tiles in the layer but it doesn't seem to work. (The map showed up and everything)

Here is my code 

  var create = function(){
    // Razor.game.add.sprite(0, 0, 'bg');
    map = Razor.game.add.tilemap('gamemap', 16, 16);
    map.addTilesetImage('tileset','tiles');
    layer = map.createLayer(0);
    layer.resizeWorld();
    map.setCollisionBetween(0, 5049);
    Razor.game.world.setBounds(0, 0, 3200, 32280);
    Razor.keyboard = Razor.game.input.keyboard;
    Razor.game.physics.startSystem(Phaser.Physics.ARCADE);

    player = new Player(window.innerWidth/2, window.innerHeight/2);

    // Razor.game.camera.follow(player);

  }

 var update = function(){

  Razor.game.physics.arcade.collide(player, layer);

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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