jurbank Posted September 18, 2018 Share Posted September 18, 2018 Thank you! This has really helped me scaffold my own project. Link to comment Share on other sites More sharing options...
blackhawx Posted October 9, 2018 Share Posted October 9, 2018 Hello nkholski. I love what you are doing with collisions in the game. when Mario is small and he jumps up to hit a brick, what part of the code makes the tile bump up and come back down again? Thanks Link to comment Share on other sites More sharing options...
nkholski Posted October 10, 2018 Author Share Posted October 10, 2018 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. blackhawx 1 Link to comment Share on other sites More sharing options...
blackhawx Posted October 10, 2018 Share Posted October 10, 2018 Your description in the process was all I needed to know. Makes perfect sense. Thanks for breaking that logic down! Link to comment Share on other sites More sharing options...
nkholski Posted October 10, 2018 Author Share Posted October 10, 2018 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. blackhawx 1 Link to comment Share on other sites More sharing options...
Recommended Posts