Jump to content

Support of slanted tile in Phaser


Recommended Posts

Hi to you all.

Hi have a question. I'm making a platformer game using phaser and , for now, arcade physics. I make my level in Tiled and export them in JSON.

I noticed that since Tiled work with png tileset and that tiles are square. My character do not detect a slope or slante corner. It stands on a invisible cube border.

What i was wondering is, is it possible for phaser to detect slanted slope using arcade or should i move to P2JS. Also how do I tell phaser to ignore the transparent part and collide only with the image? I tried making object layer coutouring all the platform for a more precise collision but it seems i'm not able to create a collision layer with a Tiled object layer. or maybe i'm doing it wrong.

function create() {

    map = game.add.tilemap('niveau2');


    backgroundLayer = map.createLayer('background');

    collisionLayer = map.objects.evenement.find( o => o.name == 'platform');

    collisionLayer.visible = false;




    player = game.add.sprite(32, game.world.height - 150, 'star');

    player.body.collideWorldBounds = true;

    //  Our controls.
    cursors = game.input.keyboard.createCursorKeys();


function update() {
    game.physics.arcade.collide(player, collisionLayer);

//more code


Capture d’écran 2017-02-24 à 13.34.04.png

Link to comment
Share on other sites


  • Recently Browsing   0 members

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