Skip navigation
Jackylegssss
Currently Being Moderated

Rotating a barrel and shooting

Jun 8, 2012 9:49 AM

Tags: #cs4 #rotate #simple #actionscript_2.0 #shooter #shoot #aim

So I am currently in a grade 10 video game design class, and we are using Flash CS4 AS2. The game I am currently working on has the player rotate a turret, and shoot the soldiers heading towards the bottom of the screen. I have it so the turret rotates properly, but it still shoots out of the top of the turret, regrdless of where the barrel is aimed. I was told that there is code to change it, but I am quite new to Flash, and I have been unable to find help anywhere else. If anyone knows how to fix this issue, please respond.

 
Replies
  • Currently Being Moderated
    Jun 8, 2012 10:41 AM   in reply to Jackylegssss

    I can help you, but I need to see the project, you can upload to Dropbox, if you want to send the link by private message

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 8, 2012 10:54 AM   in reply to Jackylegssss

    Use:

     

    this._x += Math.cos(this._rotation*Math.PI/180);

    this._y += Math.sin(this._rotation*Math.PI/180);

     

    It makes 'this' move in the direction it is facing (may have to -90 from the rotation).

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points