On this page:
5.1 Crafter Kata (difficulty = 1)
5.2 Crafter Kata (difficulty = 2)
5.3 Crafter Kata (difficulty = 4)
5.4 Crafter Kata (difficulty = 5)
5.5 Weapon Crafter Kata (difficulty = 2)
5.6 Weapon Crafter Kata (difficulty = 2)
5.7 Weapon Crafter Kata (difficulty = 3)

5 Crafter Katas

5.1 Crafter Kata (difficulty = 1)

read
Code a game with a basic crafter.
code
#lang survival
 
(survival-game
  #:crafter-list (list
   (basic-crafter
    #:sprite cauldron-sprite
    #:position (posn 200 200)
    #:tile 2)))

5.2 Crafter Kata (difficulty = 2)

Tip: By adding a recipe, the crafter now requires an item in the avatar’s backpack to build something.

read
Code a game with carrots, and a crafter that makes carrot stew from carrots.
code
#lang survival
 
(survival-game
  #:food-list (list
   (carrot #:name "Carrot" #:amount-in-world 10))
  #:crafter-list (list
   (basic-crafter
    #:recipe-list (list carrot-stew-recipe))))

5.3 Crafter Kata (difficulty = 4)

Tip: The carrot-stew-recipe used above is already defined in the lang. To add your own recipies, you will need to define them yourself!

read
Code a game with fish, and a crafter that makes fish stew with high-healing power.
code
#lang survival
 
(define (fish-stew)
   (basic-product
    #:name "Fish Stew"
    #:sprite fishstew-sprite
    #:heals-by 50))
 
(define fish-stew-recipe
   (recipe
    #:product (fish-stew)
    #:ingredients (list "Fish")))
 
(survival-game
  #:food-list (list (fish))
  #:crafter-list (list
   (basic-crafter
    #:recipe-list (list fish-stew-recipe))))

5.4 Crafter Kata (difficulty = 5)

read
Code a game with carrots, fish, and a crafter that makes both carrot-stew and fish-stew.
code
#lang survival
 
(define (fish-stew)
   (basic-product
    #:name "Fish Stew"
    #:sprite fishstew-sprite
    #:heals-by 50))
 
(define fish-stew-recipe
   (recipe
    #:product (fish-stew)
    #:ingredients (list "Fish")))
 
(define (my-cauldron)
   (basic-crafter
    #:recipe-list (list carrot-stew-recipe fish-stew-recipe)))
 
(survival-game
  #:food-list (list
   (carrot #:amount-in-world 10)
   (fish #:amount-in-world 10))
  #:crafter-list (list (my-cauldron)))

5.5 Weapon Crafter Kata (difficulty = 2)

read
Code a game with a crafter that builds swords.
code
#lang survival
 
(define my-sword-recipe
   (recipe #:product (sword) #:build-time 20))
 
(survival-game
  #:crafter-list (list
   (basic-crafter
    #:sprite woodtable-sprite
    #:recipe-list (list my-sword-recipe))))

5.6 Weapon Crafter Kata (difficulty = 2)

Tip: You can also try: spear, fire-magic, ice-magic, sword-magic, ring-of-fire, ring-of-ice, or ring-of-blades.

read
Code a game with a wood table crafter that slowly builds a high-damage sword.
code
#lang survival
 
(define my-sword-recipe
   (recipe
    #:product (sword #:damage 100)
    #:build-time 100))
 
(survival-game
  #:crafter-list (list
   (basic-crafter
    #:sprite woodtable-sprite
    #:recipe-list (list my-sword-recipe))))

5.7 Weapon Crafter Kata (difficulty = 3)

Tip: The default speed for fire-magic is 3.

read
Code a game with coins, and a wood table crafter that instantly builds fast-moving fire-magic for 100 gold.
code
#lang survival
 
(define my-fire-magic-recipe
   (recipe
    #:product (fire-magic #:name "Fast Flame" #:speed 7)
    #:cost 100))
 
(survival-game
  #:coin-list (list (basic-coin))
  #:crafter-list (list
   (basic-crafter
    #:sprite woodtable-sprite
    #:recipe-list (list my-fire-magic-recipe))))