This method of flying is making use of the oscillation between dvy values instead of the normal dvy: 550 -For type three objects, they are not subject to any "gravitational force", so they can "float" by just using the same set of values in dvy with a normal integers and a -ve sign. -However, type 0 have a preset gravitational force of dvy 1.7 acting on it. -Since decimals are not valid in dvy: , we will use wait to correct the problem type: 0's gravitational force Instead of dvy: 550 you use severl dvy which complete each other and let the character fly in the sky. Type0 objects have a present gravitational force of 1.7 pixel. Because decimals are not allowed in dvy we have to use wait to correct the problem:
dvy: ........ Gravitational forceThat's why:
-5 .......... -3.3
-4 .......... -2.3
-3 .......... -1.3
-2 .......... -0.3
-1 .......... 0.7
0 .......... 1.7
1 .......... 2.7
-----------------------------------------------------
dvy: .......... Time (TU) ........ Gravity x Time
-1 ............. 3 .............. 0.7 x 3 = 2.1
-2 ............. 7 .............. -0.3 x 7 = -2.1
-----------------------------------------------------
1 ............. 1 .............. 2.7 x 1 = 2.7
-2 ............. 9 .............. -0.3 x 9 = -2.7
-----------------------------------------------------
0 ............. 3 .............. 1.7 x 3 = 5.1
-2 ............ 17 .............. -0.3 x 17 = -5.1
-----------------------------------------------------
0 ............. 1 .............. 1.7 x 1 = 1.7
-1 ............. 1 .............. 0.7 x 1 = 0.7
-2 ............. 8 .............. -0.3 x 8 = -2.4
-----------------------------------------------------
You just need two products from gravity and time which are zero if you add them up, and with these numbers you can create a nice hover-effect then. ^_^
Here's a study example:
Flying |
Inspired by Windmill