diff options
| author | ne_mene <[email protected]> | 2026-03-12 17:36:06 +0100 |
|---|---|---|
| committer | ne_mene <[email protected]> | 2026-03-12 17:36:06 +0100 |
| commit | bedfad9ae704c9f6a72d71f37dd090170da3a908 (patch) | |
| tree | 95ff5d5b26a8f0171c1a76afe63192f6439b1db6 /src/objs/player.lua | |
| parent | 6fc7035db506b648ab27f21cd4ccbe2e874e3750 (diff) | |
tiles.
Diffstat (limited to 'src/objs/player.lua')
| -rw-r--r-- | src/objs/player.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/objs/player.lua b/src/objs/player.lua index 74d28e8..4f078f0 100644 --- a/src/objs/player.lua +++ b/src/objs/player.lua @@ -19,6 +19,23 @@ function player_movement_sys(player, dt) inpx, inpy = normalize(inpx, inpy) player.vx = dlerp(player.vx, inpx * PLAYER_SPEED, 25 * dt) player.vy = dlerp(player.vy, inpy * PLAYER_SPEED, 25 * dt) + + if is_input_pressed("Right_Click") then + local scn = get_current_scene() + assert(scn, "no scene set.") + + local mx, my = get_mouse_pos() + local tx, ty = to_tile_coords(mx, my) + set_tile(scn.tilemap, tx, ty, 1) + end + if is_input_pressed("Left_Click") then + local scn = get_current_scene() + assert(scn, "no scene set.") + + local mx, my = get_mouse_pos() + local tx, ty = to_tile_coords(mx, my) + remove_tile(scn.tilemap, tx, ty) + end end function new_player(x, y) @@ -32,3 +49,4 @@ function new_player(x, y) add_comp(ent, "Player") add_comp(ent, "Sprite", "res/img/player.ase") end + |
