Jump to content

Check collision of tile while on top


Göran
 Share

Recommended Posts

Hello everybody.

 

In the process of experimenting with Phaser I startet to write code, which will implement "ladder functionality". Ladders out of platformers.

I got it working to the point, where If the play is on the ladder tile and presses up, the velocity changes. BUT, the player sprite is being rendered behind the actual ladder. How can I change this?

 

Here is a screenshot of it in game: Screenshot_11262014_10_54_21_PM.png

 

I would like the sprite to be on top of the ladder.

 

 

 

I am using the latest stable version of Phaser.

I really appericiate any help anyone can give me.

 

Link to comment
Share on other sites

I've been learning Phaser as well so this kit be wrong but I think you just have to make sure you render the ladder before rendering the player. Because of how canvas works the last rendered thing will be on top. Don't think there is a option to change this when it has already been rendered.

Link to comment
Share on other sites

Sorry for the late reply.

 

Glad it solved your problem :). About your grass issue, I did some googling and found out the sprite object has a method to bring it to the top of the display list. Not sure if this will solve your issue as I haven't used this myself. Here is the documentation for the method http://docs.phaser.io/Phaser.Sprite.html#bringToTop

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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