2 Replies Latest reply on Jul 22, 2008 12:02 AM by rbr1234

    Planet Gravity Help

      I am making a game where a character is on a planet (circle) and I want him to be able to walk around the border of the planet.
      Kind of like "Super Mario Galaxy" for the Wii but in 2D.
      Ive already made my character able to walk and jump using the arrow keys.
      But I dont know how to make it so the gravity is in the center of the planet.
      I also want my character to rotate while he walks so his feet are always touching the planet.

      If my question is not very clear please tell me and I will try to make it make more sense :)

      Thank you for your time,

      P.S. I have been trying to figure this out for a couple hours now. Ive looks for tutorials all over the web but I cant find anything that is any good. This forum is my last chance at making my game. So I am truly thankful for your help.
        • 1. Planet Gravity Help
          Noelbaland Level 1

          So say your left arrow key plays the animation that makes your character walk foward and the right arrow key makes him walk back? Why not control the rotation property of your planet movieclip with the left/right arrow buttons also. The character movieclip doesn't move at all - only the walk animation and the planet rotating.
          If I had to do something like that I would code up something like the script below.
          Bare in mind the code assumes the following

          1) That the character movieclip is a self-contained movie with frame names walkFoward, walkBackward, jumpSequence that contain animations on it's stage that show those actions.
          2) The planet movieclip has it's registration point in the center.
          3) That only the LEFT, RIGHT, and SPACE keys are used to control the animation.
          4) That the character mc is positioned right along the edge of the planet mc so as to sell the effect of the character walking along the planet surface.

          • 2. Planet Gravity Help
            rbr1234 Level 1
            You just made my day Noelbaland.
            I am going to try the code out now and I will see how it works.

            Thank you soooo much!!!!

            EDIT: HOOOOOOOOOOOOOOOORAYYYYY it worked :-)