How to have a tank shoot a bullet?

ChunkyMonkey

  • Posts: 430
    Hello,
   
    I'm working on a game where a tank always points in the direction of the mouse, and when the mouse is pressed a bullet actor is created supposed to fly straight out of the barrel of the tank, so I thought of this:

Create bullet at x: center of tank y:center of tank

And this for the bullet:

Point in direction of tank.
Set velocity to 30 dir: direction of tank.

This only works when the tank is facing straight up and down and I can't think of a consistent behavior. Would someone please help?

rob1221

  • *
  • Posts: 9473
There's a preshipped behavior called "Fire Bullet" which should work.

ChunkyMonkey

  • Posts: 430
Thank you, how do I get to the pre-shipped behaviors?

Joe

  • *
  • Posts: 2478
Open the Actor Type or Scene to which you want to attach a Behavior. When you select a Behavior to add, the pre-shipped ones will be available for selection.

ChunkyMonkey

  • Posts: 430
Thank you, I just started reading this when you'd replied: http://www.stencyl.com/help/view/pre-shipped-behaviors/