Line of Sight Detection Issues

Ok, so I think I have a real issue and I am not sure how to fix this one. I have a table that detects where an enemy unit is, using a cross pattern of invisible actors simulating ray checking. Works great when it only has to fire in one direction at one enemy unit. However the issue is if their are more than one enemy units. For example if there is one to the left and then another to the right it just will not fire. I assume it's because it has no idea what to change the table to since it's picking up on two objects.

So my question is what would be the easiest way for it to decide to choose one target shoot it till it dies. Then start shooting at the other target?

Comments

  • ironDanironDan Member Posts: 148
    You can create a 3 Table or Global X/Y attributes. 1st Target X 2nd Target Y 3rd Target Locked On. When an actor is hit with a bullet, constrain Actors X/Y to the Table/Gobal X/Y position. And Set the Locked on to true or 1 (whatever you choose) Then in your actor just create a health attribute that counts down the health when hit by a projectile and when the health hits zero then change Table/Global Locked On to False or 0. while this is going on the gun that fires projectiles just add a rule to your in place rules that says if Table/Global Locked on is True it can't fire on any other enemy. When the current enemy health hits zero and Locked on is False/0 the the gun will track and engage the next enemy.
  • CloDeviousCloDevious Member Posts: 5
    The issue I am wondering through is would I need to create a table that can add attributes? The reason I kind of thing this is when you place more than one turret they can not all use the same attributes at the same time yes?
  • CloDeviousCloDevious Member Posts: 5
    Ok, so the table thing does not seem to be working. This is how my cannon is setup it's using separate collision objects to detect enemies. The table thing will work if I use one collision to detect direction. However I only want it to be able to shoot in 4 directions X, -X, Y and -y. basically up, down, left, right no in between.

    How the game is being designed, the cannons will only shoot at each other if they are within those collision detection's. The problem is when you place a cannon, down and their are already two enemies cannons, one above and lets say one to the right. It just stops. If GS would let me check an attribute from a table I am sure it would work. However it does not seem to let you do that in a condition.

    http://i917.photobucket.com/albums/ad16/Chloe_Audrey_Lee/GameSalad/Bugs/GS_Issue_01_zps25e24fcb.jpg

    http://i917.photobucket.com/albums/ad16/Chloe_Audrey_Lee/GameSalad/Bugs/GS_Issue_02_zps6fe2deb2.jpg
Sign In or Register to comment.