summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/battlemap_character.erl')
-rw-r--r--src/battlemap_character.erl30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/battlemap_character.erl b/src/battlemap_character.erl
new file mode 100644
index 0000000..b831340
--- /dev/null
+++ b/src/battlemap_character.erl
@@ -0,0 +1,30 @@
+-module(battlemap_character).
+-export([encode_in_json/1]).
+
+encode_in_json (
+ {
+ ID,
+ Name,
+ Icon,
+ Portrait,
+ {X, Y},
+ Team,
+ MovementPoints,
+ AttackRange
+ }
+) ->
+ jiffy:encode(
+ {
+ [
+ {<<"id">>, ID},
+ {<<"name">>, Name},
+ {<<"icon">>, Icon},
+ {<<"portait">>, Portrait},
+ {<<"loc_x">>, X},
+ {<<"loc_y">>, Y},
+ {<<"team">>, Team},
+ {<<"mov_pts">>, MovementPoints},
+ {<<"atk_rg">>, AttackRange}
+ ]
+ }
+ ).