summaryrefslogtreecommitdiff
path: root/app/Example/CircleThatMoves.hs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/Example/CircleThatMoves.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/Example/CircleThatMoves.hs b/app/Example/CircleThatMoves.hs
new file mode 100644
index 0000000..9d9aa8b
--- /dev/null
+++ b/app/Example/CircleThatMoves.hs
@@ -0,0 +1,19 @@
+module Example.CircleThatMoves where
+
+import Graphics.Gloss.Interface.Pure.Game
+import Scratchy.Syntax
+
+circSprite :: SProg ()
+circSprite = NewSprite
+ (15,15)
+ (Color green $ circleSolid (cellSize * 0.6))
+ (\s ->
+ OnKeyEvent (Char 'w')
+ ( OnTargetReached s
+ (\cl -> SetTarget s (nextCell U cl) (Pure ()))
+ $ Pure () )
+ $ OnKeyEvent (Char 's')
+ ( OnTargetReached s
+ (\cl -> SetTarget s (nextCell D cl) (Pure ()))
+ $ Pure () )
+ $ Pure ())