Survival
1 Functions
custom-sky
custom-avatar
custom-weapon
custom-enemy
survival-game
custom-crafter
custom-npc
custom-bg
custom-food
custom-product
custom-coin
custom-item
2 Survival Game Assets
2.1 Avatars, Enemies and NPCs
random-character-sprite
witch-sprite
darkelf-sprite
wizard-sprite
pirate-sprite
monk-sprite
madscientist-sprite
lightelf-sprite
bat-sprite
cat-sprite
blackcat-sprite
whitecat-sprite
snake-sprite
slime-sprite
2.2 Food, Coin, and Crafting Items
apples-sprite
carrot-sprite
carrotstew-sprite
toastedmarshmallow-sprite
smores-sprite
fish-sprite
cookedfish-sprite
fishstew-sprite
cherry-sprite
steak-sprite
coppercoin-sprite
silvercoin-sprite
goldcoin-sprite
cauldron-sprite
campfire-sprite
woodtable-sprite
chest-sprite
bowl-sprite
2.3 Backgrounds
FOREST-BG
SNOW-BG
DESERT-BG
LAVA-BG
PINK-BG
7.5

Survival

thoughtstem

 #lang survival package: survival

    1 Functions

    2 Survival Game Assets

      2.1 Avatars, Enemies and NPCs

      2.2 Food, Coin, and Crafting Items

      2.3 Backgrounds

1 Functions

procedure

