Selected actor to target another actor

jasongilboajasongilboa Member Posts: 5
edited February 2012 in Working with GS (Mac)
I have an actor that is selectable. When I touch on the map it moves there. However, when I touch the enemy, I want it to realize I'm touching an enemy and start firing instead of moving on top of the enemy. Anyone know how to do this?

Comments

  • MotherHooseMotherHoose Member Posts: 2,456
    edited February 2012
    need a gameAttribute index type to handle the conditions
    touched = 0 nothing going on
    touched = 1 actor will go to touch
    touched = 3 actor will fire

    on your mapActor:
    Rule: when (All)
    Event: touch is pressed
    Attribute: game.touched = 0
    --changeAttribute: game.touched To: 1

    on your enemyActor:
    Rule: when
    Event: touch is pressed
    --changeAttribute: game.touched To: 3

    on your playerActor:
    Rule:
    Attribute: game.touched = 1
    --Interpolate: self.Position.X To: game.Touches.Touch 1.X
    --Interpolate: self.Position.Y To: game.Touches.Touch 1.Y
    --changeAttribute: game.touched To: 0
    Otherwise:
    Rule:
    Attribute: game.touched = 3
    --fire preferably at enemy!
    --changeAttribute: game.touched To: 0 (here or after enemy is destroyed)

    @};- MH
  • jasongilboajasongilboa Member Posts: 5
    Awesome thanks!
Sign In or Register to comment.