From df70a616f58aa51ff6375a824fc18cbbc369e43b Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 22 Dec 2018 13:45:32 +0800 Subject: +statemachine --- bin/SDL2.dll | Bin 771072 -> 1279488 bytes bin/cembed.exe | Bin 11264 -> 44032 bytes bin/game/main.lua | 11 +++++++++++ bin/jin.exe | Bin 535040 -> 2001920 bytes bin/lua51.dll | Bin 364544 -> 364544 bytes 5 files changed, 11 insertions(+) (limited to 'bin') diff --git a/bin/SDL2.dll b/bin/SDL2.dll index 7bf27d3..dc5633e 100644 Binary files a/bin/SDL2.dll and b/bin/SDL2.dll differ diff --git a/bin/cembed.exe b/bin/cembed.exe index dc508b6..bace0b5 100644 Binary files a/bin/cembed.exe and b/bin/cembed.exe differ 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) diff --git a/bin/jin.exe b/bin/jin.exe index 5c383b3..965b2a7 100644 Binary files a/bin/jin.exe and b/bin/jin.exe differ diff --git a/bin/lua51.dll b/bin/lua51.dll index 628e184..e427e83 100644 Binary files a/bin/lua51.dll and b/bin/lua51.dll differ -- cgit v1.1-26-g67d0