dbcforgotten Posted February 18, 2017 Share Posted February 18, 2017 Hello i recently started to study Phaser and i have came to a problem witch i need help with solving. I created a 3 layer map with Tiled. SkyLayer, GroundLayer, BrickLayer. I added physics that allow the player to move around the GroundLayer. I also added physics that allow him to jump on the BrickLayer. I am struggling to make a motion that allows the player to jump from the bottom hit the brick with his head, when he hits his head the motion of the brick to move up a pixel and then back down a pixel just as in Mario. I have trouble finding out how to identify which brick section i have hit from the BrickLayer so i can later on apply the animation to the brick element. Quote Link to comment Share on other sites More sharing options...
jonteferm Posted February 20, 2017 Share Posted February 20, 2017 Hey! You can call this function on the tilemap: getTile(x, y, layer, nonNull). The X and Y should be given in tile units and not pixels, so for instance: if you have a 32x32 grid - tile unit 1 would be pixels 0-31 etc. You can see the full documentation here http://phaser.io/docs/2.4.4/Phaser.Tilemap.html#getTile. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.