aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author1029chris <1029chris@gmail.com>2016-05-01 19:45:37 -0700
committer1029chris <1029chris@gmail.com>2016-05-01 19:45:37 -0700
commit635e60270978e22e2192be943c393d1ba516f58c (patch)
treed163e6e49332f0eb263bd3d9aa40da6fdeea7932
parent9cbb6fa487c4e87085c1e32269ce671e99760b44 (diff)
Added difficulty settings
-rw-r--r--assets.lua4
-rw-r--r--assets/rumble_loop.oggbin0 -> 13061 bytes
-rw-r--r--dialogue.lua2
-rw-r--r--main.lua2
-rw-r--r--settings.lua50
-rw-r--r--var.lua26
-rw-r--r--virus1.lua38
7 files changed, 107 insertions, 15 deletions
diff --git a/assets.lua b/assets.lua
index e0be34e..39efe38 100644
--- a/assets.lua
+++ b/assets.lua
@@ -110,8 +110,10 @@ function loadAssets()
turret2 = love.graphics.newImage("assets/virus1_turret2.png"),
turret2Held = love.graphics.newImage("assets/virus1_turret2_held.png"),
shipFront = love.graphics.newImage("assets/virus1_ship_front.png"),
- shipBack = love.graphics.newImage("assets/virus1_ship_back.png")
+ shipBack = love.graphics.newImage("assets/virus1_ship_back.png"),
+ rumbleLoop = love.audio.newSource("assets/rumble_loop.ogg")
}
+ v1.rumbleLoop:setLooping(true)
v1.msgs = {}
v1.c = {}
v1.c.chat = {}
diff --git a/assets/rumble_loop.ogg b/assets/rumble_loop.ogg
new file mode 100644
index 0000000..a60631b
--- /dev/null
+++ b/assets/rumble_loop.ogg
Binary files differ
diff --git a/dialogue.lua b/dialogue.lua
index a24c4e9..db0b4e5 100644
--- a/dialogue.lua
+++ b/dialogue.lua
@@ -55,5 +55,5 @@ function loadDia()
v1.msgs[43] = "OH GOD IT HURTS! OW OW OW!!! YOU JUST GOT LUCKY!!! NO, YOU CHEATED!!! CHEATER!!!"
v1.msgs[44] = "WHATEVER YOU DID, IT ISN'T FAIR!!! YOU DICKHEAD!!! AAAHH!!!"
v1.msgs[45] = "THIS ISN'T OVER!!! I WILL STILL DESTORY YOU!!! ONE DAY!!! WATCH YOUR BACK!!!"
- v1.msgs[46] = "AAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHH!!!!!!!!"
+ v1.msgs[46] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!"
end
diff --git a/main.lua b/main.lua
index 4e87380..a20d568 100644
--- a/main.lua
+++ b/main.lua
@@ -81,7 +81,7 @@ function love.keyreleased(key)
end
if key == "f10" then
v1.c.health = v1.c.health - 5
- v1.spm = v1.spm + 0.25*(sys.h/1080)
+ v1.spm = v1.spm + 0.5*(sys.h/1080)
end
end
function love.mousereleased(x, y, button)
diff --git a/settings.lua b/settings.lua
index 84727f3..e4060ce 100644
--- a/settings.lua
+++ b/settings.lua
@@ -20,6 +20,19 @@ function drawSettings()
elseif st[6].hl == true then
desktop.bg.current = desktop.bg.coast
end
+ if std[1].hl == true then
+ di = 0.4
+ elseif std[2].hl == true then
+ di = 0.7
+ elseif std[3].hl == true then
+ di = 1
+ elseif std[4].hl == true then
+ di = 1.3
+ elseif std[5].hl == true then
+ di = 1.6
+ elseif std[6].hl == true then
+ di = 3
+ end
love.graphics.stencil(stencilBg, "replace", 1)
love.graphics.setStencilTest("greater", 0)
if desktop.bg.current ~= 0 then
@@ -33,6 +46,21 @@ function drawSettings()
for i=1,6 do
drawBgSel(i)
end
+ drawDownBox(8, 305, 384/2-4, 25, 2)
+ love.graphics.setColor(colors.font.dark)
+ love.graphics.print("Difficulty", 14, 313)
+ drawDownBox(8, 340, 384/2-4, 198, 2)
+ love.graphics.setColor(255,255,255)
+ love.graphics.rectangle("fill", 9, 341, 384/2-6, 196)
+ for i=1,6 do
+ drawDiSel(i)
+ end
+ drawDownBox(8+384/2+4, 305, 384/2-4, 25, 2)
+ love.graphics.setColor(colors.font.dark)
+ love.graphics.print("Resolution", 14+384/2+4, 313)
+ drawDownBox(8+384/2+4, 340, 384/2-4, 198, 2)
+ love.graphics.setColor(255,255,255)
+ love.graphics.rectangle("fill", 9+384/2+4, 341, 384/2-2-4, 196)
end
function stencilBg()
love.graphics.rectangle("fill", 88-64, 44+32, 152, 120)
@@ -48,6 +76,17 @@ function drawBgSel(i)
love.graphics.print(st[i].title, 268, 78+(20*(i-1)))
end
end
+function drawDiSel(i)
+ if std[i].hl == false then
+ love.graphics.setColor(colors.font.dark)
+ love.graphics.print(std[i].title, 13, 348+(20*(i-1)))
+ elseif std[i].hl == true then
+ love.graphics.setColor(0,0,120)
+ love.graphics.rectangle("fill", 9, 341+(20*(i-1)), 384/2-6, 20)
+ love.graphics.setColor(colors.font.light)
+ love.graphics.print(std[i].title, 13, 348+(20*(i-1)))
+ end
+end
function updateSettings()
for i=1,6 do
if (layer[1] == 6 and win[6].hover == true and sys.mouse.p.p == true and sys.mouse.drag == false and
@@ -60,4 +99,15 @@ function updateSettings()
win[6].update = true
end
end
+ for i=1,6 do
+ if (layer[1] == 6 and win[6].hover == true and sys.mouse.p.p == true and sys.mouse.drag == false and
+ sys.mouse.p.x >= win[6].x+13 and sys.mouse.p.x <= win[6].x+13+120 and
+ sys.mouse.p.y >= win[6].y+342+(20*(i-1)) and sys.mouse.y <= win[6].y+342+(20*(i-1))+20) then
+ for i=1,6 do
+ std[i].hl = false
+ end
+ std[i].hl = true
+ win[6].update = true
+ end
+ end
end
diff --git a/var.lua b/var.lua
index 262b3f7..91d6157 100644
--- a/var.lua
+++ b/var.lua
@@ -1,9 +1,9 @@
function loadWin(id, w, h, title, ico, ico16)
win[id] = {}
- win[id].x = math.random(10, 200)
- win[id].y = math.random(10, 200)
win[id].w = w
win[id].h = h
+ win[id].x = math.random(100, sys.w-win[id].w-100)
+ win[id].y = math.random(10, sys.h-win[id].h-100)
win[id].px = win[id].x
win[id].py = win[id].y
win[id].ex = true
@@ -49,6 +49,7 @@ function loadVar()
sys.mouse.drag = false
sys.w = love.graphics.getWidth()
sys.h = love.graphics.getHeight()
+ di = 0.75
panel = {}
panel.thick = 30
panel.x = 0
@@ -150,6 +151,8 @@ function loadVar()
v1.shake = 0
v1.shakex = 0
v1.shakey = 0
+ v1.explodeEndFrame = 1
+ v1.complete = false
expl.deb[1].x = 0
expl.deb[1].y = 0
expl.deb[1].ym = 5
@@ -170,4 +173,23 @@ function loadVar()
expl.deb[3].rm = math.rad(1)
expl.deb.load = false
time = 0
+ std = {}
+ std[1] = {}
+ std[1].title = "Baby"
+ std[1].hl = false
+ std[2] = {}
+ std[2].title = "Easy"
+ std[2].hl = false
+ std[3] = {}
+ std[3].title = "Normal"
+ std[3].hl = true
+ std[4] = {}
+ std[4].title = "Hard"
+ std[4].hl = false
+ std[5] = {}
+ std[5].title = "Insane"
+ std[5].hl = false
+ std[6] = {}
+ std[6].title = "Impossible"
+ std[6].hl = false
end
diff --git a/virus1.lua b/virus1.lua
index 377cdd4..5ee5662 100644
--- a/virus1.lua
+++ b/virus1.lua
@@ -121,6 +121,7 @@ function drawVirusFight1()
v1.shake = (v1.c.chat.msgs-40)*3
v1.shakex = math.random(v1.shake,-v1.shake)
v1.shakey = math.random(v1.shake,-v1.shake)
+ v1.rumbleLoop:setPitch(v1.shake/6)
end
if v1.c.load == false then
v1.c.x = win[2].x+v1.c.monitorspin.x
@@ -133,16 +134,16 @@ function drawVirusFight1()
for i=1,4 do
v1.turret[i].rt = math.atan2((win[4].y+win[4].h/2 - v1.turret[i].y), (win[4].x+win[4].w/2 - v1.turret[i].x))-math.rad(90)
if v1.turret[i].r > v1.turret[i].rt then
- if v1.turret[i].r - math.rad(2*sys.s) < v1.turret[i].rt then
+ if v1.turret[i].r - math.rad((2*sys.s)*di) < v1.turret[i].rt then
v1.turret[i].r = v1.turret[i].rt
else
- v1.turret[i].r = v1.turret[i].r - math.rad(2*sys.s)
+ v1.turret[i].r = v1.turret[i].r - math.rad((2*sys.s)*di)
end
elseif v1.turret[i].r < v1.turret[i].rt then
- if v1.turret[i].r + math.rad(2*sys.s) > v1.turret[i].rt then
+ if v1.turret[i].r + math.rad((2*sys.s)*di) > v1.turret[i].rt then
v1.turret[i].r = v1.turret[i].rt
else
- v1.turret[i].r = v1.turret[i].r + math.rad(2*sys.s)
+ v1.turret[i].r = v1.turret[i].r + math.rad((2*sys.s)*di)
end
end
end
@@ -292,6 +293,8 @@ function drawVirusFight1()
v1.c.chat.char = 0
v1.c.chat.msg = ""
elseif v1.c.chat.msgs == 40 and v1.c.health <= 0 then
+ music.battle1:stop()
+ v1.rumbleLoop:play()
v1.c.chat.msgs = 41
v1.c.chat.char = 0
v1.c.chat.msg = ""
@@ -311,27 +314,27 @@ function drawVirusFight1()
-math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].x
local y = math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].x+148-v1.turret[i].x)
+math.cos(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].y
- addBullet(x,y,v1.turret[i].r+math.rad(90),(6*(0.75+(v1.spm/4)))*(sys.h/1080),"v1",i)
+ addBullet(x,y,v1.turret[i].r+math.rad(90),((6*(0.75+(v1.spm/4)))*(sys.h/1080))*di,"v1",i)
if v1.laserSound:isPlaying() == true then
v1.laserSound:rewind()
else
v1.laserSound:play()
end
v1.turret[i].t = 0
- v1.turret[i].tl = ((math.random(2,5)/v1.spm)*2)*(1080/sys.h)
+ v1.turret[i].tl = (((math.random(2,5)/v1.spm)*2)*(1080/sys.h))/di
elseif v1.c.chat.msgs == 40 and v1.turret[i].t > v1.turret[i].tl and i == 1 then
local x = math.cos(v1.turret[i].r+math.rad(90))*(v1.turret[i].x+148-v1.turret[i].x)
-math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].x
local y = math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].x+148-v1.turret[i].x)
+math.cos(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].y
- addBullet(x,y,v1.turret[i].r+math.rad(90),(10*(0.75+(v1.spm/4)))*(sys.h/1080),"v1",math.random(1,5))
+ addBullet(x,y,v1.turret[i].r+math.rad(90),((8*(0.75+(v1.spm/4)))*(sys.h/1080))*di,"v1",math.random(1,5))
if v1.laserSound:isPlaying() == true then
v1.laserSound:rewind()
else
v1.laserSound:play()
end
v1.turret[i].t = 0
- v1.turret[i].tl = math.random(0.2,1)*(1080/sys.h)
+ v1.turret[i].tl = (math.random(0.2,1,1.5)*(1080/sys.h))/di
elseif v1.turret[i].t < v1.turret[i].tl and v1.turretTimer < 30 then
v1.turret[i].t = v1.turret[i].t+delta
end
@@ -367,7 +370,7 @@ function drawVirusFight1()
-math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].x
local y = math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].x+148-v1.turret[i].x)
+math.cos(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].y
- addBullet(x,y,v1.turret[i].r+math.rad(90),20,"v1",2)
+ addBullet(x,y,v1.turret[i].r+math.rad(90),20*di,"v1",2)
end
if v1.laserSound:isPlaying() == true then
v1.laserSound:rewind()
@@ -382,7 +385,7 @@ function drawVirusFight1()
-math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].x
local y = math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].x+148-v1.turret[i].x)
+math.cos(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].y
- addBullet(x,y,v1.turret[i].r+math.rad(90),20,"v1",v1.abis)
+ addBullet(x,y,v1.turret[i].r+math.rad(90),20*di,"v1",v1.abis)
end
if v1.abis == 5 then
v1.abis = 1
@@ -411,6 +414,9 @@ function drawVirusFight1()
v1.c.sp = v1.c.sp*0.25
end
v1.c.sp = v1.c.sp*sys.s
+ if v1.c.chat.msgs == 36 or v1.c.chat.msgs == 40 then
+ v1.c.sp = v1.c.sp*di
+ end
v1.c.angle = math.atan2((v1.c.yd - v1.c.y), (v1.c.xd - v1.c.x))
v1.c.spx = v1.c.sp * math.cos(v1.c.angle)
v1.c.spy = v1.c.sp * math.sin(v1.c.angle)
@@ -508,6 +514,18 @@ function drawVirusFight1()
end
drawBullets()
drawStart()
+ if v1.c.chat.msgs == 47 then
+ v1.complete = true
+ love.graphics.setColor(255,255,255)
+ love.graphics.draw(expl.pic, expl.frames[v1.explodeEndFrame], v1.c.x-615/2-800, v1.c.y-100+20-700, 0, 7, 7)
+ v1.explodeEndFrame = v1.explodeEndFrame + 1
+ v1.explosionSound:play()
+ v1.rumbleLoop:stop()
+ if v1.explodeEndFrame >= 20 then
+ v1.yes = false
+ scene = 1
+ end
+ end
end
function addBullet(x,y,a,s,t,id)
if t == "av" then