Quellcode durchsuchen

Fixed explosions

tags/0.9
Madiwka3 vor 3 Jahren
Ursprung
Commit
81fdc63ab0
5 geänderte Dateien mit 143 neuen und 130 gelöschten Zeilen
  1. +0
    -0
      config.lua
  2. +31
    -9
      main.lua
  3. +84
    -93
      mainMenu.lua
  4. +1
    -0
      readme.md
  5. +27
    -28
      src/baseGame.lua

+ 0
- 0
config.lua Datei anzeigen


+ 31
- 9
main.lua Datei anzeigen

@@ -1,7 +1,10 @@
--CALLING OTHER LUA FILES

<<<<<<< HEAD
love.filesystem.setIdentity( "pong" )
love.filesystem.createDirectory( "a" )
=======
>>>>>>> 66f507d752eff25dc46468da097e4d08624fced6
require "src/dependencies"


@@ -19,7 +22,7 @@ doubleclick1 = false
doubleclick2 = false
hold1 = false
hold2 = false
debug = false
debug = true
paused = false
androidButtons = {}
pauseButtons = {}
@@ -29,8 +32,11 @@ showTouchControls = false


--0.9 VARIABLES
globalMessage = "none"
globalAnimation = "none"
globalMessageTime = 0
isButtonAnimated = false

lowcpu = false
wallsLoadError = false
background = love.graphics.newImage('img/background.jpg')
backgroundScroll = 0
@@ -1024,10 +1030,26 @@ function speedControl()
end
end
checking = 0
local countinglowcpu = 0
function love.update(dt)
--checking = checking + 1
--print(checking)
--print("IMPORTANT!!!!!" .. globalState .. gameState)
if globalMessage ~= "none" then
globalMessageTime = globalMessageTime + dt
if globalMessageTime > 10 then
globalMessage = "none"
end
end
if not lowcpu then
if (love.timer.getFPS() < 50 and gameState ~= "animation") then
countinglowcpu = countinglowcpu + 1
if countinglowcpu > 30 then
lowcpu = true
globalMessage = "[color=#00ff00][bounce]Low-end mode enabled[/bounce][/color]"
end
end
end
for i, explosion in ipairs(explosions) do
explosion:update(dt)
end
@@ -1043,7 +1065,6 @@ function love.update(dt)
end
if globalState == "base" and not paused then
basegame(dt)
end
if globalState == "menu" then
debugCheck(dt)
@@ -1055,7 +1076,6 @@ function love.update(dt)
musicController('norm', 1)
end
if globalState == "nettest" then
--print("Confcode: " .. confirmation)
if confirmation == "N" then
@@ -1863,13 +1883,9 @@ function love.draw(dt)
for i, touch in ipairs(touches) do
love.graphics.printf(touch.x, 0, VIRTUAL_HEIGHT / 2, VIRTUAL_WIDTH, "center")
end
if doubleclick1 then
TEXT = "DOUBLECLICK1"
elseif doubleclick2 then TEXT = "DOUBLECLICK2"
else TEXT = "NO"
end
end
end
showMessage()
if wallsLoadError then
love.graphics.setColor(1,0,0,1)
love.graphics.printf("Error loading map!", 0,0,VIRTUAL_WIDTH, "left")
@@ -2496,7 +2512,13 @@ end
end
return false
end
function showMessage()
print (globalMessage)
if globalMessage ~= "none" then
love.graphics.printf("Low CPU mode active", 0, VIRTUAL_WIDTH/2, VIRTUAL_HEIGHT/2, "center")
end

end
function resetButtonX(arr)
for i, buttons in ipairs(arr) do
buttons.x = 1300


+ 84
- 93
mainMenu.lua Datei anzeigen

@@ -1,7 +1,7 @@
mainMenu = Class{}
function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds, location)
if (gameState == 'editor')
then
if (gameState == 'editor')
then
ev_button_width = VIRTUAL_WIDTH * (1/72)
ev_BUTTON_HEIGHT = VIRTUAL_WIDTH * (1/72)
local margin = 16
@@ -79,40 +79,34 @@ 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.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 +115,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 +153,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!")


+ 1
- 0
readme.md Datei anzeigen

@@ -25,6 +25,7 @@ To play on Windows, download a Windows executable from the releases tab!
<li>Fixed button animations</li>
<li>Fixed demo and editor not working together</li>
<li>Removed a lot of clutter</li>
<li>Added LowPOWER mode to improve FPS on low-end devices</li>
</ul>
ToDo:
<ul>


+ 27
- 28
src/baseGame.lua Datei anzeigen

