Tower Defenese Help
Fajlajp
Member Posts: 666
Hi
I've run to a dead stop in my game...
I've try to make a tower defense game(just like bloons tower defense) I've succeded with all the things execpt one. I can't get a turret to shoot the enemy who is closest to the exit. I have done so the actor shoots in a specific range. I have tried different methods but does not work when you have multiple turrets. Please help me as soon as possible. I've worked all day trying to figure this out...
//Fajlajp
I've run to a dead stop in my game...
I've try to make a tower defense game(just like bloons tower defense) I've succeded with all the things execpt one. I can't get a turret to shoot the enemy who is closest to the exit. I have done so the actor shoots in a specific range. I have tried different methods but does not work when you have multiple turrets. Please help me as soon as possible. I've worked all day trying to figure this out...
//Fajlajp
Comments
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Another idea, since now you've got me thinking about it, is to have a bunch of invisible checkpoint actors along the path that the enemies travel. Each checkpoint is numbered (self.checkpointNumber). When an enemy overlaps with a checkpoint, change its own self.myCheckpointNumber to the checkpoint it just overlapped and if that checkpoint number is greater than the highest checkpoint reached (game.HighestCheckpoint), then change game.HighestCheckpoint to self.myCheckpointNumber. If an enemy's self.myCheckpointNumber is equal to game.HighestCheckpoint, constrain game.enemyTargetX/Y to its self.positionX/Y and have the tower always target game.enemyTargetX/Y.
***Or forget about checkpoints and distance and just use self.Time, assuming that the enemies are traveling in a more or less straight path and the enemy that has been on the screen the longest is always closest to the exit.
Phew!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User