up to building the map
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package game
|
||||
|
||||
import "core:fmt"
|
||||
import rl "vendor:raylib"
|
||||
World :: struct {
|
||||
gold: int,
|
||||
base_health: int,
|
||||
}
|
||||
|
||||
init_world :: proc() -> World {
|
||||
return World{gold = 10, base_health = 20}
|
||||
}
|
||||
|
||||
// update world, never draw
|
||||
update_world :: proc(world: ^World, dt: f32) {
|
||||
_ = dt
|
||||
|
||||
if rl.IsKeyPressed(.G) {
|
||||
world.gold += 10
|
||||
}
|
||||
}
|
||||
|
||||
render_world :: proc(world: ^World) {
|
||||
rl.DrawText(fmt.caprintf("gold: %d", world.gold), 10, 10, 22, rl.BLACK)
|
||||
rl.DrawText(fmt.caprintf("health: %d", world.base_health), 10, 38, 22, rl.BLACK)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user