Making the jump really really work

This commit is contained in:
AnonymusRaccoon
2020-01-03 13:48:30 +01:00
parent 5c2e400d2d
commit 6d4d599a34
5 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
</renderer>
<movable_component />
<controllable_component />
<gravity_component speed="500" />
<gravity_component speed="800" />
<keyboard_controller left="16" right="3" jump="57" />
<walk_action acceleration="3000" max_acceleration="10000" />
<jump_action acceleration="2400" max_acceleration="3800"/>
+3 -1
View File
@@ -29,8 +29,10 @@ gc_entity *entity, float dtime)
else
mov->acceleration.y = -grav->gravity_speed;
}
if (mov->acceleration.y < 0 && col->distance_down == 0)
if (mov->acceleration.y < 0 && col->distance_down == 0) {
mov->acceleration.y = 0;
mov->velocity.y = 0;
}
(void)system;
(void)dtime;
(void)engine;
-2
View File
@@ -25,8 +25,6 @@ gc_entity *entity, float dtime)
struct movable_component *mov = GETCMP(movable_component);
struct jump_action *jump = GETCMP(jump_action);
if (con->jumping)
printf("Acceleartion: %4.0f, Velocity: %4.0f Distance down: %d\n", mov->acceleration.y, mov->velocity.y, col->distance_down);
if (col->distance_down == 0 && mov->acceleration.y < jump->max_acceleration)
mov->acceleration.y += con->jumping * jump->acceleration;
(void)system;