Enemy Sees You

RaidenMX_BuisnessRaidenMX_Buisness Member Posts: 9
edited September 2012 in Working with GS (Mac)
I'm making a plat former game but having some trouble with it seeing that I can't get the enemy to do something when getting to a certain pixel near I have looked at Tshirtbooths channel but it didn't work for me so please help

Comments

  • ashtmjashtmj Member, PRO Posts: 405
    step 1:
    you need to make 2 real global attributes named

    Player X
    Player Y

    Then in your player actor add these two Constrains

    Constrain attribute> Game Player X >to your player actor's self position X

    Constrain attribute> Game Player Y >to your player actor's self position Y

    Now give your enemy actor a real attribute called distance

    then make a rule in that enemy actor:

    Constrain attribute>self distance> to (Now Select insert function>

    (magnitude( self.Position.X-game.Player X , self.Position.Y-game.Player Y )

    Then you just make one more rule within that enemy

    If self Distance is less then (however far away you want the payer to be before he sees him) then cause whatever actor you want the enemy to do

    Hope that helps
Sign In or Register to comment.