This commit is contained in:
Chris Bell 2025-02-27 13:51:11 -06:00
parent cddba06c25
commit f9ea78d62e
4 changed files with 9 additions and 22 deletions

File diff suppressed because one or more lines are too long

BIN
game/game

Binary file not shown.

View File

@ -20,8 +20,9 @@ main :: proc() {
rl.SetTargetFPS(60)
player = {
position = {CELL_SIZE * 5, CELL_SIZE * 5},
position = {CELL_SIZE * 500, CELL_SIZE * 500},
camera = {
zoom = 2,
target = {player.position.x + (CELL_SIZE / 2), player.position.y + (CELL_SIZE / 2)},
@ -35,6 +36,9 @@ main :: proc() {
world = create_world("test_world")
load_nearby_chunks(&world, player.position)
set_tile(&world, tree_tile, {400,400})
save_world(&world)

View File

@ -7,7 +7,7 @@ import "core:path/filepath"
import "core:mem"
CELL_SIZE :: 16
CHUNK_SIZE :: 5
CHUNK_SIZE :: 32
WORLD_DATA_PATH :: "data/worlds"
World :: struct {
@ -111,22 +111,6 @@ load_chunk :: proc(pos:Vec2i, w:^World) -> Chunk {
mem.copy(transmute([^]u8)&chunk.position.y, &data[offset], size_of(int))
offset += size_of(int)
// // Load Tiles
// for row in &chunk.tiles {
// for &tile in row {
// mem.copy(transmute([^]u8)tile.tilemap_pos.x, &data[offset], size_of(int))
// offset += size_of(int)
// mem.copy(transmute([^]u8)tile.tilemap_pos.y, &data[offset], size_of(int))
// offset += size_of(int)
// //Color
// tile.color = {}
//
// }
// }
// Load tiles
for row_index := 0; row_index < len(chunk.tiles); row_index += 1 {
for tile_index := 0; tile_index < len(chunk.tiles[row_index]); tile_index += 1 {
@ -169,11 +153,11 @@ generate_chunk :: proc(pos:Vec2i) -> Chunk {
for x in 0..<CHUNK_SIZE {
for y in 0..<CHUNK_SIZE {
chunk.tiles[x][y] = Tile {
type = .FOLIAGE,
tilemap_pos = {0,2},
type = .NOTHING,
tilemap_pos = {0,0},
interaction = .NOTHING,
resource = .NOTHING,
color = {0,255,0,255}
color = {0,0,0,255}
}
}
}