Collision detection, better camera stuff, random trees, etc

This commit is contained in:
2025-02-25 23:26:32 -06:00
parent 88a795264c
commit 3914d6c1a7
6 changed files with 99 additions and 25 deletions

View File

@@ -24,10 +24,19 @@ TileType :: enum {
FLOOR,
}
set_grid_tile :: proc(w:^World, pos:Vec2i, t:Tile) {
w.grid[pos.x][pos.y] = t
}
get_grid_tile :: proc(w: ^World, pos: Vec2i) -> Tile {
if pos.x < 0 || pos.x >= len(w.grid) || pos.y < 0 || pos.y >= len(w.grid[0]) {
// fmt.printfln("Target [%v] outside of world bounds", pos)
return w.grid[0][0] // Default or error tile
}
return w.grid[pos.x][pos.y]
}
fill_world_grid_with_nothing :: proc(w:^World) {
for x in 0..< len(w.grid) {
for y in 0..<len(w.grid) {