GameSalad

turret gun

Hey Guys,

I am working on a platformer that will have a turret gun that will track the the movement of the hero. Once the hero gets in range it will fire at him. What would be the best way to have the turret track and fire it the right direction?

Comments

  • tatiangtatiang Posts: 11,087Member, Sous Chef, PRO, Senior Sous-Chef
    edited October 3

    Use the VectorToAngle( ) function to determine the path to the hero. You'll need to constrain game.heroX and game.heroY to the hero's x and y position and then use those within the function.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • quinn221quinn221 Posts: 280Member

    @tatiang said:
    Use the VectorToAngle( ) function to determine the path to the hero. You'll need to constrain game.heroX and game.heroY to the hero's x and y position and then use those within the function.

    I will give it a try!

Sign In or Register to comment.