Skip to content

Commit

Permalink
lots of netplay stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtleP committed May 23, 2016
1 parent 07cde1c commit 193a969
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 21 deletions.
Binary file removed audio/finalboss.ogg
Binary file not shown.
Binary file modified audio/tableft.ogg
Binary file not shown.
Binary file modified audio/tabright.ogg
Binary file not shown.
8 changes: 0 additions & 8 deletions classes/raccoon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,5 @@ function raccoon:die()
objects["player"][1]:addMaxHealth()
end

bossSong = nil

collectgarbage()
collectgarbage()

finalBossSong = love.audio.newSource("audio/finalboss.ogg", "static")
finalBossSong:setLooping(true)

self.remove = true
end
4 changes: 4 additions & 0 deletions libraries/3ds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function love.graphics.set3D(enable3D)
assert(enable3D and type(enable3D) == "boolean", "Boolean expected: got " .. type(depthValue))
end

function love.system.getWifiStrength()
return 3
end

local olddraw = love.graphics.draw
function love.graphics.draw(...)
local args = {...}
Expand Down
1 change: 1 addition & 0 deletions libraries/character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ function loadCharacters()
local characters =
{
"astro",
"becky",
"furious",
"gabe",
"hugo",
Expand Down
15 changes: 9 additions & 6 deletions libraries/keyboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ keyboard = class("keyboard")
local keys =
{
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "BS",
"q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "RT", "",
"a", "s", "d", "f", "g", "h", "j", "k", "l", "'", "=", "/",
"q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "RT","",
"a", "s", "d", "f", "g", "h", "j", "k", "l", "'", "=", "SP",
"z", "x", "c", "v", "b", "n", "m", ",", ".", "?", "!", "ST",
}

Expand Down Expand Up @@ -87,7 +87,7 @@ function keyboard:draw()
love.graphics.translate(40, 240)

for x = 1, 26 do
love.graphics.line(self.x + 5 + (x - 1) * 12, self.y + mainFont:getHeight(), self.x + 10 + (x - 1) * 12, self.y + mainFont:getHeight())
love.graphics.line(self.x + 5 + (x - 1) * 12, self.y + mainFont:getHeight() + 2, self.x + 10 + (x - 1) * 12, self.y + mainFont:getHeight() + 2)
end

love.graphics.pop()
Expand Down Expand Up @@ -127,6 +127,9 @@ function keyboard:mousepressed(x, y, button)
end
self:clear()
return
elseif v.text == "SP" then
self.text = self.text .. " "
return
end

if #self.text < self.maxChars then
Expand All @@ -152,7 +155,7 @@ function keyboardkey:init(x, y, t)
self.shifted = false
self.specialKey = false

if t == "BS" or t == "ST" or t == "RT" then
if t == "BS" or t == "ST" or t == "RT" or t == "SP" then
self.specialKey = true
end

Expand All @@ -177,13 +180,13 @@ function keyboardkey:draw(fade)
end

if self.pressed then
love.graphics.setColor(unpack(util.colorFade(self.fadeTimer, 1, {255, 0, 0}, {255, 255, 255})))
love.graphics.setColor(unpack(util.colorFade(self.fadeTimer, 1, {255, 0, 0, 255 * fade}, {255, 255, 255, 255 * fade})))
end

love.graphics.print(self.text, (self.x + self.width / 2) - mainFont:getWidth(self.text) / 2, (self.y + self.height / 2) - mainFont:getHeight() / 2)

if self.pressed then
love.graphics.setColor(255, 255, 255, 255)
love.graphics.setColor(255, 255, 255, 255 * fade)
end
end

Expand Down
9 changes: 3 additions & 6 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ require 'states.netplay'
require 'netplay.lobby'
require 'netplay.client'

clientSocket = require 'socket'.udp()

if _EMULATEHOMEBREW then
clientSocket:settimeout(0)
end

io.stdout:setvbuf("no")

--[[
Expand Down Expand Up @@ -201,6 +195,9 @@ function love.load()
keyboardCloseSound = love.audio.newSource("audio/close.ogg", "static")
shieldSound = love.audio.newSource("audio/shield.ogg")
toggleSound = love.audio.newSource("audio/tick.ogg")
blipSound = love.audio.newSource("audio/blip.ogg")
hurtSound = {}
for k = 1, 3 do
Expand Down
4 changes: 4 additions & 0 deletions states/game.lua
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ function gameKeyPressed(key)
end
end

if key == "y" then
objects["player"][1]:setPowerup("shield")
end

if paused then
gamePauseMenu:keyPressed(key)
return
Expand Down
2 changes: 1 addition & 1 deletion states/title.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function titleToggleOnline()
onlineMenu = not onlineMenu

if onlineMenu then
titleOptions[1] = {"Online Game", function() util.changeState("netplay") end}
titleOptions[1] = {"Online Game", function() if love.system.getWifiStrength() > 0 then util.changeState("netplay") end end}
else
titleOptions[1] = {"New Game", function() util.changeState("charSelect") end}
end
Expand Down

0 comments on commit 193a969

Please sign in to comment.