odin-raylib-game/game/tiles.odin

122 lines
2.4 KiB
Odin

package game
import rl "vendor:raylib"
import "core:math/rand"
Tile :: struct #packed {
tilemap_pos: Vec2i,
color: [4]u8,
type: TileType,
interaction: InteractionType,
resource: ResourceType,
}
TileType :: enum u8 {
NOTHING,
SOLID,
FOLIAGE,
WATER,
}
ResourceType :: enum u8 {
NOTHING,
TREE,
BONE,
}
InteractionType :: enum u8 {
NOTHING,
RESOURCE,
ENEMY,
}
// Premade Tiles
nothing_tile := Tile { // The most common tile, makes up the majority of the world.
type = .NOTHING,
tilemap_pos = {0,0},
color = {0,0,0,255},
interaction = .NOTHING,
resource = .NOTHING
}
grass_tile := Tile { // Common fauna, more dense in grasslands
type = .FOLIAGE,
tilemap_pos = {5,0},
color = {50,120,25,255},
interaction = .NOTHING,
resource = .NOTHING
}
tree_tile := Tile { // Common grassland fauna, dense population in forests
type = .SOLID,
tilemap_pos = {0,1},
color = {10,60,15,255},
resource = .TREE,
interaction = .RESOURCE,
}
double_tree_tile := Tile { // Only found in forests, densly packed
type = .SOLID,
tilemap_pos = {3,2},
color = {10,60,15,255},
resource = .TREE,
interaction = .RESOURCE,
}
bricks_tile := Tile { // Unused, for now
type = .SOLID,
tilemap_pos = {10,17},
color = {140,30,10,255},
resource = .NOTHING,
interaction = .NOTHING,
}
water_tile := Tile { // Only seen in bodies of water
type = .WATER,
tilemap_pos = {19,1},
color = {5,10,70,255},
resource = .NOTHING,
interaction = .NOTHING,
}
shallow_water_tile := Tile { // Only seen in bodies of water
type = .WATER,
tilemap_pos = {19,1},
color = {5,40,80,255},
resource = .NOTHING,
interaction = .NOTHING,
}
cactus_tile := Tile { // Common desert fauna
type = .SOLID,
tilemap_pos = {6,1},
color = {5,40,0,255},
resource = .NOTHING,
interaction = .NOTHING,
}
double_cactus_tile := Tile { // Sparse desert fauna
type = .SOLID,
tilemap_pos = {7,1},
color = {5,40,0,255},
resource = .NOTHING,
interaction = .NOTHING,
}
cow_skull_tile := Tile { // Rare chance of spawning in a desert
type = .SOLID,
tilemap_pos = {1,15},
color = {200,200,200,255},
resource = .BONE,
interaction = .RESOURCE,
}
dead_bush_tile := Tile { // Common desert fauna
type = .FOLIAGE,
tilemap_pos = {6,2},
color = {145,100,30,255},
interaction = .NOTHING,
resource = .NOTHING
}