Talking about Spring Ninja game, Game development, HTML5, Javascript and Phaser.
My latest tutorial about Spring Ninja has been one of the most popular post of this year, unfortunately most of the feedback received both through comments and private messages was about a bug I really was not able to reproduce, but I think I found a solution anyway.
To check if the ninja is on the top of a pole, in the original script at line 101 I wrote:
if(p.y>=n.y+n.height/2){
p.y
is pole vertical position, which has the vertical registration point is on the top of it. n.y
is the ninja vertical position, which has the vertical registration point in the middle of it, that’s why we add n.height/2
. This ensures us the ninja is on the top of the pole but also can lead to a bug if ninja or pole positions aren’t pixel perfect.
If you change the line with
if(n.body.touching.down){
Which checks for the ninja to touch its bottom side, the bug should be fixed.
Try to change this line and let me know.
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.