From 3ea9d25f9eb240b57e40434abade106add157a8d Mon Sep 17 00:00:00 2001 From: KonAki Date: Sun, 11 Oct 2026 17:04:38 +0800 Subject: world: jumpSpeed per body, 0 turns jumping off --- kon/konworld.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'kon/konworld.h') diff --git a/kon/konworld.h b/kon/konworld.h index 4be1d1c..bce5187 100644 --- a/kon/konworld.h +++ b/kon/konworld.h @@ -85,6 +85,7 @@ typedef struct kon_body { kon_vec3_t position; float radius, height; /* 0.2 and 1.0 are fine for a person in this scale */ float vy; /* up speed, only jumps and falls change it */ + float jumpSpeed; /* how fast a jump starts, 6 is about a metre. 0 turns jumping off for this body, like in a doom-style game */ int onGround; int sector; /* the room it is in, -1 if none, kept up to date by kon_worldMove */ int touching; /* the collider it was pushed by in the last move, -1 if none. a monster hitting a door, say */ @@ -109,7 +110,8 @@ float kon_worldGround(const kon_world_t *world, float x, float z, float feet, in /*** bodies ***/ void kon_bodyInit(kon_body_t *body, float x, float y, float z, float radius, float height); -void kon_bodyJump(kon_body_t *body, float speed); +/* does nothing in the air or when jumpSpeed is 0. returns 1 if it jumped */ +int kon_bodyJump(kon_body_t *body); /* puts the feet on the ground under them right away */ void kon_worldPlace(const kon_world_t *world, kon_body_t *body); -- cgit