From 93ab1611f507fbc415892c07833b23a9096303a3 Mon Sep 17 00:00:00 2001 From: CFiggers Date: Thu, 4 Apr 2024 22:49:53 -0500 Subject: [PATCH] Update 04-gamestates.janet Fix broken example of gamestates Running as-is gives this error: ```console $ janet examples/04-gamestates.janet menu init menu enter () menu game state dt: 0 switching to game game init game game state dt: 1 Lets go back to the menu error: unknown method :back-to-menu invoked on in _thunk [examples/04-gamestates.janet] (tailcall) on line 33, column 1 ``` With proposed change this example no longer errors out: ```console $ janet examples/04-gamestates.janet menu init menu enter () menu game state dt: 0 switching to game game init game game state dt: 1 Lets go back to the menu game leave menu enter () menu game state dt: 2 ``` --- examples/04-gamestates.janet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/04-gamestates.janet b/examples/04-gamestates.janet index 962641e..323c68f 100644 --- a/examples/04-gamestates.janet +++ b/examples/04-gamestates.janet @@ -18,7 +18,7 @@ (:add-state *GS* menu) (:add-state *GS* game) (:add-edge *GS* (gamestate/transition :start-game :menu :game)) -(:add-edge *GS* (gamestate/transition :back-to-menu :menu :game)) +(:add-edge *GS* (gamestate/transition :back-to-menu :game :menu)) (:goto *GS* :menu) (:update *GS* dt)