aboutsummaryrefslogtreecommitdiff
path: root/examples/game/player.tm
diff options
context:
space:
mode:
Diffstat (limited to 'examples/game/player.tm')
-rw-r--r--examples/game/player.tm8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/game/player.tm b/examples/game/player.tm
index 2e5e54f6..b34eadd0 100644
--- a/examples/game/player.tm
+++ b/examples/game/player.tm
@@ -10,12 +10,12 @@ struct Player(pos,prev_pos:Vector2)
COLOR := Color(0x60, 0x60, 0xbF)
func update(p:@Player)
- target_x := C_code:Num32(
+ target_x := C_code:Num32`
(Num32_t)((IsKeyDown(KEY_A) ? -1 : 0) + (IsKeyDown(KEY_D) ? 1 : 0))
- )
- target_y := C_code:Num32(
+ `
+ target_y := C_code:Num32`
(Num32_t)((IsKeyDown(KEY_W) ? -1 : 0) + (IsKeyDown(KEY_S) ? 1 : 0))
- )
+ `
target_vel := Vector2(target_x, target_y).norm() * Player.WALK_SPEED
vel := (p.pos - p.prev_pos)/World.DT