Need Help.. facing enemy-actor to player-actor in 8 different directions

rainhasntstoprainhasntstop Member Posts: 43
edited April 2015 in Working with GS (Mac)

-I created a player and enemy actor,
-the enemy actor will chase my player.

Note: I have 8 Different pictures of my enemy(pictures = image in 8 different angle)

The Question is how can i set my enemy image in 8way direction?
i want my enemy-actor to face my player-actor in 8way direction?

Comments

  • SummationSummation Member, PRO Posts: 476

    @rainhasntstop Perhaps you could make a rule (or 8) that would change the image based on the orientation of the actor?

  • UtopianGamesUtopianGames Member Posts: 5,692

    Would it be easier to make the enemy rotate towards the player as seen in my platform template v1 below @ 0:40 ?

  • rainhasntstoprainhasntstop Member Posts: 43
    edited April 2015

    @DeepBlueApps i wont use rotation towards because i want my enemy-actor to be more static when switching to another image

    i need 8way angles only, not in all angles..
    up,rightup,left,leftdown,down,rightdown,left,leftup..

  • SummationSummation Member, PRO Posts: 476

    @rainhasntstop ok...

    if self.rotation=0
    change image

    if self.rotation=45
    change image

    if self.rotation=90
    change image

    etc.

  • rainhasntstoprainhasntstop Member Posts: 43
    edited April 2015

    @Summation thanks for info.
    ill give it a try :dizzy:
    honestly i just want to minimize my code, and look for different way,
    because i got lags when i spawned 100 enemies

  • SummationSummation Member, PRO Posts: 476

    @DeepBlueApps said:
    Would it be easier to make the enemy rotate towards the player as seen in my platform template v1 below @ 0:40 ?

    DBA, that's a pretty awesome template. I want it. o:)

  • rainhasntstoprainhasntstop Member Posts: 43

    @DeepBlueApps ist free? :blush:

  • UtopianGamesUtopianGames Member Posts: 5,692
    edited April 2015

    You can take a look at our 8 way joystick template (free) as it might help with the angles.

    http://www.deepblueapps.com/8-way-controller-template/

  • rainhasntstoprainhasntstop Member Posts: 43
    edited April 2015

    @DeepBlueApps any other way? i already tried that type of code, but still got a bit of lags when i spawned morethan 100 enemy, i think its because every single enemy-actor have constrain x,and y position

Sign In or Register to comment.