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 Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited October 2017

    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 Member Posts: 280

    @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.