diff --git a/collects/2htdp/planetcute.rkt b/collects/2htdp/planetcute.rkt index 6a8022e7f4..5eaca72632 100644 --- a/collects/2htdp/planetcute.rkt +++ b/collects/2htdp/planetcute.rkt @@ -5,7 +5,7 @@ (define-syntax (definitions stx) #`(begin - #,@(for/list ([img (in-list images)]) + #,@(for/list ([img (in-list (apply append (map cdr images)))]) (define req (string->symbol (format "2htdp/planetcute/~a" (name->filename img)))) #`(begin (provide #,img) diff --git a/collects/2htdp/planetcute/Star.png b/collects/2htdp/planetcute/Yellow Star.png similarity index 100% rename from collects/2htdp/planetcute/Star.png rename to collects/2htdp/planetcute/Yellow Star.png diff --git a/collects/2htdp/private/planetcute-image-list.rkt b/collects/2htdp/private/planetcute-image-list.rkt index 50fb3c2c76..c2ea92816d 100644 --- a/collects/2htdp/private/planetcute-image-list.rkt +++ b/collects/2htdp/private/planetcute-image-list.rkt @@ -15,53 +15,69 @@ (format "~a.png" (apply string (reverse new-chars)))) (define images - '(brown-block - character-boy - character-cat-girl - character-horn-girl - character-pink-girl - character-princess-girl - chest-closed - chest-lid - chest-open - dirt-block - door-tall-closed - door-tall-open - enemy-bug - gem-blue - gem-green - gem-orange - grass-block - heart - key - plain-block - ramp-north - ramp-south - ramp-west - roof-east - roof-north-east - roof-north-west - roof-north - roof-south-east - roof-south-west - roof-south - roof-west - shadow-east - shadow-north-east - shadow-north-west - shadow-north - shadow-side-west - shadow-south-east - shadow-south-west - shadow-south - shadow-west - stone-block-tall - stone-block - tree-short - tree-tall - tree-ugly - wall-block-tall - wall-block - water-block - window-tall - wood-block)) \ No newline at end of file + '((Characters + character-boy + character-cat-girl + character-horn-girl + character-pink-girl + character-princess-girl + enemy-bug + speechbubble) + + (Items + chest-closed + chest-lid + chest-open + gem-blue + gem-green + gem-orange + heart + key + rock + selector + tree-short + tree-tall + tree-ugly + yellow-star) + + (Blocks + brown-block + dirt-block + grass-block + plain-block + stone-block-tall + stone-block + wall-block-tall + wall-block + water-block + wood-block) + + (Ramps + ramp-east + ramp-north + ramp-south + ramp-west) + + (Buildings + door-tall-closed + door-tall-open + roof-east + roof-north-east + roof-north-west + roof-north + roof-south-east + roof-south-west + roof-south + roof-west + window-tall) + + (Shadows + shadow-east + shadow-north-east + shadow-north-west + shadow-north + shadow-side-west + shadow-south-east + shadow-south-west + shadow-south + shadow-west))) diff --git a/collects/teachpack/2htdp/scribblings/2htdp.scrbl b/collects/teachpack/2htdp/scribblings/2htdp.scrbl index 20b1bf20f9..5bb0793f88 100644 --- a/collects/teachpack/2htdp/scribblings/2htdp.scrbl +++ b/collects/teachpack/2htdp/scribblings/2htdp.scrbl @@ -10,5 +10,5 @@ @include-section["batch-io.scrbl"] @include-section["image.scrbl"] @include-section["universe.scrbl"] -@include-section["port.scrbl"] @include-section["planetcute.scrbl"] +@include-section["port.scrbl"] diff --git a/collects/teachpack/2htdp/scribblings/PlanetCuteShadowMockup.jpg b/collects/teachpack/2htdp/scribblings/PlanetCuteShadowMockup.jpg new file mode 100755 index 0000000000..6f5c9a666b Binary files /dev/null and b/collects/teachpack/2htdp/scribblings/PlanetCuteShadowMockup.jpg differ diff --git a/collects/teachpack/2htdp/scribblings/PlanetCuteShadowTest.png b/collects/teachpack/2htdp/scribblings/PlanetCuteShadowTest.png new file mode 100755 index 0000000000..f498293df1 Binary files /dev/null and b/collects/teachpack/2htdp/scribblings/PlanetCuteShadowTest.png differ diff --git a/collects/teachpack/2htdp/scribblings/planetcute.scrbl b/collects/teachpack/2htdp/scribblings/planetcute.scrbl index c369f399b6..9c7fafa7a8 100644 --- a/collects/teachpack/2htdp/scribblings/planetcute.scrbl +++ b/collects/teachpack/2htdp/scribblings/planetcute.scrbl @@ -4,8 +4,11 @@ "port.rkt" scribble/manual scribble/eval - (for-syntax racket/base) 2htdp/image + racket/runtime-path + racket/draw + racket/class + (for-syntax racket/base) (for-label 2htdp/image 2htdp/planetcute)) @@ -20,8 +23,8 @@ @(interaction-eval #:eval pc-eval (require 2htdp/planetcute)) The @racketmodname[2htdp/planetcute] library contains the -Planet Cute art by Daniel Cook (Lostgarden.com), -@url{http://www.lostgarden.com/2007/05/dancs-miraculously-flexible-game.html}, +@link["http://www.lostgarden.com/2007/05/dancs-miraculously-flexible-game.html"]{Planet Cute} +art by Daniel Cook (Lostgarden.com). The images are designed to be overlaid with each other to build scenes for use in games. Here is an example image taken @@ -29,6 +32,8 @@ from the Planet Cute website. @racketblock+eval[#:eval pc-eval + (code:comment "stacks its arguments on each") + (code:comment "other, separated by 40 pixels") (define (stack arg . args) (cond [(null? args) arg] @@ -36,25 +41,42 @@ from the Planet Cute website. (apply stack args))]))] @interaction[#:eval pc-eval - (scale - 1 - (beside/align - "bottom" - (stack wall-block-tall stone-block) - (stack character-cat-girl - stone-block stone-block - stone-block stone-block) - water-block - (stack grass-block dirt-block) - (stack grass-block dirt-block dirt-block)))] + (beside/align + "bottom" + (stack wall-block-tall stone-block) + (stack character-cat-girl + stone-block stone-block + stone-block stone-block) + water-block + (stack grass-block dirt-block) + (stack grass-block dirt-block dirt-block))] @(close-eval pc-eval) - + +The Planet Cute images also include some shadows that can improve the +look of your game; see the @secref["pc:Shadows"] section for an overview +of how to use them. + @(require (for-syntax 2htdp/private/planetcute-image-list)) @(define-syntax (defthings stx) - #`(begin - #,@(for/list ([img (in-list images)]) - (define req (string->symbol (format "2htdp/planetcute/~a" (name->filename img)))) - #`@defthing[#,img image?]{ @(bitmap #,req) }))) + (syntax-case stx () + [(_ what whatever ...) + (identifier? #'what) + (let* ([sym (syntax-e #'what)] + [sec-title (symbol->string sym)] + [these-images (cdr (assoc sym images))]) + #`(begin + @section[#:tag #,(format "pc:~a" sec-title) #,sec-title] + whatever ... + #,@(for/list ([img (in-list these-images)]) + (define req (string->symbol (format "2htdp/planetcute/~a" (name->filename img)))) + #`@defthing[#,img image?]{ @(bitmap #,req) })))])) -@defthings[] +@(define-runtime-path PlanetCuteShadowTest.png "PlanetCuteShadowTest.png") + +@defthings[Characters]{} +@defthings[Blocks]{} +@defthings[Items]{} +@defthings[Ramps]{} +@defthings[Buildings]{} +@defthings[Shadows]{@(make-object bitmap% PlanetCuteShadowTest.png)}