;; The first three lines of this file were inserted by DrScheme. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname entry9) (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"))))) ; Lab 4 ;Contract: number number number symbol -> picture ;Purpose: draw a comic using draw.ss teachpack ;Example: (person 20 20 10 'red) -> o ; -|- ; / \ ; tee hee (define (pause k) ; sleep-for-a-while takes too fackin long to type. k = milliseconds. s-f-a-w takes seconds. divide by 1000. (sleep-for-a-while (/ k 1000)) ) (define (clearEVERYTHINGGG schemesucks) ; have to have an argument... (draw-solid-rect (make-posn 0 0) 200 230 'white) ) ; begin eric's face code (define (draw-face x y size emotion);draw a face at x,y with size size and emotion for a smile/frown (and (draw-circle (make-posn x y) (* 10 (/ size 10)) 'Blue);draw head (draw-solid-disk (make-posn (- x (/ size 3)) (- y (/ size 3))) (/ size 10) 'Red);draw left eye (draw-solid-disk (make-posn (+ x (/ size 3)) (- y (/ size 3))) (/ size 10) 'Red);draw right eye (draw-solid-line (make-posn (- x (/ size 3)) (+ y (/ size 3))) (make-posn x (- y (* emotion (/ size -3)) (/ size -3))) 'Red);draw left side of mouth (draw-solid-line (make-posn x (- y (* emotion (/ size -3)) (/ size -3))) (make-posn (+ x (/ size 3)) (+ y (/ size 3))) 'Red);draw right side of mouth ) ) ; end eric's face code (define-struct person (x y color)) ; x&y are positions of the head; color must be a symbol (define (stickfigure a-person) ; x&y are positions of the head; color must be symbol (and (draw-solid-disk (make-posn (person-x a-person) (person-y a-person)) 10 (person-color a-person)) ; head (draw-solid-line (make-posn (person-x a-person) (person-y a-person)) (make-posn (person-x a-person) (+ (person-y a-person) 50)) (person-color a-person)) ; body line (draw-solid-line (make-posn (- (person-x a-person) 15) (+ (person-y a-person) 25)) (make-posn (+ (person-x a-person) 15) (+ (person-y a-person) 25)) (person-color a-person)) ; arms (draw-solid-line (make-posn (person-x a-person) (+ (person-y a-person) 50)) (make-posn (- (person-x a-person) 10) (+ (person-y a-person) 70)) (person-color a-person)) ; left leg (draw-solid-line (make-posn (person-x a-person) (+ (person-y a-person) 50)) (make-posn (+ (person-x a-person) 10) (+ (person-y a-person) 70)) (person-color a-person)) ; right leg ) ) (define (wreckingball a b farbe) ; a&b are x/y positions of the ball; color must be symbol (and (draw-solid-disk (make-posn a b) 20 farbe) ;wrecking ball (draw-solid-line (make-posn 100 0) (make-posn a b) farbe) ;line/chain ) ) (define (clearthatwreckingball n q) ; does exactly what the function says it does (and (clear-solid-disk (make-posn n q) 20) ;wrecking ball (clear-solid-line (make-posn 100 0) (make-posn n q)) ;line/chain ) ) ; start animatin shit (define (doEVERYTHING! lol) ; need a variable... sigh (cond [(and (start 200 230) ; draw canvas (stickfigure (make-person 100 150 'red)) ;makes a stick figure with the structure person (pause 1000) (clearEVERYTHINGGG "asdfasdfqwertyqwertyqwerty") (draw-face 100 115 100 1) ;happy face! (pause 1500) (clearEVERYTHINGGG "uaeilasdhfiuhasd") (stickfigure (make-person 100 150 'red)) ;redraws the dude. (wreckingball 180 110 'black) (pause 300) (clearthatwreckingball 180 110) (wreckingball 155 125 'black) (pause 300) (clearthatwreckingball 155 125) (wreckingball 130 130 'black) (pause 300) ;OH SHIT! (clearEVERYTHINGGG "ihatescheme") ; :( (draw-face 100 115 100 -1) (pause 1500) (clearEVERYTHINGGG "ihateschemesomuch") (stickfigure (make-person 100 150 'red)) ;redraw the dude (clearthatwreckingball 130 130) (wreckingball 100 135 'black) (pause 300) (clearthatwreckingball 100 135) (wreckingball 70 125 'black) (draw-solid-disk (make-posn 100 150) 10 'white) ;get rid of his head! (pause 300) (clearthatwreckingball 70 125) (wreckingball 40 115 'black) (pause 300) (clearthatwreckingball 40 115) (wreckingball 25 105 'black) ) "i just won kthxbye"] [else "OHSHI-"] ; this will NEVER be printed ) ) (doEVERYTHING! "THAT'S-WHAT-I-THOUGHT") ; whatcha gonna do? ; 10 animations counting the first one ; BAM sucka!