@@ -641,7 +641,11 @@ function normalDraw()
love.graphics.clear(1, 1, 1, 1)
else
love.graphics.clear(40 / 255, 40 / 255, 40 / 255, 1)
love.graphics.draw(background, 0, -backgroundScroll)
if (lowcpu) then
--love.graphics.draw(background, 0,0)
else
--love.graphics.draw(background, 0,-backgroundScroll)
end
end
if gameState == "assign" then
love.graphics.clear(50 / 255, 50 / 255, 50 / 255, 255)
@@ -706,6 +710,7 @@ function practiceDraw()
love.graphics.print(tostring(math.floor(player1score)), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 12)
end
function menuDraw()
love.graphics.clear(30/255,30/255,30/255,1)
love.graphics.setColor(1, 1, 1, 1)
love.graphics.printf(TEXT, 0, 20, VIRTUAL_WIDTH, "center")
love.graphics.setFont(smallfont)
@@ -715,8 +720,7 @@ function menuDraw()
love.graphics.rectangle("fill", VIRTUAL_WIDTH * 0.5, 0, 10, VIRTUAL_HEIGHT * 0.3)
love.graphics.rectangle("fill", VIRTUAL_WIDTH * 0.5, VIRTUAL_HEIGHT * 0.7, 10, VIRTUAL_HEIGHT * 0.3)
love.graphics.setColor(1, 1, 1, 1)
end
if MAP_TYPE == 2 then
elseif MAP_TYPE == 2 then
for i, wall in ipairs(walls) do
love.graphics.setColor(1, 1, 1, 1)
love.graphics.rectangle("fill", wall.wallx, wall.wally, 10, wall.wallheight)
@@ -734,28 +738,22 @@ function menuDraw()
love.graphics.setFont(smallfont)
love.graphics.printf("The green zones are for moving up and down, double tap the red zone for special attack or to start the serve.", 10, 150, VIRTUAL_WIDTH, "center")
love.graphics.printf("Swipe from red to green for stopping time", 10, 450, VIRTUAL_WIDTH, "center")
end
if gameState == "windowsettings" then
elseif gameState == "windowsettings" then
mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, settings, sounds, "right")
love.keyboard.mouseisReleased = false
end
if gameState == "editor" then
elseif gameState == "editor" then
mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, editorpicks, sounds, "right")
love.keyboard.mouseisReleased = false
end
if gameState == "speedSettings" then
elseif gameState == "speedSettings" then
mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, speedParameters, sounds, "middle")
love.keyboard.mouseisReleased = false
end
if gameState == "controlSettings" then
elseif gameState == "controlSettings" then
mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, controlSettings, sounds, "control")
love.keyboard.mouseisReleased = false
end
if gameState == "gameMode" then
elseif gameState == "gameMode" then
mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, modeSelectorButtons, sounds, "middle")
love.keyboard.mouseisReleased = false
end
if gameState == "chooseIP" then
elseif gameState == "chooseIP" then
IPselect = {}
if isAndroid then
table.insert(
@@ -839,24 +837,19 @@ function menuDraw()
love.graphics.printf(IPnew, 0, VIRTUAL_HEIGHT / 4, VIRTUAL_WIDTH, "center")
end
love.keyboard.mouseisReleased = false
end
if gameState == "menu" then
elseif gameState == "menu" then
mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds, "middle")
love.keyboard.mouseisReleased = false
end
if gameState == "difficulty" then
elseif gameState == "difficulty" then
mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, difbuttons, sounds, "middle")
love.keyboard.mouseisReleased = false
end
if gameState == "multiMode" then
elseif gameState == "multiMode" then
mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, playerCountButtons, sounds, "middle")
love.keyboard.mouseisReleased = false
end
if gameState == "prdiff" then
elseif gameState == "prdiff" then
mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, pracdiff, sounds, "playercount")
love.keyboard.mouseisReleased = false
end
if gameState == 'start' then
elseif gameState == 'start' then
love.graphics.push()
love.graphics.translate(VIRTUAL_WIDTH * 0.4, VIRTUAL_HEIGHT * 0.5)
love.graphics.rotate(rotation)
@@ -872,8 +865,13 @@ function menuDraw()
end
end
function baseDraw()
love.graphics.clear(30/255,30/255,30/255,1)
love.graphics.setColor(255, 255, 255, 1)
love.graphics.draw(background, 0,-backgroundScroll)
if (lowcpu) then
-- love.graphics.draw(background, 0,0)
else
--love.graphics.draw(background, 0,-backgroundScroll)
end

if shakeDuration > t then
@@ -954,7 +952,8 @@ function renderEditor()
end

function intro()
love.graphics.draw(background, 0,0)
--love.graphics.draw(background, 0,0)

love.graphics.setColor(255, 255, 255, light / 255)
love.graphics.draw(image, 0, 0)
end
@@ -1676,4 +1675,4 @@ function shipManager(dt)
end
end
end
]]
]]

Laden…
Abbrechen
Speichern