From 73e180df8896af8111580834d0a7c51c2ec973a2 Mon Sep 17 00:00:00 2001 From: SouthFox Date: Sun, 26 May 2024 10:40:54 +0800 Subject: [PATCH] [feat] add record type --- game.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/game.scm b/game.scm index 9fa75f6..d9aeecb 100644 --- a/game.scm +++ b/game.scm @@ -54,3 +54,25 @@ (add-event-listener! (current-document) "keydown" (procedure->external on-key-down)) + + +(define-record-type + (make-gelement-type interact? image) + gelement-type? + (interact? gelement-interact?) + (image gelement-type-iamge)) + +(define-record-type + (make-gelement type content) + gelement? + (type gelement-type) + (content gelement-content set-gelement-content!)) + +(define wall (make-gelement (make-gelement-type #f "wall") #nil)) +(define apple (make-gelement (make-gelement-type #t "apple") #nil)) + +(define ppp (vector (vector apple wall wall apple wall) + (vector wall wall wall wall wall) + (vector apple wall wall wall wall) + (vector wall wall wall wall wall) + (vector wall wall wall wall wall)))