Sprite placed in the tile

I wanted to place a sprite randomly so i used the "Place (Sprite) on top of random (Tile) " block, I tested it and sometimes it placed it in the tile.

If you don’t get the thing:
The white thing is the sprite,
and the black thing is the tile.

Here’s the link to the game if you need it https://arcade.makecode.com/S71272-31579-63568-84888

I am sorry if this was poorly explained.

@some_sandwich ah, I think the wording of the block is a little confusing!

when it says place “on” a random tile, it means that the sprite will be placed at the exact location of the tile. specifically, it will be placed so that it is centered on the tile’s center.

there are a couple ways you can get the behavior you want; one is to place on top of a random background tile instead of a black one. then you can give gravity to the box so that it falls to the ground:

Screenshot 2023-01-30 at 11.25.56 AM

you could also place on top of a black tile and then just subtract 16 from the sprite’s y to move it up one tile. the downside of this approach is that you can’t have two black tiles next to each other vertically, since that could lead to the box being moved into a wall tile

1 Like