mirror of
https://github.com/zoriya/Twac.git
synced 2026-06-01 10:05:09 +00:00
Making the jump really really work
This commit is contained in:
+1
-1
Submodule lib/gamacon updated: 20ffadd223...94dbd5eb0e
+1
-1
Submodule lib/quadtree updated: c9f363aed9...b23039ac96
@@ -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"/>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user