Jump to content

Generic platformer + ES6 / Webpack 4 boilerplate


nkholski
 Share

Recommended Posts

  • 3 weeks later...

You have to dig in the code and that part is a bit messy I think. A callback is fired when Mario collides with a tile, if he moves upwards and the collision is from above it will hide the tile and put a sprite at its position which is tweened up and down. When the sprite has returned to the original position it's removed again and the tile is made visible (don't remember if I use alpha on the tile or something else for this). The sprite is called SMBTileSprite which is a stupid name not to confuse with Phasers tileSprites. The implementation isn't that great. If I remember correctly there can currently only be one sprite of this kind, and this sprite should be in a pool to allow multiple simultaneous animations.

Link to comment
Share on other sites

11 minutes ago, blackhawx said:

Your description in the process was all I needed to know.  Makes perfect sense.  Thanks for breaking that logic down!

  

Yes. One pro with this approach that while the tile is replaced with a sprite it's trivial to check collision between that and other sprites allowing you to jump under enemies and destroy them. Right now crushing a brick won't kill an enemy above the brick because I just remove the tile. This could be solved to do exactly as when bumping the brick but setting the alpha of the temporary sprite to 0.

Link to comment
Share on other sites

  • samme unpinned this topic
 Share

  • Recently Browsing   0 members

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