Appendix 1Adding Rooms to the Game

A game where you only face an enemy and find an exit isn’t that interesting. A game should have more challenges and places to explore. You can use your imagination to create additional interesting ideas for the game you built in Chapter 6, Designing Your Elixir Applications. Here are some suggestions that you can implement in your game:

 defmodule​ DungeonCrawl.Room.Triggers.Trap ​do
  alias DungeonCrawl.Room.Action
  alias Mix.Shell.IO, ​as:​ Shell
 
  @behaviour DungeonCrawl.Room.Trigger
 
 def​ run(character, %Action{​id:​ ​:forward​}) ​do
  Shell.info(​"​​You're walking cautiously and can see the next room."​)
  {character, ...

Get Learn Functional Programming with Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.