diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-03-10 13:42:57 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-03-10 13:42:57 -0400 |
| commit | a6d48e46c122594aa5d877c9f902484339103ea9 (patch) | |
| tree | 9a4cb03af187f4f7742b8933a7c0069e17b4ddd1 /examples/game/player.tm | |
| parent | 839abfc29425873f5610467b8facac44ad784e19 (diff) | |
Fixes for examples
Diffstat (limited to 'examples/game/player.tm')
| -rw-r--r-- | examples/game/player.tm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/game/player.tm b/examples/game/player.tm index 91f7a173..a5c39a8d 100644 --- a/examples/game/player.tm +++ b/examples/game/player.tm @@ -19,11 +19,11 @@ struct Player(pos,prev_pos:Vec2): target_y := inline C:Num { (Num_t)((IsKeyDown(KEY_W) ? -1 : 0) + (IsKeyDown(KEY_S) ? 1 : 0)) } - target_vel := Vec2(target_x, target_y):norm() * WALK_SPEED + target_vel := Vec2(target_x, target_y):norm() * Player.WALK_SPEED vel := (p.pos - p.prev_pos)/World.DT - vel *= FRICTION - vel = vel:mix(target_vel, ACCEL) + vel *= Player.FRICTION + vel = vel:mix(target_vel, Player.ACCEL) p.prev_pos, p.pos = p.pos, p.pos + World.DT*vel |
