Hi, here is the game: https://arcade.makecode.com/S35232-16326-05275-76354
I don’t want to copy and paste the same enemy features a thousand times with a different sprite name. So I was wondering how to create a sort of group that would function as a single shared sprite, but where I could place different sprites in different locations on the map.
1 Like
This function, called Enemigos, spawns enemy sprites at predefined map locations. Here’s a step-by-step explanation:
- It loops through each location from the array of all tilemap locations of a specific tile type (the yellow square).
- For each location:
- It creates a new sprite (an enemy with a skull image) of kind Enemy.
- It places the enemy sprite exactly on top of the location (tile) that was selected.
- It also sets the tile at that location to another tile (shown in green), possibly to mark the spot as used or to change its appearance.
This is typically used to automatically populate a map with enemies based on the level design, making it easy to control where enemies appear without manually placing them one by one.
Hope this helps or inspires you!!
2 Likes
Thanks for the help, I’ll try it.
2 Likes