diff --git a/main.lua b/main.lua index f1b4398..4ec345f 100644 --- a/main.lua +++ b/main.lua @@ -26,7 +26,7 @@ showTouchControls = false --0.9 VARIABLES isButtonAnimated = false - +lowcpu = false wallsLoadError = false background = love.graphics.newImage('img/background.jpg') backgroundScroll = 0 @@ -1020,10 +1020,19 @@ function speedControl() end end checking = 0 +local countinglowcpu = 0 function love.update(dt) --checking = checking + 1 --print(checking) --print("IMPORTANT!!!!!" .. globalState .. gameState) + if not lowcpu then + if (love.timer.getFPS() < 50 and gameState ~= "animation") then + countinglowcpu = countinglowcpu + 1 + if countinglowcpu > 10 then + lowcpu = true + end + end + end for i, explosion in ipairs(explosions) do explosion:update(dt) end @@ -1039,7 +1048,6 @@ function love.update(dt) end if globalState == "base" and not paused then basegame(dt) - end if globalState == "menu" then debugCheck(dt) diff --git a/mainMenu.lua b/mainMenu.lua index aaedce3..194f921 100644 --- a/mainMenu.lua +++ b/mainMenu.lua @@ -1,6 +1,6 @@ mainMenu = Class{} function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds, location) - if (gameState == 'editor') + if (gameState == 'editor') then ev_button_width = VIRTUAL_WIDTH * (1/72) ev_BUTTON_HEIGHT = VIRTUAL_WIDTH * (1/72) @@ -79,40 +79,37 @@ function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds ev_bx = locationx - (ev_button_width * 0.5) end if (location == 'control') then - - if string.sub(button.text, 1, 1) == '2' then + if string.sub(button.text, 1, 1) == '2' then ev_bx = (VIRTUAL_WIDTH*0.2) - (ev_button_width * 0.5) ev_by = locationy - (total_height * 0.5) + cursor_y - elseif string.sub(button.text, 1, 1) == '1' then - ev_bx = (VIRTUAL_WIDTH*0.8) - (ev_button_width * 0.5) - ev_by = locationy - (total_height * 0.5) + cursor_y - else - ev_bx = (VIRTUAL_WIDTH*0.5) - (ev_button_width * 0.5) - ev_by = locationy - (total_height * 0.5) + cursor_y - end - elseif button.text == 'NUCLEAR MODE' and easternum < 11 then - ev_bx = -400 - ev_by = -400 - elseif button.x > locationx - (ev_button_width * 0.5) then - --print("moving from" .. button.x) - button.x = button.x - 15 - --print("moving!" .. button.x) - ev_by = locationy - (total_height * 0.5) + cursor_y + elseif string.sub(button.text, 1, 1) == '1' then + ev_bx = (VIRTUAL_WIDTH*0.8) - (ev_button_width * 0.5) + ev_by = locationy - (total_height * 0.5) + cursor_y else + ev_bx = (VIRTUAL_WIDTH*0.5) - (ev_button_width * 0.5) ev_by = locationy - (total_height * 0.5) + cursor_y end - if (button.text == 'Play') and location == 'playercount' then color = {0/255, 255/255, 0/255, 255} else - color = {10, 10, 0, 255} + elseif button.text == 'NUCLEAR MODE' and easternum < 11 then + ev_bx = -400 + ev_by = -400 + elseif button.x > locationx - (ev_button_width * 0.5) then + --print("moving from" .. button.x) + if lowcpu then + button.x = locationx - (ev_button_width * 0.5) + else + button.x = button.x - 15 + end + --print("moving!" .. button.x) + ev_by = locationy - (total_height * 0.5) + cursor_y + else + ev_by = locationy - (total_height * 0.5) + cursor_y end - local color = {255, 255, 255, 255} - if (button.text == 'NUCLEAR MODE' and easternum > 10) then + color = {255, 255, 255, 255} + if (button.text == 'Play') and location == 'playercount' then color = {0/255, 255/255, 0/255, 255} + elseif (button.text == 'NUCLEAR MODE' and easternum > 10) then color = {0,0,0,1} - else - color = {1,1,1,1} end local mx, my = love.mouse.getPosition() - mx = mx - my = my local mx = mx * DIFFERENCE_X local my = my * DIFFERENCE_Y local hot = (mx > ev_bx and mx < ev_bx + ev_button_width and my > ev_by and my < ev_by + ev_BUTTON_HEIGHT) and i @@ -121,26 +118,26 @@ function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds end --print(love.keyboard.mouseisReleased) - button.now = love.keyboard.mouseisReleased - if location == "android" then - button.now = love.mouse.isDown(1) - end + button.now = love.keyboard.mouseisReleased + if location == "android" then + button.now = love.mouse.isDown(1) + end if button.now and hot == i then love.keyboard.mouseisReleased = false love.graphics.setColor(0,0,0,1) love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT) - sounds['wallhit']:play() - if button.skipAnim then - print("skipped anim") - else - for j, buttons in ipairs(buttons) do - buttons.x = 1300 - print("making" .. j) - end - end - button.fn() - break - end + sounds['wallhit']:play() + if button.skipAnim then + print("skipped anim") + else + for j, buttons in ipairs(buttons) do + buttons.x = 1300 + print("making" .. j) + end + end + button.fn() + break + end love.graphics.setColor(unpack(color)) love.graphics.rectangle("fill", ev_bx,ev_by, ev_button_width, ev_BUTTON_HEIGHT) print(ev_bx .. " " .. i) @@ -159,71 +156,68 @@ function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds love.graphics.print("P2 UP: " .. string.upper(p2control.up), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) elseif button.text == '1down' then love.graphics.print("P1 DOWN: " .. string.upper(p1control.down), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) - elseif button.text == '2down' then + elseif button.text == '2down' then love.graphics.print("P2 DOWN: " .. string.upper(p2control.down), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) - elseif button.text == '1special' then + elseif button.text == '1special' then love.graphics.print("P1 SPECIAL: " .. string.upper(p1control.super), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) - elseif button.text == '2special' then + elseif button.text == '2special' then love.graphics.print("P2 SPECIAL: " .. string.upper(p2control.super), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) - elseif button.text == '1ct' then + elseif button.text == '1ct' then love.graphics.print("P1 COUNTER: " .. string.upper(p1control.counter), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) elseif button.text == '2ct' then love.graphics.print("P2 COUNTER: " .. string.upper(p2control.counter), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) else - love.graphics.print(button.text, smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) - + love.graphics.print(button.text, smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) end cursor_y = cursor_y + (ev_BUTTON_HEIGHT + margin) else - if (button.text == '1v1') then - love.graphics.print(playertext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, by+textH*0.5) - elseif button.text == 'snc' then - if (nuckemodactive == 1) then - textW = smallfont:getWidth(synctext) - love.graphics.setColor(1,0,0,1) - love.graphics.print(synctext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) - love.graphics.setColor(1,1,1,1) - love.graphics.print(synctext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) - love.graphics.setColor(0,0,0,1) - else - textW = smallfont:getWidth(synctext) - love.graphics.print(synctext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) - end - elseif (button.text == 'ballCount') then - local tempstr = "Ball Count: " .. maxBalls - textW = smallfont:getWidth(tempstr) - love.graphics.print("Ball Count: " .. maxBalls, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) - elseif (button.text == "Ball Speed: ") then - if (nuckemodactive == 1) then - - love.graphics.setColor(1,0,0,1) - love.graphics.print("shaitan machina", smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) - love.graphics.setColor(1,1,1,1) - love.graphics.print("shaitan machina", smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) - love.graphics.setColor(0,0,0,1) - - else - textW = smallfont:getWidth(button.text .. ballSet) - love.graphics.print(button.text .. ballSet, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) - end - elseif button.text == 'ptw' then - local tempstr = "Points to Win: " .. ptw - textW = smallfont:getWidth(tempstr) - love.graphics.print("Points to Win: " .. ptw, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) - elseif (button.text == 'Silverblade') then - local tempstr = "Difficulty: " .. prtext - textW = smallfont:getWidth(tempstr) - love.graphics.print("Difficulty: " .. prtext, smallfont,ev_bx + ev_button_width*0.5 - textW*0.5 , ev_by+textH*0.5) + if (button.text == '1v1') then + love.graphics.print(playertext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, by+textH*0.5) + elseif button.text == 'snc' then + if (nuckemodactive == 1) then + textW = smallfont:getWidth(synctext) + love.graphics.setColor(1,0,0,1) + love.graphics.print(synctext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) + love.graphics.setColor(1,1,1,1) + love.graphics.print(synctext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) + love.graphics.setColor(0,0,0,1) else - love.graphics.print(button.text, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) + textW = smallfont:getWidth(synctext) + love.graphics.print(synctext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) end - love.graphics.setColor(255, 255, 255, 255) - cursor_y = cursor_y + (ev_BUTTON_HEIGHT + margin) + elseif (button.text == 'ballCount') then + local tempstr = "Ball Count: " .. maxBalls + textW = smallfont:getWidth(tempstr) + love.graphics.print("Ball Count: " .. maxBalls, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) + elseif (button.text == "Ball Speed: ") then + if (nuckemodactive == 1) then + love.graphics.setColor(1,0,0,1) + love.graphics.print("shaitan machina", smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) + love.graphics.setColor(1,1,1,1) + love.graphics.print("shaitan machina", smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) + love.graphics.setColor(0,0,0,1) + else + textW = smallfont:getWidth(button.text .. ballSet) + love.graphics.print(button.text .. ballSet, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) end - end + elseif button.text == 'ptw' then + local tempstr = "Points to Win: " .. ptw + textW = smallfont:getWidth(tempstr) + love.graphics.print("Points to Win: " .. ptw, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) + elseif (button.text == 'Silverblade') then + local tempstr = "Difficulty: " .. prtext + textW = smallfont:getWidth(tempstr) + love.graphics.print("Difficulty: " .. prtext, smallfont,ev_bx + ev_button_width*0.5 - textW*0.5 , ev_by+textH*0.5) + else + love.graphics.print(button.text, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) + end + love.graphics.setColor(255, 255, 255, 255) + cursor_y = cursor_y + (ev_BUTTON_HEIGHT + margin) end + end + end - end +end function mainMenu:addButton(text, fn) if isButtonAnimated == true then print("Button shall be animated!") diff --git a/readme.md b/readme.md index dde1046..12f4ce6 100644 --- a/readme.md +++ b/readme.md @@ -25,6 +25,7 @@ To play on Windows, download a Windows executable from the releases tab!
  • Fixed button animations
  • Fixed demo and editor not working together
  • Removed a lot of clutter
  • +
  • Added LowPOWER mode to improve FPS on low-end devices
  • ToDo: