I need some help with this

mdk5316mdk5316 Member Posts: 26
edited November -1 in Working with GS (Mac)
I have a simple circle that has a barrel on it. I need to know how to get the barrel to move back and forth around the circle. And when i click the button, i need to know how to fire a projectile in the direction of the barrel's angle. If anyone can help, it would be appreciated greatly

Comments

  • ozboybrianozboybrian PRO Posts: 2,102
    It would have something to do with.

    When Key up is touched move to self.position y + 10. Along those lines.

    Might wanna look at the cannon template in GameSalad, see how that's done.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Go check out CodeMonkeys Example Rotations. Its basically what you are looking for.
  • mdk5316mdk5316 Member Posts: 26
    Do you have a link to that example?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    No sorry. Codemonkey has posts in the stickies Just click on his username and look through all of his stuff he's actually got a lot of good stuff there.
  • mattyr64mattyr64 Member Posts: 82
    you can use Rotate to Position > set position co-ords to game.Touches.Touch1.X and game.Touches.Touch1.Y

    That will cause the object to rotate around to the spot you touch.

    to fire an object you could...

    Spawn actor > bullet on touch release. ensure that angle is set to relative to actor in the spawn rule
    (you can also offest X and Y pos of the spawn to make it come from the end of the barrel)

    just make sure that your bullet actor has a Move/Acclerate rule setup on it so it has a speed.
  • mdk5316mdk5316 Member Posts: 26
    Well ultimately what i want to accomplish is to have the barrel in constant motion, rotating from 45 to -45 degrees. Then when i fire, it needs to in the direction of the barrel. Here's a good example i found that is basically what i envision.

Sign In or Register to comment.