#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Code for spinning a character and it's properties?


    So I'm designing a game for my flash class final, and I want to have my character spin based on mouse movements. So if I move the mouse to the left, character spins counterclockwise, to the right, clockwise. But I also need to have things spin with the character, like the gun he's holding. And if the gun shoots projectiles, how would I keep the direction of the projectiles constant with the character's direction? Also, I'm using wasd for walking, then the mouse for directional control, so how do I make it so W doesn't make the character go down in Y value, but it makes the character travel at a velocity in whatever direction it's facing (so if the character is facing like northeast, pressing W will make him walk northeast. Then pressing A facing the same direction would make him strafe northwest)?

    Thanks!!!
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    21
    Rep Power
    0
    It sounds to me like you would have the mouse movements control the .rotation of the character. The .rotation of the character would also be crucial in determining the movement of the character and the direction of the projectile when fired. Simple enough.

IMN logo majestic logo threadwatch logo seochat tools logo