problem with tower defense game!

-Timo--Timo- Member Posts: 2,313
hey guys,
I just started a new project, a tower defense game.
but here is the problem

you can see in the video that the second tower also shoots when the enemy is inside the first tower's range...
does someone know how to fix this?
ask for codes if you need them
thanks :)

-Timo-

Answers

  • WhackojackWhackojack Member, PRO Posts: 20
    edited August 2013
    Could you make it so that when it collides with the "range" actor it spawns a "hitbox" actor on the tower inside the range. Then make it so that only towers that are colliding with that "hitbox" actor are able to fire?

    Edit: Only assuming you aren't using unlocked actors for this.
  • FallacyStudiosFallacyStudios Member Posts: 970
    Well there are a few things to depend heavily on your answer. First, are these towers and their range actors always on the screen or are they being spawned?
  • -Timo--Timo- Member Posts: 2,313
    edited August 2013
    @whackojack I can try that, thanks :)
    @fallacystudios they are both being spawned (the tower and the range)
  • -Timo--Timo- Member Posts: 2,313
    edited August 2013
    can you say something like when THIS enemy collides with the range then rotate the tower to THIS enemy?
    Im now using tables and the enemies all have their own number. enemy 1 owns row 1 in the table so row 1 is his x and y position
    if enemy collides with the range then the tower his shooting and rotating attribute is set to true. he has to rotate to the enemy if the enemy is in his range. how can I do this?
    you can't say rotate to position
    x: TableCellValue(Table1, enemy number, 1)
    y: TableCellValue(Table1, enemy number, 2)
    because the enemy number is a self attribute inside the enemy...
  • joshiwujoshiwu Member Posts: 207
    Have you thought about making the target spawn the bullet from the towers location -camera offset?
Sign In or Register to comment.