diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-08 20:26:33 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-08 20:26:33 -0400 |
| commit | ba3413a9c91dca356db47e0e8db91216c4e3906b (patch) | |
| tree | 88a32e1be450b1dc8d7ed3398adde870d132bb50 | |
| parent | f33b7048d7f1255a4f9c04057340f2c71d6fb982 (diff) | |
Center player
| -rw-r--r-- | examples/game/player.tm | 2 | ||||
| -rw-r--r-- | examples/game/world.tm | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/examples/game/player.tm b/examples/game/player.tm index 3461c6ae..dff95b9d 100644 --- a/examples/game/player.tm +++ b/examples/game/player.tm @@ -27,5 +27,5 @@ struct Player(pos,prev_pos:Vec2): p.prev_pos, p.pos = p.pos, p.pos + World.DT*vel - func draw(p:&Player): + func draw(p:Player): Color.PLAYER:draw_rectangle(p.pos, Player.SIZE) diff --git a/examples/game/world.tm b/examples/game/world.tm index d921841b..6208d1c5 100644 --- a/examples/game/world.tm +++ b/examples/game/world.tm @@ -84,6 +84,7 @@ struct World(player:@Player, goal:@Box, boxes:[@Box], dt_accum=0.0, won=no): (&w.boxes):insert(box) else if cell == "@": pos := Vec2((Num(x)-1) * box_size.x, (Num(y)-1) * box_size.y) + pos += box_size/2. - Player.SIZE/2. w.player = @Player(pos,pos) else if cell == "?": pos := Vec2((Num(x)-1) * box_size.x, (Num(y)-1) * box_size.y) |
