--- [[ Global Variables ]] ----------g_arena = nil -- The global arena class, to avoid having to pass it around functionsg_bGameRunning = false -- Is the game running?--- [[ Functions ]] ---------- [[ Global Variables ]] ----------g_arena = nil -- The global arena class, to avoid having to pass it around functionsg_bGameRunning = false -- Is the game running?--- [[ Functions ]] --------- when the arena is created, it runs thisfunction Arena_OnCreate(arena) g_arena = arena math.randomseed(os.time())end-- Code in this function is carried out when the player joins function Player_OnJoin(player) player:message("Debug message: Lua loaded") player:setstat(1, 1)endfunction Player_OnWarpItem(user, itemid, target) -------------------------------------------------Angle Up if (itemid == 119) then local angle = user:getstat(1) if (angle == 6) then user:message("Thats the highest this thing goes!") else user:setstat(1, angle + 1) user:message("Angle is now " .. angle .. "") return false end --------------------------------------------------Angle Down elseif (itemid == 121) then local angle = user:getstat(1) if (angle == 0) then user:message("Thats the lowest this thing goes!") else user:setstat(1, angle - 1) user:message("Angle is now " .. angle .. "") return false end -------------------------------------------------------GL Fire elseif (itemid == 122) then local c = user:coords() local angle = user:getstat(1) local angletofire = "GL Angle 1" if (angle == 2) then angletofire = "GL Angle 2" elseif (angle == 3) then angletofire = "GL Angle 3" elseif (angle == 4) then angletofire = "GL Angle 4" elseif (angle == 5) then angletofire = "GL Angle 5" elseif (angle == 6) then angletofire = "GL Angle 6" end g_arena:explosion_create(angletofire, c.x, c.y, c.rotation + 5) ------------------------------------------------------ end return falseend-- when the game starts, it sets gameRunning to truefunction Arena_OnGameStart() g_bGameRunning = trueend-- when the game finishes, it sets gameRunning to falsefunction Arena_OnGameEnd() g_bGameRunning = falseend