34 lines
785 B
Odin
34 lines
785 B
Odin
package game
|
|
|
|
import "core:fmt"
|
|
import rl "vendor:raylib"
|
|
|
|
render_world :: proc(world: ^World) {
|
|
for y in 0 ..< MAP_H {
|
|
for x in 0 ..< MAP_W {
|
|
c := tile_color(world.world_map.tiles[y][x])
|
|
rl.DrawRectangle(i32(x * TILE_SIZE), i32(y * TILE_SIZE), TILE_SIZE, TILE_SIZE, c)
|
|
}
|
|
}
|
|
|
|
for p in world.path {
|
|
rl.DrawCircle(i32(p.x), i32(p.y), 3, rl.GOLD)
|
|
}
|
|
|
|
if world.enemy.active {
|
|
e := world.enemy
|
|
rl.DrawCircle(i32(e.position.x), i32(e.position.y), 11, rl.MAROON)
|
|
rl.DrawText(
|
|
fmt.ctprintf("%d", e.health),
|
|
i32(e.position.x) - 4,
|
|
i32(e.position.y) - 18,
|
|
12,
|
|
rl.WHITE,
|
|
)
|
|
|
|
}
|
|
rl.DrawText(fmt.ctprintf("Gold: %d", world.gold), 10, 10, 20, rl.BLACK) // Gold HUD
|
|
rl.DrawText(fmt.ctprintf("Base HP: %d", world.base_health), 10, 32, 20, rl.BLACK) // HP HUD
|
|
}
|
|
|