Use this language to create your own adventure-style game!
Package Source: adventure
Need a reminder how to install a package? Check out this video tutorial.
Code a basic adventure game.
(adventure-game)
Code a game with a fast wizard avatar.
(adventure-game
#:avatar (basic-avatar #:sprite wizard-sprite
#:speed 20))
Code a game with a fast, strong pirate avatar.
(define (my-avatar)
(basic-avatar #:sprite pirate-sprite
#:speed 20
#:health 200
#:max-health 200))
(adventure-game
#:avatar (my-avatar))
Code a game with a fast avatar and an intro cutscene. Customize the cutscene to have a sprite and some text.
(adventure-game
#:avatar (basic-avatar #:sprite pirategirl-sprite
#:speed 20)
#:intro-cutscene (basic-cutscene (page pirategirl-sprite
"This is the story of"
"Jordan the Pirate.")))
Code a game with an avatar and an intro cutscene. Customize the cutscene with 2 pages, include sprites and text.
(adventure-game
#:avatar (basic-avatar
#:sprite madscientist-sprite)
#:intro-cutscene (basic-cutscene
(page "A long time ago,"
"In a place far, far, away...")
(page (set-sprite-scale 2 madscientist-sprite)
"There was a mad scientist"
"named Dr. Horrible.")))
Code a game with a background.
(adventure-game
#:avatar (basic-avatar)
#:bg (basic-bg))
Code a game with a desert background.
(adventure-game
#:avatar (basic-avatar)
#:bg (basic-bg #:image DESERT-BG))
Code a game with a lava background that has 2 rows and 2 columns.
(define (my-bg)
(basic-bg
#:image LAVA-BG
#:rows 2
#:columns 2))
(adventure-game
#:avatar (basic-avatar)
#:bg (my-bg))
Code a game with a high-definition lava background that has 2 rows, 2 columns, and starts on tile 3.
(define (my-bg)
(basic-bg #:image LAVA-BG
#:rows 2
#:columns 2
#:start-tile 3
#:hd? #t))
(adventure-game #:bg (my-bg))
Code a game with 20 vaulable gold coins that do not respawn.
(adventure-game
#:coin-list (list (basic-coin #:sprite goldcoin-sprite
#:value 100
#:amount-in-world 20
#:respawn? #f)))
Code a game with cheap copper coins, more valuable silver coins, and very valuable gold coins.
(define (copper-coin)
(basic-coin #:sprite coppercoin-sprite
#:name "Copper Coin"
#:value 1))
(define (silver-coin)
(basic-coin #:sprite silvercoin-sprite
#:name "Silver Coin"
#:value 25))
(define (gold-coin)
(basic-coin #:sprite goldcoin-sprite
#:name "Gold Coin"
#:value 50))
(adventure-game
#:coin-list (list (copper-coin)
(silver-coin)
(gold-coin)))
Code a game with a very rare, trick gold coin. Make the coin worth -1000 and spawn an enemy when picked up.
(define (my-trick-coin)
(basic-coin #:name "Gold Coin"
#:sprite goldcoin-sprite
#:value -1000
#:amount-in-world 1
#:respawn? #f
#:on-pickup (spawn-on-current-tile (basic-enemy #:position (posn 0 0)
#:tile 0))))
(adventure-game
#:coin-list (list (my-trick-coin)))
Code a game with an extremely rare and valuable gold coin. When the coin is picked up, spawn a cutscene with a gold coin and some text.
(define (my-special-coin)
(basic-coin #:name "Gold Coin"
#:sprite goldcoin-sprite
#:value 1000
#:amount-in-world 1
#:respawn? #f
#:on-pickup (spawn (page goldcoin-sprite
"This looks valuable."))))
(adventure-game
#:coin-list (list (my-special-coin)))
Code a game with 15 coins that do not respawn and an NPC. Give a collect quest where you have to collect 100 points for a reward.
(define (my-coin)
(basic-coin #:amount-in-world 15
#:respawn? #f))
(define (npc-with-coin-quest)
(basic-npc #:dialog (list "I've lost my coins..."
"...100 points worth!"
"Can you find them for me?")
#:quest-list (list (collect-quest #:collect-amount 100
#:reward-amount 50))))
(adventure-game
#:npc-list (list (npc-with-coin-quest))
#:coin-list (list (my-coin)))
Code a game with an avatar and a crafter.
(adventure-game
#:avatar (basic-avatar)
#:crafter-list (list (basic-crafter)))
Code a game with 10 carrots and a crafter that produces carrot stew.
(adventure-game
#:avatar (basic-avatar)
#:food-list (list (carrot #:amount-in-world 10))
#:crafter-list (list (basic-crafter
#:recipe-list (list carrot-stew-recipe))))
Code a game with a 10 fish, and a fish stew recipe, and a cauldron that produces fish stew.
(define (fish-stew)
(basic-food #:name "Fish Stew"
#:sprite fishstew-sprite
#:respawn? #f
#:heals-by 50))
(define fish-stew-recipe
(recipe #:product (fish-stew)
#:build-time 40
#:ingredients (list "Fish")))
(adventure-game
#:avatar (basic-avatar)
#:food-list (list (fish #:amount-in-world 10))
#:crafter-list (list (basic-crafter #:sprite cauldron-sprite
#:recipe-list (list fish-stew-recipe))))
Code a game with 10 fish,10 carrots, a fish stew recipe, and a cauldron that produces fish stew and carrot stew. Customize the tile and position of the cauldron.
(define (fish-stew)
(basic-food #:name "Fish Stew"
#:sprite fishstew-sprite
#:respawn? #f
#:heals-by 50))
(define fish-stew-recipe
(recipe #:product (fish-stew)
#:build-time 40
#:ingredients (list "Fish")))
(define (my-cauldron)
(basic-crafter #:sprite cauldron-sprite
#:position (posn 200 200)
#:tile 2
#:recipe-list (list carrot-stew-recipe
fish-stew-recipe)))
(adventure-game
#:avatar (basic-avatar)
#:food-list (list (carrot #:amount-in-world 10)
(fish #:amount-in-world 10))
#:crafter-list (list (my-cauldron)))
Code a game with 10 strong, nocturnal enemies with moderate intelligence and each with a random sprite.
(adventure-game
#:enemy-list (list (curry basic-enemy
#:ai 'medium
#:amount-in-world 10
#:night-only? #t
#:health 200)))
Code a game with several enemies: 4 low intelligence slime, 2 moderately intelligent bats, and a highly intelligent, nocturnal snake.
(define (easy-enemy)
(basic-enemy #:ai 'easy
#:sprite slime-sprite
#:amount-in-world 4))
(define (medium-enemy)
(basic-enemy #:ai 'medium
#:sprite bat-sprite
#:amount-in-world 2))
(define (hard-enemy)
(basic-enemy #:ai 'hard
#:sprite snake-sprite
#:night-only? #t))
(adventure-game
#:enemy-list (list (easy-enemy)
(medium-enemy)
(hard-enemy)))
Code a game with a spear and 3 highly intelligent enemies that drop valuable gold coins.
(define (my-gold-coin)
(basic-coin #:sprite goldcoin-sprite
#:value 20))
(define (hard-enemy)
(basic-enemy #:amount-in-world 3
#:ai 'hard
#:loot-list (list (my-gold-coin)
(my-gold-coin))))
(adventure-game
#:weapon-list (list (spear))
#:enemy-list (list (hard-enemy)))
Code a game with an avatar, a spear, and 3 highly intelligent enemies that shoot fireballs. Include a creative game over cutscene.
(define (hard-enemy)
(basic-enemy #:amount-in-world 3
#:ai 'hard
#:weapon (fireball)))
(adventure-game
#:avatar (basic-avatar #:sprite steampunkboy-sprite)
#:death-cutscene (basic-cutscene (page (set-sprite-angle 90 (render steampunkboy-sprite))
"You died!")
(page "Try harder!"))
#:weapon-list (list (spear))
#:enemy-list (list (hard-enemy)))
Code a game with an NPC who has a quest to slay several enemies; the quest has a point and item reward. Include 10 random enemies, a fireball power, and a game over cutscene.
(define my-hunt-quest
(hunt-quest #:hunt-amount 5
#:reward-amount 50
#:reward-item (sword)))
(adventure-game
#:death-cutscene (basic-cutscene (page "You died!"
"Try harder!"))
#:npc-list (list (basic-npc #:dialog (list "These monsters are annoying."
"Can you get rid of 5?")
#:quest-list (list my-hunt-quest)))
#:weapon-list (list (fireball))
#:enemy-list (list (curry basic-enemy #:amount-in-world 10)))
Code a game with an NPC who has a fetch quest to find their lost cat.
(define lost-cat
(basic-item #:name "Mylo"
#:sprite cat-sprite))
(adventure-game
#:npc-list (list (basic-npc #:dialog (list "Can you help me find my cat?"
"I've looked everywhere!")
#:quest-list (list (fetch-quest #:item lost-cat)))))
Code a game with an NPC who has a quest to find their lost sword. Give the quest an ending cutscene including the NPC sprite and some text.
(define my-cutscene
(basic-cutscene (page (set-sprite-scale 2 darkknight-sprite)
"Thank you! I should probably stop losing this...")))
(adventure-game
#:npc-list (list (basic-npc #:sprite darkknight-sprite
#:dialog (list "Can you help me find my sword?")
#:quest-list (list (fetch-quest #:item (sword)
#:cutscene my-cutscene)))))
Code a game with an NPC who has 2 quests to return 2 different pets. Add a reward to both of the quests.
(define fetch-quest-1
(fetch-quest #:item (basic-item #:name "Mylo"
#:sprite cat-sprite)
#:reward-amount 200))
(define fetch-quest-2
(fetch-quest #:item (basic-item #:name "Buttons"
#:sprite whitecat-sprite)
#:reward-amount 200))
(adventure-game
#:npc-list (list (basic-npc #:name "Erin"
#:sprite lightelf-sprite
#:dialog (list "Can you help me find my cats?"
"I'll give you a reward for each cat.")
#:quest-list (list fetch-quest-1
fetch-quest-2))))
Code a game with an NPC who has a rewarded quest to find their antique bowl. The NPC's dialog changes once the quest is complete.
(define my-fetch-quest
(fetch-quest #:item (basic-item #:sprite bowl-sprite)
#:quest-complete-dialog (list "Phew! This is a family herloom!!")
#:new-response-dialog (list "Thanks again! My mom was so mad...")
#:reward-amount 400))
(adventure-game
#:npc-list (list (basic-npc #:name "Erin"
#:sprite lightelf-sprite
#:dialog (list "Can you find my antique bowl?")
#:quest-list (list my-fetch-quest))))
Code a game with an NPC who has a high-reward quest to find their lost cat. Give the cat pickup and drop cutscenes (the drop cutscene only happens if dropped away from the NPC).
(define my-quest-item
(basic-item #:name "Mylo"
#:sprite cat-sprite
#:on-store (spawn (page (set-sprite-scale 2 cat-sprite)
"This must be Erin's lost cat"))
#:on-drop (spawn (page "Maybe I shouldn't leave him"
"alone like this.")
#:rule (not/r (entity-in-game? "Erin")))))
(adventure-game
#:npc-list (list (basic-npc #:name "Erin"
#:sprite lightelf-sprite
#:dialog (list "Can you help my find my cat?")
#:quest-list (fetch-quest #:item my-quest-item
#:reward-amount 500))))
Code a game with several hearty foods.
(adventure-game
#:food-list (list (basic-food #:sprite apples-sprite
#:name "Apples"
#:amount-in-world 10
#:heals-by 20)))
Code a game with 2 types of food: a common apple; and a very rare, hearty cherry.
(define my-food
(basic-food #:sprite apples-sprite
#:name "Apples"
#:amount-in-world 10))
(define special-food
(basic-food #:sprite cherry-sprite
#:name "Cherry"
#:heals-by 50
#:respawn? #f))
(adventure-game
#:food-list (list my-food
special-food))
Code a game with an avatar who starts at half-health. Add a hearty steak that spawns a cutscene on pickup. The cutscene includes the steak sprite and text.
(define special-food
(basic-food #:sprite steak-sprite
#:name "Rare Steak"
#:heals-by 100
#:on-pickup (spawn (page (set-sprite-scale 2 steak-sprite)
"This tastes raw ..."
"maybe I should have cooked it."))))
(adventure-game
#:avatar (basic-avatar #:health 100
#:max-health 200)
#:food-list (list special-food))
Code a game with several fish and a crafter that produces a hearty fish stew.
(define fish-stew
(basic-food #:name "Fish Stew"
#:sprite fishstew-sprite
#:respawn? #f
#:heals-by 50))
(define fish-stew-recipe
(recipe #:product fish-stew
#:build-time 40
#:ingredients (list "Fish")))
(adventure-game
#:food-list (list (fish #:amount-in-world 10))
#:crafter-list (list (basic-crafter #:recipe-list (list fish-stew-recipe))))
Code a game with an NPC and a crafter that produces a carrot stew. Give the NPC dialog and a quest to make the carrot stew.
(define carrot-stew
(basic-food #:name "Carrot Stew"
#:sprite carrotstew-sprite))
(define my-carrot-stew-recipe
(recipe #:product carrot-stew
#:ingredients (list "Carrot")))
(adventure-game
#:npc-list (list (basic-npc #:dialog (list "Can you make me some carrot stew?")
#:quest-list (list (craft-quest #:item carrot-stew))))
#:food-list (list (carrot))
#:crafter-list (list (basic-crafter #:recipe-list (list my-carrot-stew-recipe))))
Code a basic adventure game.
(adventure-game)
Code a game with a forest level that has world objects.
(adventure-game
#:bg (basic-bg #:image FOREST-BG)
#:enable-world-objects? #t)
Code a game with a candy level and 2 types of randomly-colored, high-definition trees.
(adventure-game
#:bg (basic-bg #:image PINK-BG)
#:other-entities (make-world-objects candy-cane-tree
snow-pine-tree
#:hd? #t
#:random-color? #t))
Code a game with a desert level filled with random brown rocks. Make everything high-definition.
(adventure-game
#:bg (basic-bg #:image DESERT-BG
#:hd? #t)
#:other-entities (make-world-objects random-brown-rock
random-brown-rock
#:hd? #t))
Code a game with a lava level filled with high-definition gray rocks. Add an intro cutscene with three pages.
(adventure-game
#:bg (basic-bg #:image LAVA-BG
#:hd? #t)
#:intro-cutscene (basic-cutscene (page "Once upon a time"
"on a volcanic moon"
"of a distance world...")
(page "There was a lone soldier"
"who was banished from his"
"homeworld.")
(page (set-sprite-scale 2 basic-sprite)
"This is his story."))
#:other-entities (make-world-objects random-gray-rock
random-gray-rock
#:hd? #t))
Code a game with a big gray rock, a randomly-colored brick house, and low-quality barrels. Manually set positions and tiles of all these entities.
(adventure-game
#:bg (basic-bg)
#:avatar (basic-avatar)
#:other-entities (reduce-quality-by 2 (barrels (posn 100 200) #:tile 0))
(large-gray-rock (posn 100 200) #:tile 1 #:size 2)
(brick-house (posn 200 200) #:tile 2 #:hue (random 360)))
????
(define stolen-chest (basic-item))
(adventure-game
#:enemy-list (list (basic-enemy #:loot-list (list stolen-chest)))
#:npc-list (list (basic-npc #:dialog (list "Someone stole my chest!")
#:quest-list (list (loot-quest #:item stolen-chest))))
#:weapon-list (list (spear)))
????
(define stolen-cat
(make-storable
(basic-npc #:sprite cat-sprite
#:dialog (list "Help me!"))))
(adventure-game
#:enemy-list (list (basic-enemy #:loot-list (list stolen-cat)))
#:npc-list (list (basic-npc #:dialog (list "Someone took my cat!")
#:quest-list (list (loot-quest #:item stolen-cat))))
#:weapon-list (list (fireball #:damage 50)))
????
(define stolen-food
(basic-food #:name "Apples"
#:sprite apples-sprite))
(define my-cutscene
(basic-cutscene (page (set-sprite-scale 2 apples-sprite)
"Now I can make Grandma's apple pie!")))
(adventure-game
#:enemy-list (list (basic-enemy #:loot-list (list stolen-food)))
#:npc-list (list (basic-npc #:dialog (list "Help! Someone stole my apples!")
#:quest-list (list (loot-quest #:item stolen-food
#:cutscene my-cutscene))))
#:weapon-list (list (repeater #:damage 50)))
????
(define stolen-cat
(make-storable (basic-npc #:sprite cat-sprite
#:dialog (list "Meow!"))))
(define my-loot-quest
(loot-quest #:item stolen-cat
#:quest-complete-dialog (list "Thank you for finding my cat!")
#:new-response-dialog (list "Thanks again for your help.")
#:reward-amount 400))
(adventure-game
#:enemy-list (list (basic-enemy #:loot-list (list stolen-cat)))
#:npc-list (list (basic-npc #:dialog (list "Help! Someone stole my cat!")
#:quest-list (list my-loot-quest)))
#:weapon-list (list (ice-magic)))
????
(define stolen-item
(basic-item #:name "Empty Bowl"
#:sprite bowl-sprite
#:on-store (spawn (page (set-sprite-scale 2 bowl-sprite)
"This must be JOrdan's stolen bowl."))
#:on-drop (spawn (page "Maybe I shouldn't leave it here.")
#:rule (not/r (entity-in-game? "Jordan")))))
(adventure-game
#:enemy-list (list (basic-enemy #:loot-list (list stolen-item)))
#:npc-list (list (basic-npc #:name "Jordan"
#:dialog (list "That thief took my only bowl!"
"Please get it back!")
#:quest-list (loot-quest #:item stolen-item)))
#:weapon-list (list (fireball #:damage 50)))
Code a game with a witch NPC who follows you. Give her a name and a start location.
(adventure-game
#:npc-list (list (basic-npc
#:sprite witch-sprite
#:name "Witch"
#:mode 'follow
#:position (posn 200 200)
#:tile 3)))
Code a game with 2 NPCs. Give both NPCs names and multiple lines of dialog.
(define (polite-npc)
(basic-npc
#:name "Riley"
#:dialog (list "Oh hello there! I'm Riley."
"Beautiful day today!")))
(define (rude-npc)
(basic-npc
#:name "..."
#:dialog (list "Woah, who are you??"
"Nevermind -- I'm too busy."
"Move along, now!")))
(adventure-game
#:npc-list (list (polite-npc) (rude-npc)))
Code a game with an avatar and a named NPC. Give the avatar 3 questions and the NPC 3 responses.
(define player-dialog
(player-dialog-with "Jordan"
#:dialog-list (list "Hello. What's your name?"
"Are you lost?"
"What's the meaning of life?")))
(define npc-response
(list (list "I'm Jordan,"
"but you can call me J.")
(list "Nope. Just exploring!")
(list "That's a strange question...")))
(adventure-game
#:avatar (basic-avatar #:components player-dialog)
#:npc-list (list (basic-npc #:name "Jordan"
#:dialog npc-response)))
Code a game with an avatar who has random dialog and 2 NPCs with random responses.
(adventure-game
#:avatar (basic-avatar #:components (random-player-dialog-with "Dakota")
(random-player-dialog-with "Alex"))
#:npc-list (list (basic-npc #:name "Dakota"
#:dialog (random-npc-response))
(basic-npc #:name "Alex"
#:dialog (random-npc-response))))
Code a game with an NPC who has a quest to fetch their lost spear. Give the NPC new dialog after the quest is complete.
(define spear-quest
(fetch-quest #:item (spear)
#:quest-complete-dialog (list "YAY! MY SPEAR!")
#:new-response-dialog (list "Thanks again!")))
(adventure-game
#:npc-list (list (basic-npc #:name "Charlie"
#:dialog (list "Can you find my spear?")
#:quest-list (list spear-quest))))
Code a game with a sky that has a long day.
(adventure-game
#:avatar (basic-avatar)
#:sky (basic-sky #:length-of-day 5000))
Code a game with a sky that has a short day and an extremely dark night.
(adventure-game
#:avatar (basic-avatar)
#:sky (basic-sky #:length-of-day 500
#:max-darkness 255))
Code a game with a sky that has a light night with a magenta night sky.
(adventure-game
#:avatar (basic-avatar)
#:sky (basic-sky #:night-sky-color 'darkmagenta
#:max-darkness 150))
Code a game with 20 nocturnal enemies and a sky. Make the sky have a short night.
(adventure-game
#:avatar (basic-avatar)
#:enemy-list (list (basic-enemy #:amount-in-world 20
#:night-only? #t))
#:sky (basic-sky #:length-of-day 2400
#:start-of-daytime 200
#:end-of-daytime 2200))
????
(adventure-game
#:weapon-list (list (spear #:name "Needle"
#:speed 15
#:damage 20
#:rarity 'rare)))
????
(define (my-sword)
(sword #:damage 50
#:rarity 'legendary))
(define (my-repater)
(repeater #:color 'red
#:fire-mode 'spread))
(adventure-game
#:weapon-list (list (my-sword)
(my-repater))
#:enemy-list (list (basic-enemy #:amount-in-world 5)))
????
(define (my-weapon)
(repeater #:name "Hologram Shooter"
#:icon (make-icon "?" 'red)
#:sprite (random-character-sprite)
#:speed 5
#:damage 25
#:range 50))
(adventure-game
#:enemy-list (list (basic-enemy #:amount-in-world 5))
#:weapon-list (list (my-weapon)))
????
(define (my-fire-magic)
(fire-magic #:on-store (spawn (page "Ouch, this is hot!"))))
(define (my-ice-magic)
(ice-magic #:on-store (spawn (page "Woah, this is cold!"))))
(adventure-game
#:enemy-list (list (basic-enemy #:amount-in-world 10))
#:weapon-list (list (my-fire-magic)
(my-ice-magic)))
????
(define (my-sword)
(sword #:damage 50
#:on-store (spawn (page (set-sprite-angle 45 swinging-sword-sprite)
"I found a Sword!"))
#:on-drop (spawn (page "Oh no! Better put it back in my backpack."))))
(define (my-enemy)
(basic-enemy #:sprite pirateboy-sprite
#:on-death (spawn (page (set-sprite-angle 90 (render pirateboy-sprite))
"You won!"))))
(adventure-game
#:enemy-list (list (my-enemy))
#:weapon-list (list (my-sword)))
Code a game with a sword recipe that has a short build time, and a wooden table that produces swords.
(define my-sword-recipe
(recipe #:product (sword)
#:build-time 20))
(adventure-game
#:avatar (basic-avatar)
#:crafter-list (list (basic-crafter
#:sprite woodtable-sprite
#:recipe-list (list my-sword-recipe))))
Code a game with a sword recipe that has a moderately long build time, and a wooden table that produces strong swords.
(define my-sword-recipe
(recipe #:product (sword #:name "Heavy Sword"
#:damage 100)
#:build-time 40))
(adventure-game
#:avatar (basic-avatar)
#:crafter-list (list (basic-crafter
#:sprite woodtable-sprite
#:recipe-list (list my-sword-recipe))))
Code a game with 10 valuable coins, an expensive fire magic recipe that has a long build time, and a wooden table that produces fast fire magic.
(define my-fire-magic-recipe
(recipe #:product (fire-magic #:name "Fire Magic"
#:speed 5)
#:build-time 60
#:cost 100))
(adventure-game
#:avatar (basic-avatar)
#:coin-list (list (basic-coin #:value 20
#:amount-in-world 10))
#:crafter-list (list (basic-crafter
#:sprite woodtable-sprite
#:recipe-list (list my-fire-magic-recipe))))