Do anyone know how to make break and place block? I want to make 2d minecraft.
If you want to make breakable/placeable blocks like in Minecraft, here’s how you can do it in a few steps:
Step 1: Place a tile when the A button is pressed
- Go to Scene → drag Set Tile At into the A button pressed event.
- Choose the tile you want to place from the image picker.
- Example:
Step 2: Turn on the wall at that location
- Drag Set Wall At and set it to on at the same tile location as your placed tile.
- This ensures the wall matches the tile placement, just like in Minecraft.
- Example:
Step 3: Remove the tile/wall when the B button is pressed
- Do the same as Step 1 and Step 2, but instead of placing the tile or turning on the wall, delete or turn off the wall.
- Example:
Extra Tips:
- Always make sure the tile location for the wall matches the tile location exactly. This keeps the placement precise.
- You can create your own tiles by clicking the transparency image picker in Set Tile At and selecting the tile you want.
Congrats! With these steps, you now have a working break-and-place system similar to Minecraft.
Also, here is the game:https://makecode.com/_iygdeEfJhdME This is an example of how to stack blocks and delete them.