{"size": 3685, "ext": "scrbl", "max_stars_repo_path": "htdp-doc/teachpack/2htdp/scribblings/planetcute.scrbl", "max_stars_repo_name": "bdeket/htdp", "max_stars_repo_stars_event_min_datetime": "2015-01-14T20:28:41.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-20T04:04:26.000Z", "max_issues_repo_path": "htdp-doc/teachpack/2htdp/scribblings/planetcute.scrbl", "max_issues_repo_name": "bdeket/htdp", "max_issues_repo_issues_event_min_datetime": "2015-01-14T19:50:21.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-19T21:38:00.000Z", "max_forks_repo_path": "htdp-doc/teachpack/2htdp/scribblings/planetcute.scrbl", "max_forks_repo_name": "bdeket/htdp", "max_forks_repo_forks_event_min_datetime": "2015-01-14T19:11:38.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-24T05:11:39.000Z"}
{"max_stars_count": 85, "max_issues_count": 132, "max_forks_count": 81, "avg_line_length": 38.3854166667, "max_line_length": 98, "alphanum_fraction": 0.5660786974}
#lang scribble/doc

@(require "shared.rkt" 
          "port.rkt"
          scribble/manual
          scribble/eval
          2htdp/image
          racket/runtime-path
          (except-in racket/draw make-color make-pen)
          racket/class
          (for-syntax racket/base)
          (for-label 2htdp/image
                     2htdp/planetcute
                     (only-in lang/htdp-beginner first list rest empty? define cond)))

@; -----------------------------------------------------------------------------

@title{Planet Cute Images}

@defmodule[2htdp/planetcute]

@(define pc-eval (make-base-eval))
@(interaction-eval #:eval pc-eval (require 2htdp/image 2htdp/planetcute racket/list))

The @racketmodname[2htdp/planetcute] library contains the 
@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
from the Planet Cute website.

@racketblock+eval[#:eval 
                  pc-eval
                  (code:comment "stack : non-empty-list-of-images -> image")
                  (code:comment "stacks 'imgs' on each other, separated by 40 pixels")
                  (define (stack imgs)
                    (cond
                      [(empty? (rest imgs)) (first imgs)]
                      [else (overlay/xy (first imgs)
                                        0 40
                                        (stack (rest imgs)))]))]
@interaction[#:eval 
             pc-eval
             (beside/align
              "bottom"
              (stack (list wall-block-tall stone-block))
              (stack (list character-cat-girl
                           stone-block stone-block
                           stone-block stone-block))
              water-block
              (stack (list grass-block dirt-block))
              (stack (list 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)
   (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) })))]))

@(begin
   (define-runtime-path PlanetCuteShadow1.png "PlanetCuteShadow1.png")
   (define-runtime-path PlanetCuteShadow2.png "PlanetCuteShadow2.png")
   (define-runtime-path PlanetCuteShadow2b.png "PlanetCuteShadow2b.png")
   (define-runtime-path PlanetCuteShadow3.png "PlanetCuteShadow3.png"))

@defthings[Characters]{}
@defthings[Blocks]{}
@defthings[Items]{}
@defthings[Ramps]{}
@defthings[Buildings]{}
@defthings[Shadows]{The shadow images are intended to be
                    overlaid on the other blocks when they
                    appear in certain configurations, as
                    detailed here.
                    
                    @(read-bitmap PlanetCuteShadow1.png) 
                    @(read-bitmap PlanetCuteShadow2.png)
                    @(read-bitmap PlanetCuteShadow2b.png)
                    @(read-bitmap PlanetCuteShadow3.png) }
