3 Commits fb756bd5f0 ... aae14c44f9

Author SHA1 Message Date
  eq aae14c44f9 broken merge fix 5 years ago
  eq 003054a59a move up 5 years ago
  eq 8e7314b5cf yee haw messages 5 years ago
3 changed files with 10 additions and 4 deletions
  1. 1 0
      globals.fnl
  2. 3 3
      main.fnl
  3. 6 1
      monsters.fnl

+ 1 - 0
globals.fnl

@@ -11,6 +11,7 @@
 (global items [])
 (global triggers [])
 (global fx [])
+(global msgs [])
 (var _song -1)
 (var music? false)
 (var quickstart? true)

+ 3 - 3
main.fnl

@@ -76,8 +76,7 @@
       (and t t.stairs (= t.dir -1))
       (set action-name "ascend")
       (set action-name "wait")))
-  (print (.. "[z] commands, [x] " action-name) 60 129)
-
+  (print (or (first msgs) (.. "[z] commands, [x] " action-name)) 129 121)
   (print (.. "equipment" ) v.x (+ v.y 0) 9)
   (var i 1)
   (each [k o (pairs player.equip)]
@@ -137,7 +136,8 @@
 
 (fn advance []
   (stat-updates entities)
-  (brains entities))
+  (brains entities)
+  (if (not (empty? msgs)) (global msgs (rest msgs))))
 
 
 (global TIC 

+ 6 - 1
monsters.fnl

@@ -82,7 +82,8 @@
   (lambda [player item]
     ; TODO msg
     (set player.hp (math.min (+ player.hp n) player.maxhp))
-    (remove player.inventory item)))
+    (table.insert msgs 1 msg))
+    (remove player.inventory item))
 
 (fn teleport [e o]
   (remove e.inventory o)
@@ -96,6 +97,10 @@
   :pos (point 0 0)})
 
 (var item-map [
+  {:name :key
+    :color 14
+    :sprite 3
+    :use (item-heal 5 "you eat the key.")}
   {:name :red-potion
     :color 6
     :sprite 19