[plt-scheme] DrScheme Interactions window

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat May 8 17:38:05 EDT 2004

Connor, it sounds like you want to create an executable
from your UFO game. For simplicity, let's consider a
rocket launch instead, modeled with the new animation
feature from 207:

> (module gamex mzscheme
>
>   (require (lib "plt-pretty-big.ss" "lang") (lib "draw.ss" "htdp"))
>   ;; ---- Connor started writing here:
>   (define (where-x t) (+ 20 (* 2 t)))
>   (define (where-y t) (- 300 (* 1/2 9.8 t t)))
>
>   (start 300 300) ;; create canvas
>   (big-bang .8 0) ;; clock ticks every .8 of a second, world is a 
> natural number
>   (on-tick-event  ;; World -> World
>    (lambda (t)
>      (draw
>        (draw-solid-disk (make-posn (where-x t) (where-y t)) 5 'white) 
> ;; erase old
>        (draw-solid-disk (make-posn (where-x (+ t 1)) (where-y (+ t 
> 1))) 5 'red) ;; draw new
>        produce
>        (+ t 1))))
>   ;; ---- That's all
>   )

When you're done developing, wrap it with the three
lines that you see above. Make sure the name of the
file is gamex.ss. Then select Scheme | Create Executable.

You will see a DrScheme-like icon on your finder (file menu)
and you can double-click it.

-- Matthias



Posted on the users mailing list.