ForumsProgramming ForumFlight game like movement

3 6081
marviljoy
offline
marviljoy
1 posts
Nomad

Hello all,, I'm trying to create a gem like Flight, scrolling effect has been done, but the realistic flight movement still in trouble. Anybody please tell me how to drag and throw the paper plane and how the movement has been done. I'm confused with the physics in it. I think my physics logic is not good. Please Help me to solve this.

  • 3 Replies
PixelSmash
offline
PixelSmash
566 posts
Nomad

I think most if not all of those games are done with some sort of physics engine like box2D. If you want to code it yourself, for any number of reasons (unfamiliar with box2d, most functionality isn't needed, etc) you could try something like [url=http://circlecube.com/2007/03/gravity/]this/url]. It's in AS2, and I don't know if you use AS2 or AS3, but converting the code to AS3 shouldn't be too much of a hassle

Good luck!

master565
offline
master565
4,104 posts
Nomad

link fixed

What Krin did for flight probably was just a trick to make it look like your throwing it, if this wasn't true than you would be able to throw it the fastest possible without leveling up. So i think you should just have it check how fast you move from one point to another and than slow it down according to how much its leveled up. (you can also think of an original takeoff method that hasn't been done before because originality is what i love in games and what made flight so good)

OneWizard
offline
OneWizard
5 posts
Nomad

When I make simple physics engine, I always make two variables for things that move:

xVel - the x-Velocity of the object
yVel - the y-Velocity of the object
(Alternatively, you can import flash.geom.Point, and name it "velocity&quot

These can be added to the x and y properties of any MovieClip each frame for an easy, effective movement system. To add gravity, add 1, or 2 to yVel each frame.

You can use a simple MOUSE_DOWN listener to find when the plane has been clicked, and MOUSE_UP for the release. The tricky part is finding the actual velocity of the plane.

I would make a second pair of integers for the previous mouse position. That way, in each frame, you have the current mouse position (mouseX, mouseY), and the previous frame's mouse position. All you would have to do then is set the plane's xVel to (mouseX-preMouseX), and its yVel to (mouseY-preMouseY), and unlock it from the mouse to send it flying through your scrolling landscape!

Also, master565 mentioned a speed issue which can be eliminated easily enough if you want me to explain that.

Showing 1-3 of 3