This is the code used in the Ecspanse Tutorial.
Ecspanse is a an Entity Component System library for Elixir.
- clone the repo
- install dependencies with
mix deps.get
- start the app with
iex -S mix
Then:
- fetch the hero details
iex(1)> Demo.API.fetch_hero_details()
- move the hero
iex(2)> Demo.API.move_hero(:up)
etc. See the functions in the Demo.API
module for more details.
-
you need to have elixir LiveBook installed
-
start the livebook
-
start the Demo ap with the
sname
andcookeie
options, like:iex --sname demo --cookie cookie -S mix
-
open the livebook
- open
- from file
- browse to
./ecspanse_demo/livebook/
- select
demo.livemd
- open
-
connect the livebook to the running demo app
- in the left menu select the
Runtime settings
- configure
- attach node
- add the
name
andcookie
you set when starting the demo app - connect
- in the left menu select the
-
the app should be now connected and you can evaluate the code in the livebook
-
the two sections should be available: Hero and Market. Enable the keyboard control and use the arrow keys to move the hero and collect resources. Use the resources to purchase items from the shop and see them in the hero inventory.