gameplay prototype
This commit is contained in:
+5
-5
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import "core:fmt"
|
||||
import "ecs"
|
||||
import rl "vendor:raylib"
|
||||
|
||||
World :: struct {
|
||||
@@ -15,7 +14,6 @@ camera: rl.Camera2D
|
||||
CELL_SIZE :: 20
|
||||
|
||||
main :: proc() {
|
||||
ecs.ping()
|
||||
fmt.println("hello world")
|
||||
rl.InitWindow(800, 600, "grimm gameplay prototype")
|
||||
defer rl.CloseWindow()
|
||||
@@ -59,6 +57,7 @@ update :: proc() {
|
||||
move(&enemy.transform, 1, 0)
|
||||
}
|
||||
|
||||
run_timers()
|
||||
}
|
||||
|
||||
draw :: proc() {
|
||||
@@ -77,7 +76,6 @@ draw :: proc() {
|
||||
rl.BLUE,
|
||||
)
|
||||
|
||||
|
||||
for x in 0 ..< 26 {
|
||||
for y in 0 ..< 26 {
|
||||
rl.DrawRectangleLines(
|
||||
@@ -90,11 +88,13 @@ draw :: proc() {
|
||||
}
|
||||
}
|
||||
|
||||
if rl.IsMouseButtonDown(rl.MouseButton.LEFT) {
|
||||
if rl.IsMouseButtonPressed(rl.MouseButton.LEFT) {
|
||||
pos := rl.GetScreenToWorld2D(rl.GetMousePosition(), player.camera)
|
||||
pos_x := int(pos.x / CELL_SIZE) * CELL_SIZE
|
||||
pos_y := int(pos.y / CELL_SIZE) * CELL_SIZE
|
||||
shoot({f32(pos_x), f32(pos_y)}, player.transform)
|
||||
shoot(player.transform, {f32(pos_x), f32(pos_y)})
|
||||
}
|
||||
|
||||
run_particle_system()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user