commit 2955b2015a96d34d2d51760cf9843628dda3e984 parent 75be039a6f19073dc1413907e69a828bcfbc247d Author: Matsuda Kenji <info@mtkn.jp> Date: Sat, 17 Dec 2022 18:48:09 +0900 delete gravity Diffstat:
M | main.c | | | 17 | +++++++---------- |
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/main.c b/main.c @@ -250,12 +250,10 @@ square_handle_inputs(void) square.vx = 300; if (key_state[Key_A] == Key_Down) square.vx = -300; -// if (key_state[Key_D] == Key_Up && key_state[Key_A] == Key_Up) -// square.vx = 0; - if (key_state[Key_Space] == Key_Down && win_height <= square.py + square.height){ - square.vy = -1000; - } - square.ax = -square.vx * 0.5; + if (key_state[Key_S] == Key_Down) + square.vy = 300; + if (key_state[Key_W] == Key_Down) + square.vy = -300; } void @@ -270,23 +268,22 @@ square_handle_collision(void) square.vx *= -0.7; } - square.ay = 980; if (square.py <= 0){ square.py = 0; - square.vy *= -0.5; + square.vy *= -0.7; } if (win_height <= square.py + square.height){ square.py = win_height - square.height; - square.vy *= -0.5; + square.vy *= -0.7; } } void next_tick(float dt) { - square_handle_inputs(); obj_next_tick(&square, dt); square_handle_collision(); + square_handle_inputs(); } void