initial commit

This commit is contained in:
harper
2026-09-22 15:40:36 -07:00
commit 480501a6b6
7 changed files with 254 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
package main
import rl "vendor:raylib"
move :: proc(t: ^Transform, x, y: f32) {
next_position := Transform {
position = {t.position.x + x, t.position.y + y},
}
if e, occupied := world.entities[next_position.position]; !occupied {
delete_key(&world.entities, t.position)
defer world.entities[t.position] = e
t.position = next_position.position
}
}
shoot :: proc(pos: rl.Vector2, t: Transform) {
pos_centered := center_to_grid(pos)
t_centered := center_to_grid(t.position)
rl.DrawLine(
i32(t.position.x) * CELL_SIZE + (CELL_SIZE / 2),
i32(t.position.y) * CELL_SIZE + (CELL_SIZE / 2),
i32(pos_centered.x),
i32(pos_centered.y),
rl.WHITE,
)
}
center_to_grid :: proc(pos: rl.Vector2) -> rl.Vector2 {
pos_x, pos_y: f32
pos_x = pos.x + CELL_SIZE / 2
pos_y = pos.y + CELL_SIZE / 2
return rl.Vector2{pos_x, pos_y}
}