This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; See http://htdp2e.blogspot.com/2012/05/exercise-172-develop-data.html | |
; Constants | |
(define WORM-SIZE 10) | |
(define WORM-MOVE (* WORM-SIZE 2)) | |
(define WIDTH 800) ; width of the game | |
(define HEIGHT 500) ; height of the game | |
(define SEGMENT (circle WORM-SIZE "solid" "red")) | |
; these structs will hold the current list of worm segments, the direction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Constants | |
(define WORM-SIZE 10) | |
(define WORM-MOVE WORM-SIZE) | |
(define WIDTH 800) ; width of the game | |
; these structs will hold the current position of the worm, the direction | |
; the worm is travelling in, and our world object | |
(define-struct worm(x-pos y-pos)) | |
(define-struct direction(x y)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;Exercise 170: Design an interactive GUI program that continually moves a one-segment worm and enables a player to | |
;control the movement of the worm with the four cardinal arrow keys. Your program should use a red disk to render the | |
;one-and-only segment of the worm. For each clock tick, the worm should move diameter. | |
; Game constants and constants | |
; We make the worm size changable here, and when we move the worm it will be by the amount | |
; specified | |
; The hints provided in the question suggest two different means to keep track of the worm - a physical and logical |
NewerOlder