Jump to content

Need some platforming help


Recommended Posts

Hello everyone  :)! Just started using Phaser and have been enjoying it. Here's the prototype of a game I'm developing:




The source code is here:




One quick thing first. I've noticed that sometimes on Chrome the game would experience horrible lag. It never seems to happen on Firefox or *gulp* IE, though. Would anyone know why that is?


Please use the arrow keys to move in the prototype. Press and hold space to jump. Avoid the person or he'll teleport you back to the start.


Now, notice how when you're jumping, if you bump into the side of a platform, you'll stop moving. This is of course expected. However, let's say if you jump and hit a platform to your right, if you keep holding the right arrow key, the character will get stuck walking in the air.


I think this can be fixed if I can modify my collision checks a little. At the moment, I run a function to stop the character if he touches the platform from any direction. I want to be able to check whether the character is completely above the platform when the collision happens. But I'm having trouble with doing that. I've tried changing Phaser.Collision.ANY to TOP but that did nothing. Also, I've tried getting the coordinates of both the character and tile using collisionData on callback. However, the y coordinate returned for the tile seems to be completely different from what it should be. That made position checking impossible.


This would be the class to look at:




Thank you heaps! Really looking forward to version 1 with documentation. Keep up the good work :).

Link to comment
Share on other sites

If I remember rightly in that version of Phaser the tile Y coordinate returned was the map y index rather than a screen based one. So if you've got a 32x32 pixel map you'd need to multiply the returned y value by 32 to get its on-screen position. That should hopefully help you ought a bit before 1.0 launches in a few weeks.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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