http://www.ccs.neu.e...e/prologue.html
This code is based off of Chapter 1 of HTDP. I've gotten this far and it wasn't as bad as last time. And it's been 5 years (I can't believe it) since I've touched this language. The only issues I have really are two things.
Outside of those two things. I'm quite happy with my progress. I've thankfully gotten over the prefix issue as well, lol.
(define BOARDWIDTH 200) (define BOARDHEIGHT 200) (define STARTPOSITION 50) (define BOARDBKGR "blue") (define GAMEBOARD (empty-scene BOARDWIDTH BOARDHEIGHT BOARDBKGR)) (define ROCKET .) (define UFO (overlay (circle 10 "solid" "red") (rectangle 40 4 "solid" "green"))) (define FLATBED (rectangle 60 10 "outline" "black")) (define (SPACESHIP option) (cond [(= option 1) ROCKET] [(= option 2) UFO])) (define SHOWNSHIP (SPACESHIP 1)) (define V 10) ;Velocity (define A 1) ;Acceleration (define (distance t) ;t = Time (- (* V t) (* 1/2 A (sqr t)))) (define SPACESHIP-BOTTOM (- BOARDHEIGHT (/ (image-height SHOWNSHIP) 2))) (define (render-shownship x y) (place-image SHOWNSHIP x y GAMEBOARD)) (define (create-rocket-scene.v7 t) (cond [(<= (distance t) SPACESHIP-BOTTOM) (render-shownship STARTPOSITION (distance t))] [(> (distance t) SPACESHIP-BOTTOM) (render-shownship STARTPOSITION SPACESHIP-BOTTOM)]))
This code is based off of Chapter 1 of HTDP. I've gotten this far and it wasn't as bad as last time. And it's been 5 years (I can't believe it) since I've touched this language. The only issues I have really are two things.
- I couldn't find a way to do one of the suggestions. Which was: How would change the program so that the rocket lands on a flat rock bed that is 10 pixels higher than the bottom of the scene? Don’t forget to change the scenery, too. When I tried adding another function call to render-shownship, I kept getting an error.
- The spaceship goes down to the bottom of the screen, then accelerates up the screen. I'm a bit lost on why that is.
Outside of those two things. I'm quite happy with my progress. I've thankfully gotten over the prefix issue as well, lol.
Create a custom theme





