NightsWatchGames / battle-city

Classical battle-city game made with bevy engine.
https://nightswatchgames.github.io/games/battle-city/
MIT License
87 stars 12 forks source link

Set a rectange collision shape for players and enemies #9

Closed MyMarvel closed 7 months ago

MyMarvel commented 7 months ago

The issue with round shape is that the battle tank behaves in a weird way when it hits some block's corner (usually it gracely slides over the corner), but sometimes the tank do a teleportation to a random battlefield point. Anyway, all tanks are almost square and the collision shape should match it. The rectangle shape is must have for a decent damage system too. I foresee an issue with this though: it will be hard to navigate player's tank to a narrow passage. I noticed there is a light hack in the original game - there is a little helper system so when a players misses a narrow passage between walls on small amount of pixels the system helps the player and moves the players tank there anyway. So it behaves like the round collision shape, but in reality it's not. So I think we should implement both rectangle collision shape and this little helper.

lewiszlw commented 7 months ago

I used rectangle shape in my initial implementation, but it will stay stuck in place as rotation locked. If you have good solution, just try!