Help with enemies

WTDeveloperWTDeveloper Member Posts: 352
edited January 2012 in Working with GS (Mac)
Hey everyone,
I started a new Project out of the "Official Cross-Platform Controller Template" and I add Enemies. Now I want that the enemies follow the main character. I used "Move To" the Position of the main character. But how can I make that the enemy look on the main character and shoot on him???
Now the enemy move to the character but look on different sides...
What's the problem??
WTDeveloper

Comments

  • App SurgeApp Surge Member Posts: 651
    Make to real attributes, called maine and mainy

    In the main character make a behavior that says constrain game.mainx to self.position.x
    Then make another constrain attribute behavior that says constrain attribute game.mainy to self.position.y

    Then in the enemy, make a constrain attribute and say constrain attribute self.rotation. to vectortoangle(self.position.x-game.mainx, self.positoin.y-game.mainy)
    Then just use timer that says every x seconds spawn actor x and then set the direction of the bullet accordingly and the speed.
Sign In or Register to comment.