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