~Bump
So I was coding a training dummy for a game I am working on (One Piece A-Edition), and I thought I need to have it move for testing purposes :P. This whole flying thing is literally one frame making use of the engine's rotation, registers and holding inputs! (you hold forward or back to control your flying direction, and up and down to move in the z-axis)
$a$ registers the angle, and it increases or decreases when either Back or Forward are held. The angle is used in the set_transformation[] frame component to rotate the sprite, and in the x_vel and y_vel tags as a parameter of sin and cos to divide the total flying speed (which is 14) into an x-component and the y-component which causes the dummy to fly in the angle's direction. The |IGNOREGRAVITY| switch makes our object not affected by gravity, and the other 2 switches just remove the redundant bars since it's a training dummy.
So I was coding a training dummy for a game I am working on (One Piece A-Edition), and I thought I need to have it move for testing purposes :P. This whole flying thing is literally one frame making use of the engine's rotation, registers and holding inputs! (you hold forward or back to control your flying direction, and up and down to move in the z-axis)
Code:
[f=20] #FLY!
|IGNOREGRAVITY|NOSPBAR|NORPBAR|
img=0 delay=2 center=49,99 hit_ground=10 y_vel=-14*&cos{$a$} x_vel=-&sin{$a$}*14 z_vel=0 goto=2 z_hold_vel=2
set_transformation[center=49, 58 rotation_angle=$a$]
set_combination[sequence=(h<b>) goto=20 set_reg=$a$, 3+$a$]
set_combination[sequence=(h<f>) goto=20 set_reg=$a$,-(3-$a$) ]
set_combination[sequence=(h<j>) goto=20 ]
[/f]$a$ registers the angle, and it increases or decreases when either Back or Forward are held. The angle is used in the set_transformation[] frame component to rotate the sprite, and in the x_vel and y_vel tags as a parameter of sin and cos to divide the total flying speed (which is 14) into an x-component and the y-component which causes the dummy to fly in the angle's direction. The |IGNOREGRAVITY| switch makes our object not affected by gravity, and the other 2 switches just remove the redundant bars since it's a training dummy.
![[Image: signature.png]](http://s3.postimg.org/wedqxlk3n/signature.png)
A-Engine: A new beat em up game engine inspired by LF2. Coming soon
A-Engine Dev Blog - Update #8: Timeout

Chat
