Me and my friend are working on a tower defense game and we’ve come across an issue. When a tower detects an enemy within range, it fires bullets at it. Since the targets are moving, the bullets don’t move fast enough to hit them. I fixed this a bit by slow parenting it to another object that guides it. Since the towers fire at the guide, the bullets always hit the enemies regardless of speed but if the distance between towers and enemies are too far, the bullets miss them, This is where I’m stuck.
tl;dr version: Is there a way to make sure the bullets hit the enemies regardless of the distance between the tower and the enemy?
You could use the ‘Track to’ option in the Edit Object actuator and have it track to the enemy.
Yeah that’s what i’m using but the bullets miss the enemies if the distance is too far. I’ll attach a blend file after school to help you guys understand.
Make the bullets track to the enemy?
Each shooter will have its own target analyzer (an empty mesh. this is required either in 2D or 3D).
- Shooter will get 1 target, maybe by range, priority, etc.
- Analyze target movement and location, bullet/cannon mass, winds, etc - projectile.
- Firing will be base on these target analyzer - to get a correct “projectile”
- Accuracy will be based on floating point round up - while looking at the target.
Another critical tips: use “id”, “global” and object “property”… so that, the shooter in the same team will not competing with each other chasing/shooting 1 single target.
When I made a TD game, I made projectiles track to the target. Projectiles always moved faster than the targets so the projectiles pretty much always hit.