I need help with the code involved with spawning the enemies near the player, but still on random tiles.
i have a solution but i don’t know how to code it
make it so tiles near the player changes to the color of the background
Problems in the current code:
- Random tile placement vs. near the player
tiles.placeOnRandomTile(enemyBot, assets.tile\
myTile10)
places the enemy anywhere that tile exists, which may not be near the player.
follow()
combined with random placement
- Because the enemy may spawn far away, it has to travel before it can engage the player, creating inconsistent difficulty.
botCount
logic
- You increment
botCount
in multiple places (on spawn and on destroy), but it can get out of sync if a projectile destroys an enemy beforebotCount
is updated. Here is the right code here. ### step 1 create a function for the sprite enemy here
. After you do this, then call It on the game update interval if not count is less than bot max count, this is the last step here.
That is it well done, the code is complete.
The first image is blurry man, if you could clear up the resolution please that would be great. thanks.
1 Like