From aaf04c9e1af7dc00d1b0aba7332c3749de6515d0 Mon Sep 17 00:00:00 2001 From: chris bell Date: Sun, 15 Feb 2026 19:08:58 -0600 Subject: [PATCH] More tilemap stuff --- src/main.odin | 4 +++- src/tile.odin | 4 ++++ src/tilemap.odin | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.odin b/src/main.odin index 3c0e66e..cfc3bef 100644 --- a/src/main.odin +++ b/src/main.odin @@ -30,7 +30,7 @@ main :: proc() { sprite = load_sprite(PLAYER_SPRITE_PATH, PLAYER_WIDTH, PLAYER_HEIGHT), } - player.state = .WALKING + set_tile(grid, 10, 10, nothing_tile) for (!raylib.WindowShouldClose()) { @@ -42,9 +42,11 @@ main :: proc() { raylib.DrawText("Ur mom", 100, 100, 50, raylib.BLACK) + draw() raylib.EndMode2D() + raylib.DrawFPS(20, 20) raylib.EndDrawing() update(delta) diff --git a/src/tile.odin b/src/tile.odin index b0c2e8b..dc73e9c 100644 --- a/src/tile.odin +++ b/src/tile.odin @@ -88,3 +88,7 @@ update_tile_anim :: proc(tile: ^Tile, delta: f32) { tile.frame_index = tile.animator.current_frame } +set_tile :: proc(grid: [][]Tile, x: int, y: int, tile: Tile) { + grid[x][y] = tile +} + diff --git a/src/tilemap.odin b/src/tilemap.odin index f165d6c..563bf8e 100644 --- a/src/tilemap.odin +++ b/src/tilemap.odin @@ -48,6 +48,7 @@ draw_tile_grid :: proc(sheet: ^TilemapSpritesheet, grid: [][]Tile) { row := grid[y] for x := 0; x < len(row); x += 1 { tile := &row[x] + if (tile.type == TileType.NOTHING) do continue pos := raylib.Vector2{f32(x * int(sheet.tile_width)), f32(y * int(sheet.tile_height))} draw_tile(sheet, tile, pos, raylib.Color{255, 136, 0, 255}) }