Dropthrough Tiles

I have perfected dropthrough tiles, it is actually pretty simple.

you can press down to drop through it.
I didn’t want to code a new movement engine, so I just copied one of my other games, Tower of Anger


you will need to go into javascript to get mySprite.image.height, but you can also just take it out and set to your players height in pixels

java code that you can copy and paste
game.onUpdate(function () {
    for (let value of tiles.getTilesByType(sprites.swamp.swampTile2)) {
        if (mySprite.y + mySprite.image.height / 2 <= value.top && !(controller.down.isPressed())) {
            tiles.setWallAt(value, true)
        } else {
            tiles.setWallAt(value, false)
        }
    }
})

make sure to change the sprite name and the tile.

7 Likes

Can’t you access the height of the image natively? Using the ‘get property’ block?

1 Like

Lol i guess i didn’t see that

1 Like

so, after playing around with this in my own game, i stumbled upon a much, much less convoluted way to make fallthrough platforms. here’s a simplified version.
image
hope this helps!

1 Like