gameplay prototype
This commit is contained in:
+14
-8
@@ -1,5 +1,6 @@
|
||||
package main
|
||||
|
||||
import "core:fmt"
|
||||
import rl "vendor:raylib"
|
||||
|
||||
move :: proc(t: ^Transform, x, y: f32) {
|
||||
@@ -13,16 +14,21 @@ move :: proc(t: ^Transform, x, y: f32) {
|
||||
}
|
||||
}
|
||||
|
||||
shoot :: proc(pos: rl.Vector2, t: Transform) {
|
||||
shoot :: proc(t: Transform, pos: rl.Vector2) {
|
||||
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,
|
||||
)
|
||||
line_particle := LineParticle {
|
||||
pos1 = t.position * CELL_SIZE + 10,
|
||||
pos2 = pos + 10,
|
||||
tint = rl.WHITE,
|
||||
lifetime = 0.2,
|
||||
}
|
||||
spawn_particle(line_particle)
|
||||
start_timer(1, test_timer_callback)
|
||||
}
|
||||
|
||||
test_timer_callback :: proc() {
|
||||
fmt.println("timer finished")
|
||||
}
|
||||
|
||||
center_to_grid :: proc(pos: rl.Vector2) -> rl.Vector2 {
|
||||
|
||||
Reference in New Issue
Block a user