Skip to content

Full-block tile in arcadeslopes not registering for collision #49

@therladbsgh

Description

@therladbsgh

I'm currently using the Arcade Slopes tileset (32px) provided in this repository. However, the tileset is showing some bizarre behavior; in particular, the first tile (full-block) is inconsistent in being collide-able.

Below is an example in Tiled of using the tileset in a map:

img1

However, when seen in the actual game, the selection of full-blocks on the top-right is not registered for collisions at all. Also, while the half-blocks are registered for collision when used in the house, it does not register for collision when placed next to a full-block (as seen in the stack of logs next to the house.)

img2

However, the tiles on the stack of logs WILL register for collision if there are other tiles directly adjacent to it. Below is an example in Tiled where I place more vertical half-blocks near the logs:

img3

In this case, when seen in the game, the collisions work as intended (although the tiles in the top-right are still not registered):

img4

I'm not sure if this is a bug, or if there is a specific criteria that needs to be required for full-blocks (and other blocks) to be registered for collision. Below is the relevant code for your reference. Here's the actual link to the repository if more information is needed. I'm also using Phaser CE (v2.8.4).

Game State:

preload() {
    this.game.load.image('sprite', 'assets/sprites/sprite.png');
    this.game.load.spritesheet('arcade-slopes-32', 'assets/map/arcade-slopes-32.png', 32, 32);
    this.game.load.tilemap('map', 'assets/map/example_map.json', null, Phaser.Tilemap.TILED_JSON);
    this.game.load.spritesheet('tileset', 'assets/map/tilesheet.png', 32, 32);
}

create() {
    ...
    const map = this.game.add.tilemap('map');
    map.addTilesetImage('tilesheet', 'tileset');
    map.addTilesetImage('collisions', 'arcade-slopes-32');
    for (let i = 0; i < map.layers.length; i++) {
      if (map.layers[i].name !== 'collisions') {
        map.createLayer(i);
      }
    }
    this.collisionLayer = map.createLayer('collisions');
    map.setCollisionBetween(0, 34, true, this.collisionsLayer);
    this.game.slopes.convertTilemapLayer(this.collisionLayer, 'arcadeslopes');
    this.collisionLayer.debug = true;
}

update() {
    ...
    if (player && player.sprite) {
      this.game.physics.arcade.collide(player.sprite, this.collisionLayer, () => {
        console.log("Hey");
      });
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions