djog / tank_battalion

Tank Battalion recreation by DJOG Uno's 2020 in processing.
GNU General Public License v3.0
3 stars 0 forks source link

Enemies shouldn't spawn in a brick. #27

Closed robkruger closed 3 years ago

robkruger commented 4 years ago

Currently, enemies spawn on a random x position in the grid on the top layer. This x position can be inside a brick. This shouldn't be possible.

When spawning an enemy, check if the enemy collides with a brick. If it does, give it a new x value, and check again. Do this until it doesn't collide anymore. (Use a loop for this)