;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-reader.ss" "lang")((modname entry3) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp"))))) (start 600 600) ; TITLE SCREEN ; structure for opening credits (define-struct openingcredits (title byline)) ; fills in Transformers 3 and our names in the proper fields (define opening (make-openingcredits "Transformers 3" "By A Great Anonymous Team") ) (draw-solid-string (make-posn 250 220) (openingcredits-title opening)) (draw-solid-string (make-posn 150 240) (openingcredits-byline opening)) (sleep-for-a-while 2) ; Prints Transformers 3 by a great anonymous team using the structure info (clear-solid-rect (make-posn 0 0 ) 600 600 ) ; clears the screen (draw-solid-rect (make-posn -1 350) 400 280 'brown) ; draws ground (define xp -1) ; defines the xp (x position) variable ; defines the car (define (tcar xp) (and (draw-solid-disk (make-posn (+ xp 15) 340) 10 'black) (draw-solid-disk (make-posn (+ xp 65) 340) 10 'black) (draw-solid-rect (make-posn xp 320) 80 20 'red) (draw-solid-disk (make-posn (+ xp 32) 320) 20 'red) )) ; defines the function to clear the car (define (tcarclear xp) (and (clear-solid-disk (make-posn (+ xp 15) 340) 10) (clear-solid-disk (make-posn (+ xp 65) 340) 10) (clear-solid-rect (make-posn xp 320) 80 20) (clear-solid-disk (make-posn (+ xp 32) 320) 20) )) ; draws car, then clears it and draws it in a new position (tcar 0) (sleep-for-a-while .5) (tcarclear 0) (tcar 75) (sleep-for-a-while .5) (tcarclear 75) (tcar 150) (sleep-for-a-while .5) (tcarclear 150) (tcar 225) (sleep-for-a-while .5) (tcarclear 225) (tcar 310) (sleep-for-a-while 1) (tcarclear 310) ; draws colored rectangles representing transformation (draw-solid-rect (make-posn (+ xp 320) 260) 60 90 'yellow) (sleep-for-a-while .5) (clear-solid-rect (make-posn (+ xp 320) 260) 60 90) (draw-solid-rect (make-posn (+ xp 300) 290) 90 60 'orange) (sleep-for-a-while .5) (clear-solid-rect (make-posn (+ xp 300) 290) 90 60) (draw-solid-rect (make-posn (+ xp 310) 280) 70 70 'green) (sleep-for-a-while .5) (clear-solid-rect (make-posn (+ xp 310) 280) 70 70) (define Xx 320) (define Xy 240) ; defines the transformer (define (Trans Xx Xy) (and (draw-solid-rect (make-posn (- Xx 40) (+ Xy 5)) 139 15 'red) ;arms (draw-solid-rect (make-posn (- Xx 10) Xy)79 25 'black) ;upper wheels (draw-solid-rect (make-posn (- Xx 10) (+ Xy 45)) 79 25 'black) ;lower wheels (draw-solid-rect (make-posn Xx Xy) 60 70 'red) ;body (draw-solid-rect (make-posn (- Xx 5) (+ Xy 70)) 20 40 'red) ;left leg (draw-solid-rect (make-posn (+ Xx 45) (+ Xy 70)) 20 40 'red) ;right leg (draw-solid-rect (make-posn (+ Xx 15) (- Xy 25)) 30 30 'red) ;head )) ; defines the transformer clear function (define (transclear Xx Xy) (and (clear-solid-rect (make-posn (- Xx 40) (+ Xy 5)) 139 15 ) ;arms (clear-solid-rect (make-posn (- Xx 10) Xy)79 25 ) ;upper wheels (clear-solid-rect (make-posn (- Xx 10) (+ Xy 45)) 79 25 ) ;lower wheels (clear-solid-rect (make-posn Xx Xy) 60 70 ) ;body (clear-solid-rect (make-posn (- Xx 5) (+ Xy 70)) 20 40 ) ;left leg (clear-solid-rect (make-posn (+ Xx 45) (+ Xy 70)) 20 40 ) ;right leg (clear-solid-rect (make-posn (+ Xx 15) (- Xy 25)) 30 30 ) ;head )) ; draws transformer, clears it, then draws it in a new position (Trans Xx Xy) (sleep-for-a-while 1) (transclear 320 240) (Trans (+ Xx 70) (- Xy 70)) (sleep-for-a-while 1) (transclear (+ Xx 70) (- Xy 70)) (Trans (+ Xx 140) (- Xy 140)) (sleep-for-a-while 1) (transclear (+ Xx 140) (- Xy 140)) (Trans (+ Xx 210) (- Xy 210)) (sleep-for-a-while 1) (transclear (+ Xx 210) (- Xy 210)) (sleep-for-a-while 1) (clear-solid-rect (make-posn 0 0) 600 600) ; draws the end ...? (draw-solid-string (make-posn 250 220) "THE END") (sleep-for-a-while 2) (draw-solid-string (make-posn 330 220) "?") (sleep-for-a-while 2) (stop)