clean up spawn test command
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package game
|
||||
|
||||
import rl "vendor:raylib"
|
||||
|
||||
Command_Kind :: enum {
|
||||
None,
|
||||
Place_Tower,
|
||||
Spawn_Test,
|
||||
}
|
||||
|
||||
Command :: struct {
|
||||
@@ -19,12 +21,18 @@ gather_commands :: proc(world: ^World) -> Command {
|
||||
return Command{kind = .Place_Tower, gx = gx, gy = gy}
|
||||
}
|
||||
|
||||
if rl.IsKeyPressed(.SPACE) {
|
||||
return Command{kind = .Spawn_Test}
|
||||
}
|
||||
|
||||
return Command{kind = .None}
|
||||
}
|
||||
|
||||
execute_command :: proc(world: ^World, cmd: Command) {
|
||||
switch cmd.kind {
|
||||
case .None:
|
||||
case .Spawn_Test:
|
||||
spawn_group(world, 3)
|
||||
case .Place_Tower:
|
||||
try_place_tower(world, cmd.gx, cmd.gy)
|
||||
}
|
||||
|
||||
@@ -26,10 +26,6 @@ update_world :: proc(world: ^World, dt: f32) {
|
||||
cmd := gather_commands(world)
|
||||
execute_command(world, cmd)
|
||||
|
||||
if rl.IsKeyPressed(.SPACE) {
|
||||
spawn_group(world, 3)
|
||||
}
|
||||
|
||||
update_enemies(world, dt)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user