aboutsummaryrefslogtreecommitdiff
path: root/src/defeat_menu.moon
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2024-01-29 16:20:10 -0600
committerAlexander M Pickering <alex@cogarr.net>2024-01-29 16:20:10 -0600
commitc2926c5ec74d7e37da395c8c32a7ff2b4cae7d06 (patch)
treeac2bb208dab1274cdc5e9059ffe014ae19181a4c /src/defeat_menu.moon
downloadfools_rush_in-c2926c5ec74d7e37da395c8c32a7ff2b4cae7d06.tar.gz
fools_rush_in-c2926c5ec74d7e37da395c8c32a7ff2b4cae7d06.tar.bz2
fools_rush_in-c2926c5ec74d7e37da395c8c32a7ff2b4cae7d06.zip
All the files
Diffstat (limited to 'src/defeat_menu.moon')
-rw-r--r--src/defeat_menu.moon66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/defeat_menu.moon b/src/defeat_menu.moon
new file mode 100644
index 0000000..6810519
--- /dev/null
+++ b/src/defeat_menu.moon
@@ -0,0 +1,66 @@
+
+main = require "main"
+bp = require "broadphase"
+color = require "color"
+ui = require "ui"
+
+world = require "world" --delete when done
+import Server from world
+import World from world
+mod = ...
+
+-- 4 parts?
+nwidth = 6
+section_width = 32
+start_x = (-32)*(nwidth/2)
+mod.node = am.group!
+mod.node\append(am.sprite("data/defeat_screen.png"))
+start_y = 0
+padding = 32
+buttonspecs = {
+ menu: {
+ y_off: start_y,
+ text: "Menu"
+ },
+}
+
+
+mod.load = () ->
+ print("creating main menu")
+ main.root("screen")\append(mod.node)
+ for name, button_tbl in pairs buttonspecs
+ button_extra = ui.create_big_button(mod.node,6,start_x,button_tbl.y_off)
+ button_extra.node\append(am.translate(start_x+((nwidth*section_width)/2),button_tbl.y_off - 32)^ am.text(button_tbl.text,color.fg))
+ mod[name] = button_extra
+ touch_indicator = am.group!
+ touch_cursor = am.sprite("data/cursor.png",vec4(1,1,1,1),"left","top")
+ touch_loc = am.translate(0,0)^ touch_cursor
+ touch_indicator\append(touch_loc)
+ mod.node\append(am.translate(0,100)^ am.scale(3)^ am.text("You failed to\nremain silly"))
+ mod.node\action("click_interpreter",coroutine.create(()->
+ while true
+ if #main.win\active_touches! > 0
+ touch = main.win\touch_position(1)
+ touch_cursor.color = vec4(1,1,1,1)
+ touch_loc.x = touch.x
+ touch_loc.y = touch.y
+ col_but = bp.check(touch.x, touch.y+64)
+ if #col_but > 0
+ touch_cursor.color = vec4(0.5,0.5,0.5,0.5)
+ if #col_but > 0
+ print("Collided with button:",col_but)
+ print("mod.create prty was:",mod.create_party)
+ if col_but[1] == mod.menu
+ am.eval_js("location.reload()")
+ else
+ touch_cursor.color = vec4(0,0,0,0)
+ coroutine.yield!
+ ))
+ mod.node\append(touch_indicator)
+
+mod.unload = () ->
+ main.root("screen")\remove(mod.node)
+ bp.remove(mod.create_party)
+ bp.remove(mod.join_party)
+
+mod