Enemies Start Shooting When Actor Arrives

MarkosMarkos Member Posts: 3
edited November -1 in Working with GS (Mac)
I have the main actor and I already placed the enemies along the scene (15 images total as one background)....How can I make the enemies shoot only when the main actor is coming near them...??

Comments

  • ValanValan Member, BASIC Posts: 410
    You can set an invisible actor that shadows the main actor. This is the shooting area. Also setup an attribute called enemies shoot.
    (in the shadow actor)
    So when the shadow actor hits an enemy the attribute changes to a value where they all fire.

    (in the enemy)
    If you want only the closest enemy to fire then you can say when the enemy collides or overlaps with the shadow actor it fires.

    Hopes this helps

    Valan
  • okimokiokimoki Member Posts: 159
    Make an attribute to the enemy called "distanceToTarget", to this atribute assign: magnitude(positionofplayer, positionofenemy).. then make a rule: when distanceToEnemy < 300 (or whatever you want), shoot!
  • AppsRacKAppsRacK Member Posts: 346
    Addition to what Okimoki said you could make the enemies rotate as well to where the main actor is by using vectorToangle.
  • jeancrast2jeancrast2 Member Posts: 12
    Thanks all of you
Sign In or Register to comment.