Göran Posted November 26, 2014 Report Share Posted November 26, 2014 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: 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. Quote Link to comment Share on other sites More sharing options...
VizuaaLOG Posted November 27, 2014 Report Share Posted November 27, 2014 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. Quote Link to comment Share on other sites More sharing options...
Göran Posted November 27, 2014 Author Report Share Posted November 27, 2014 Oh wow, I didn't think it would be that easy. Thank you so much! The problem now is, that grass tiles for example, are placed behind the playersprite as well. How would I fix that? I can't change any order there.. Quote Link to comment Share on other sites More sharing options...
VizuaaLOG Posted November 28, 2014 Report Share Posted November 28, 2014 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 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.