1 decade ago by Zetaphor
Hello everyone, let me start by thanking Dom for this excellent engine. I was hesitant at first, but it has definitely been worth the investment of my $99.
I've been fortunate to find the answers to all of my questions thus far in either the documentation or by a previous question in the forums. Though with this particular problem, I can't seem to find an answer.
I'm attempting to detect which tile in my tileset the player is currently standing on. I will be using this to trigger reactions in the player entity, an example being walking on ice tiles will reduce the players friction.
Here is a snippet of the code I'm currently using to retrieve the tile
The problem here is that no matter which tile I'm standing on, the value is always 1. I'm looking for a value that corresponds with the particular tile in my tileset.
I've looked at the getTile and setTile methods, but I can't seem to make enough sense of it to achieve my goal.
FYI: I'm using the provided Biolab player sprite and level tileset, I've simply changed the color of a couple of the second row tiles.
Any help would be greatly appreciated.
I've been fortunate to find the answers to all of my questions thus far in either the documentation or by a previous question in the forums. Though with this particular problem, I can't seem to find an answer.
I'm attempting to detect which tile in my tileset the player is currently standing on. I will be using this to trigger reactions in the player entity, an example being walking on ice tiles will reduce the players friction.
Here is a snippet of the code I'm currently using to retrieve the tile
handleMovementTrace: function( res ) { if( res.collision.y ) { console.log('tile: '+ig.game.backgroundMaps[0].getTile(res.pos.x, res.pos.y+2)); }
The problem here is that no matter which tile I'm standing on, the value is always 1. I'm looking for a value that corresponds with the particular tile in my tileset.
I've looked at the getTile and setTile methods, but I can't seem to make enough sense of it to achieve my goal.
FYI: I'm using the provided Biolab player sprite and level tileset, I've simply changed the color of a couple of the second row tiles.
Any help would be greatly appreciated.