(custom-sky [#:night-sky-color color    
  #:length-of-day day-length    
  #:start-of-daytime day-start    
  #:end-of-daytime day-end    
  #:max-darkness max-darkness])  sky?
  color : (or/c string? symbol?) = 'black
  day-length : number? = 2400
  day-start : number? = #f
  day-end : number? = #f
  max-darkness : number? = 160
Creates a custom sky that can be used in the #:sky parameter of survival-game.

procedure

(custom-avatar [#:sprite sprite    
  #:damage-processor damage-processor    
  #:position position    
  #:speed speed    
  #:key-mode key-mode    
  #:mouse-aim? mouse-aim    
  #:health health    
  #:max-health max-health    
  #:components first-component]    
  rest ...)  entity?
  sprite : (or/c sprite? (listof sprite?) string? (listof string?))
   = (random-character-sprite)
  damage-processor : damage-processor?
   = 
(filter-damage-by-tag #:filter-out '(friendly-team passive)
                      #:show-damage? #t
                      #:hit-sound HIT-SOUND)
  position : posn? = (posn 100 100)
  speed : number? = 10
  key-mode : (or/c 'wasd 'arrow-keys) = 'arrow-keys
  mouse-aim : boolean? = #f
  health : number? = 100
  max-health : number? = 100
  first-component : (or/c component-or-system? #f (listof #f))
   = #f
  rest : (listof (or/c component-or-system? #f (listof #f)))
Returns a custom avatar, which will be placed in to the world automatically if it is passed into survival-game via the #:avatar parameter.

procedure

(custom-weapon [#:name name    
  #:sprite sprite    
  #:dart-sprite dart-sprite    
  #:speed speed    
  #:damage damage    
  #:range range    
  #:dart dart    
  #:fire-mode fire-mode    
  #:fire-rate fire-rate    
  #:fire-key fire-key    
  #:fire-sound fire-sound    
  #:mouse-fire-button button    
  #:point-to-mouse? ptm?    
  #:rapid-fire? rf?    
  #:rarity rarity])  entity?
  name : string? = "Repeater"
  sprite : (or/c sprite? (listof sprite?) string? (listof string?))
   = chest-sprite
  dart-sprite : (or/c sprite? (listof sprite?) string? (listof string?))
   = (rectangle 10 2 "solid" "green")
  speed : number? = 10
  damage : number? = 10
  range : number? = 1000
  dart : entity? = 
(custom-dart #:sprite ds
             #:speed spd
             #:damage dmg
             #:range rng)
  fire-mode : fire-mode? = 'normal
  fire-rate : number? = 3
  fire-key : symbol? = 'f
  fire-sound : (or/c rsound? procedure? '() #f) = LASER-SOUND
  button : (or/c 'left 'right false?) = #f
  ptm? : boolean? = #f
  rf? : boolean? = #t
  rarity : rarity-level? = 'common
Returns a custom weapon, which will be placed in to the world automatically if it is passed into survival-game via the #:weapon-list parameter.

procedure

(custom-enemy [#:amount-in-world amount-in-world    
  #:sprite sprite    
  #:ai ai    
  #:health health    
  #:weapon weapon    
  #:death-particles death-particles    
  #:night-only? night-only?    
  #:components first-component]    
  more-components ...)  entity?
  amount-in-world : positive? = 1
  sprite : (or/c sprite? (listof sprite?) string? (listof string?))
   = (first (shuffle (list slime-sprite bat-sprite snake-sprite)))
  ai : ai-level? = 'medium
  health : positive? = 100
  weapon : entity? = 
(custom-weapon #:name "Spitter"
               #:dart (acid-dart))
  death-particles : entity? = (custom-particles)
  night-only? : boolean? = #f
  first-component : (or/c component-or-system? #f (listof #f))
   = #f
  more-components : (listof (or/c component-or-system? #f (listof #f)))
Returns a custom enemy, which will be placed in to the world automatically if it is passed into survival-game via the #:enemy-list parameter.

procedure

(survival-game [#:headless headless    
  #:bg bg    
  #:avatar avatar    
  #:starvation-rate starvation-rate    
  #:sky sky    
  #:npc-list npc-list    
  #:enemy-list enemy-list    
  #:coin-list coin-list    
  #:food-list food-list    
  #:crafter-list crafter-list    
  #:score-prefix prefix    
  #:enable-world-objects? world-objects?    
  #:weapon-list weapon-list    
  #:instructions instructions    
  #:other-entities other-entities]    
  rest ...)  game?
  headless : boolean? = #f
  bg : entity? = (plain-forest-bg)
  avatar : (or/c entity? #f)
   = (custom-avatar #:sprite (circle 10 'solid 'red))
  starvation-rate : (or/c number? #f) = 50
  sky : (or/c sky? #f) = (custom-sky)
  npc-list : (listof (or/c entity? procedure?)) = '()
  enemy-list : (listof (or/c entity? procedure?)) = '()
  coin-list : (listof (or/c entity? procedure?)) = '()
  food-list : (listof (or/c entity? procedure?)) = '()
  crafter-list : (listof (or/c entity? procedure?)) = '()
  prefix : string? = "Gold"
  world-objects? : boolean? = #f
  weapon-list : (listof (or/c entity? procedure?)) = '()
  instructions : (or/c #f entity?) = #f
  other-entities : (or/c #f entity? (listof #f) (listof entity?))
   = #f
  rest : (listof (or/c #f entity? (listof #f) (listof entity?)))
The top-level function for the survival-game language. Can be run with no parameters to get a basic, default game.

procedure

(custom-crafter [#:position position    
  #:tile tile    
  #:name name    
  #:sprite sprite    
  #:open-key open-key    
  #:open-sound open-sound    
  #:select-sound select-sound    
  #:recipe-list recipe-list    
  #:components first-component]    
  more-components ...)  entity?
  position : posn? = (posn 100 100)
  tile : number? = 0
  name : string? = "Crafter"
  sprite : (or/c sprite? (listof sprite?) string? (listof string?))
   = cauldron-sprite
  open-key : (or/c string? symbol?) = 'space
  open-sound : (or/c rsound? procedure? '() #f)
   = OPEN-DIALOG-SOUND
  select-sound : (or/c rsound? procedure? '() #f) = BLIP-SOUND
  recipe-list : (listof recipe?)
   = 
(list (recipe #:product (carrot-stew)
              #:build-time 30))
  first-component : (or/c component-or-system? #f (listof #f))
   = #f
  more-components : (listof (or/c component-or-system? #f (listof #f)))
Returns a custom crafter, which will be placed in to the world automatically if it is passed into survival-game via the #:crafter-list parameter.

procedure

(custom-npc [#:sprite sprite    
  #:position position    
  #:name name    
  #:tile tile    
  #:dialog dialog    
  #:mode mode    
  #:game-width game-width    
  #:speed speed    
  #:target target    
  #:sound sound    
  #:scale scale    
  #:components first-component]    
  more-components ...)  entity?
  sprite : (or/c sprite? (listof sprite?) string? (listof string?))
   = (random-character-sprite)
  position : posn? = (posn 200 200)
  name : string?
   = 
(first (shuffle (list "Adrian" "Alex" "Riley"
                      "Sydney" "Charlie" "Andy")))
  tile : number? = 0
  dialog : dialog-str? = #f
  mode : (or/c 'still 'wander 'pace 'follow) = 'wander
  game-width : number? = 480
  speed : number? = 2
  target : string? = "player"
  sound : boolean? = #t
  scale : number? = 1
  first-component : (or/c component-or-system? #f (listof #f) observe-change?)
   = #f
  more-components : (listof (or/c component-or-system? #f (listof #f) observe-change?))
Returns a custom npc, which will be placed in to the world automatically if it is passed into survival-game via the #:npc-list parameter.

procedure

(custom-bg [#:image bg-img    
  #:rows rows    
  #:columns columns    
  #:start-tile start-tile    
  #:hd? high-def?    
  #:components first-component]    
  more-components ...)  entity?
  bg-img : image? = FOREST-BG
  rows : number? = 3
  columns : number? = 3
  start-tile : number? = 0
  high-def? : boolean? = #f
  first-component : (or/c component-or-system? #f (listof #f))
   = #f
  more-components : (listof (or/c component-or-system? #f (listof #f)))
Returns a custom background, which will be used automatically if it is passed into survival-game via the #:bg parameter.

procedure

(custom-food [#:name name    
  #:sprite sprite    
  #:tile tile    
  #:position position    
  #:amount-in-world amount-in-world    
  #:storable? storable?    
  #:consumable? consumable?    
  #:value value    
  #:heals-by heals-by    
  #:respawn? respawn?    
  #:on-pickup pickup-func    
  #:on-store store-func    
  #:on-drop drop-func    
  #:components first-component]    
  more-components ...)  entity?
  name : string? = "Carrot"
  sprite : (or/c sprite? (listof sprite?)) = carrot-sprite
  tile : number? = 0
  position : posn? = (posn 0 0)
  amount-in-world : number? = 1
  storable? : boolean? = #t
  consumable? : boolean? = #t
  value : (or/c number? #f) = #f
  heals-by : (or/c number? #f) = 10
  respawn? : boolean? = #t
  pickup-func : procedure? = (λ (g e) e)
  store-func : procedure? = (λ (g e) e)
  drop-func : procedure? = (λ (g e) e)
  first-component : component-or-system? = #f
  more-components : (listof component-or-system?)
Returns a custom food, which will be placed into the world automatically if it is passed into adventure-game via the #:food-list parameter.

procedure

(custom-product [#:name name    
  #:sprite sprite    
  #:tile tile    
  #:position position    
  #:amount-in-world amount-in-world    
  #:storable? storable?    
  #:consumable? consumable?    
  #:value value    
  #:heals-by heals-by    
  #:respawn? respawn?    
  #:on-pickup pickup-func    
  #:on-store store-func    
  #:on-drop drop-func    
  #:components first-component]    
  more-components ...)  entity?
  name : string? = "Carrot Stew"
  sprite : (or/c sprite? (listof sprite?)) = carrotstew-sprite
  tile : number? = 0
  position : posn? = (posn 0 0)
  amount-in-world : number? = 1
  storable? : boolean? = #t
  consumable? : boolean? = #t
  value : (or/c number? #f) = #f
  heals-by : (or/c number? #f) = 10
  respawn? : boolean? = #f
  pickup-func : procedure? = (λ (g e) e)
  store-func : procedure? = (λ (g e) e)
  drop-func : procedure? = (λ (g e) e)
  first-component : component-or-system? = #f
  more-components : (listof component-or-system?)
Returns a custom product, which can be used to create a recipe product if it is passed into recipe via the #:product parameter.

procedure

(custom-coin [#:entity entity    
  #:sprite sprite    
  #:position position    
  #:name name    
  #:tile tile    
  #:amount-in-world amount-in-world    
  #:value value    
  #:respawn? respawn    
  #:components first-component]    
  more-components ...)  entity?
  entity : entity? = (copper-coin)
  sprite : (or/c sprite? (listof sprite?) string? (listof string?) #f)
   = #f
  position : (or/c posn? #f) = #f
  name : (or/c string? #f) = #f
  tile : (or/c number? #f) = #f
  amount-in-world : number? = 10
  value : number? = 10
  respawn : boolean? = #t
  first-component : (or/c component-or-system? #f (listof #f))
   = #f
  more-components : (listof (or/c component-or-system? #f (listof #f)))
Returns a custom coin, which will be placed into the world automatically if it is passed into survival-game via the #:coin-list parameter.

procedure

(custom-item [#:name name    
  #:sprite sprite    
  #:tile tile    
  #:position position    
  #:amount-in-world amount-in-world    
  #:storable? storable?    
  #:consumable? consumable?    
  #:value value    
  #:heals-by heals-by    
  #:respawn? respawn?    
  #:on-pickup pickup-func    
  #:on-store store-func    
  #:on-drop drop-func    
  #:components first-component]    
  more-components ...)  entity?
  name : string? = "Chest"
  sprite : (or/c sprite? (listof sprite?)) = chest-sprite
  tile : number? = #f
  position : posn? = #f
  amount-in-world : number? = 1
  storable? : boolean? = #t
  consumable? : boolean? = #f
  value : (or/c number? #f) = 10
  heals-by : (or/c number? #f) = #f
  respawn? : boolean? = #t
  pickup-func : procedure? = (λ (g e) e)
  store-func : procedure? = (λ (g e) e)
  drop-func : procedure? = (λ (g e) e)
  first-component : component-or-system? = #f
  more-components : (listof component-or-system?)
Returns a custom item, which has a unique item id and can be used in npc quests.

2 Survival Game Assets

2.1 Avatars, Enemies and NPCs

procedure

(random-character-sprite)  animated-sprite?

image

value

witch-sprite : animated-sprite?

image

value

darkelf-sprite : animated-sprite?

image

value

wizard-sprite : animated-sprite?

image

value

pirate-sprite : animated-sprite?

image

value

monk-sprite : animated-sprite?

image

value

madscientist-sprite : animated-sprite?

image

value

lightelf-sprite : animated-sprite?

image

value

bat-sprite : animated-sprite?

image

value

cat-sprite : animated-sprite?

image

value

blackcat-sprite : animated-sprite?

image

value

whitecat-sprite : animated-sprite?

image

value

snake-sprite : animated-sprite?

image

value

slime-sprite : animated-sprite?

image

2.2 Food, Coin, and Crafting Items

value

apples-sprite : animated-sprite?

image

value

carrot-sprite : animated-sprite?

image

value

carrotstew-sprite : animated-sprite?

image

value

toastedmarshmallow-sprite : animated-sprite?

image

value

smores-sprite : animated-sprite?

image

value

fish-sprite : animated-sprite?

image

value

cookedfish-sprite : animated-sprite?

image

value

fishstew-sprite : animated-sprite?

image

value

cherry-sprite : animated-sprite?

image

value

steak-sprite : animated-sprite?

image

value

coppercoin-sprite : animated-sprite?

image

value

silvercoin-sprite : animated-sprite?

image

value

goldcoin-sprite : animated-sprite?

image

value

cauldron-sprite : animated-sprite?

image

value

campfire-sprite : animated-sprite?

image

value

woodtable-sprite : animated-sprite?

image

value

chest-sprite : animated-sprite?

image

value

bowl-sprite : animated-sprite?

image

2.3 Backgrounds

value

FOREST-BG : image?

image

value

SNOW-BG : image?

image

value

DESERT-BG : image?

image

value

LAVA-BG : image?

image

value

PINK-BG : image?

image