Magnitude attribute stop?

AjBlueAjBlue Member Posts: 215
edited November -1 in Working with GS (Mac)
oh so i have a turret running a magitude(turret-enemy) once enemy is within 400, change attribute to true. when attribute is true, timer every 2 seconds: projectile > change attribute x,y to enemy x-25,enemy y+10

i tried having an otherwise change attribute x,y back to start (offscreen)
and having another rule , when projectile is destroyed(collide) change x,y to offscreen

but what happens is once the last enemy on screen is killed the projectile "spawns" back to the last spot it killed an enemy and sits there, this is a problem because when more enemies spawn they would run into the projectile without the turret "firing"

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Try it like this.Have the so when enemy is within 400, change attribute to true, then in the otherwise section of that rule have change attribute to false.
  • AjBlueAjBlue Member Posts: 215
    i do have that
  • AjBlueAjBlue Member Posts: 215
    i don't know how i managed it, it might be from the boolean attribute. but when there are no enemies spawned at start, the turret records the distance as 259.03, and yet it doesn't spawn a projection
  • AjBlueAjBlue Member Posts: 215
    if you need a video to help you visualize the problem i can do that
  • AjBlueAjBlue Member Posts: 215
    wait i think i got it. i gave the projectiles otherwise a timer of 2 seconds and now when a emeny is spawned the projectile disappears after two seconds
  • simo103simo103 Member, PRO Posts: 1,331
    HI AjBlue .. whilst I'm not quite sure how to do a better fix .. I think you should search for one as you will have a bunch of spawning and timers which could effect performance.

    On the surface the fix you created may work but might not be optimal. If you want us (or me) to think a little harder on this please post that video so I can get my head around your issue.
  • AjBlueAjBlue Member Posts: 215


    the only moveable actors are the actual soldiers. because there is no other way to make an actor move in a direction and make them stop once close to another object
  • simo103simo103 Member, PRO Posts: 1,331
    Hi AjBlue .. I have watched the video a few times and am not clear on a few things however.

    1. It appears the projectile is just being moved to the enemies position (ie: there isn't a visual of the projectile leaving the turret and traveling to the enemy). Am I correct or perhaps I missed it.

    2. All enemies get hit and killed ... (ie: the projectile is designed to kill all enemies at the right distance)?

    if 1. you don't want the projectile path to be seen. I guess bullets moving so fast they can't be seen is correct and 2. all enemies 'get hit' at a certain distance. Then I would do away with the projectile and just set your enemy to animate a bullet hit at the right distance or even place an invisible actor at that distance and when the enemy collides with that invisible hit actor then animate a bullet hit.

    OTHERWISE: I have a project where an archer fires an arrow when the enemy advances to a certain range. The arrow is spawned and has its velocity and rotation set so it travels and falls correctly. However it is not certain to collide with the actor so the actor only dies when it gets hit otherwise arrows collide with the ground and destroy.
Sign In or Register to comment.