aboutsummaryrefslogtreecommitdiff
path: root/bin/game/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'bin/game/main.lua')
-rw-r--r--bin/game/main.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/game/main.lua b/bin/game/main.lua
index 62086da..d521fc2 100644
--- a/bin/game/main.lua
+++ b/bin/game/main.lua
@@ -73,6 +73,17 @@ function jin.core.onLoad()
jin.graphics.pushMatrix()
jin.graphics.translate(0, 0)
--jin.graphics.rotate(0.2)
+
+ local fsm = jin.ai.newStateMachine({
+ events = {
+ { name = 'startup', from = 'none', to = 'green' },
+ { name = 'panic', from = 'green', to = 'red' },
+ { name = 'calm', from = 'red', to = 'green' },
+ }})
+ print(fsm.current) -- "none"
+ fsm:startup()
+ print(fsm.current) -- "green"
+
end
function jin.core.onEvent(e)