Jump to content

HELP! trouble with colide on tiles! :(


yogurtu
 Share

Recommended Posts

Hi... I am very very new in phaser development, and already found it pretty cool..

 

I´m trying your example about the onion-head-jumping-dude on the space... and I changed some parts of the tile set png. Introducing new squares that works like Killer Spikes.

 

So, i want now that my player dies when he hits that kind of ground.

 

 

 

I´m trying 2 solutions for this, and bout of them have problems with tile index.

 

 

First one:

 

//Tile 68 and 69 are killer spikes, and if you are touching top face of the tile...

 if ((tile.index == 68 || tile.index == 69) && tile.faceTop)

      player.kill()

 

 

ok, this kills the player, but for some reasson, he dies also when he is not hitting that kind of ground... like if tiles have some sort of bug...

 

 

Second one:

 

// Directly subscribe to callback of tileIndex 68 and 69... 

map.setTileIndexCallback([68, 69], this.spikeHitted, this);

 

this doesn´t work at all..

 

 

 

 

So in conclusion... if i want to do a game (like mario bross) and i want to kill the player when he steps over spikes, how could i do that?

Anybody know a cool example?

 

 

thanks!

 

 

 

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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