summaryrefslogtreecommitdiff
path: root/app/Example/CircleThatMoves.hs
diff options
context:
space:
mode:
authorMikkel Thestrup <mithe24@student.sdu.dk>2025-12-16 14:10:27 +0100
committerMikkel Thestrup <mithe24@student.sdu.dk>2025-12-25 15:16:53 +0100
commitaa9fc62a29c865452f3e5437c4166854583bba97 (patch)
treef99d64c5b6e31bac583a88d5fd4429bf9c8b248d /app/Example/CircleThatMoves.hs
downloadscratchy-aa9fc62a29c865452f3e5437c4166854583bba97.tar.gz
scratchy-aa9fc62a29c865452f3e5437c4166854583bba97.zip
Initial commit
Diffstat (limited to 'app/Example/CircleThatMoves.hs')
-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 ())