Skip to content

Commit

Permalink
Merge branch 'release/v0.6.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
nczempin committed May 15, 2014
2 parents e12b0a8 + 4b3fc98 commit 0ef4463
Show file tree
Hide file tree
Showing 17 changed files with 205 additions and 88 deletions.
28 changes: 28 additions & 0 deletions love2d/data/map/tutorial1.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
map = {
width = 11,
height = 11,
baseX = 3,
baseY = 5,
spawn = {
{
enemyType = 1,
towerType = 7,
x = 10,
y = 10,
delay = 1,
count = 10
},
},
tower = {
{
towerType = 8,
x = 1,
y = 3,
},

},
random = {
},
mass = 10,
energy = 999
}
22 changes: 17 additions & 5 deletions love2d/data/menu/missions1.ini
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
missions = {
{
map = "mission1",
map = "tutorial1",
x = 300,
y = 130,
title = "Tutorial 1",
description = "Tutorial 1.\n\nMapsize: Small",
briefingText = "These aliens seem to be carrying explosives that they want to carry into our main generator. Prevent them from doing so by building laser towers!",
button = "T",
},
{
map = "mission1",
x = 370,
y = 190,
title = "Mission 1",
description = "Defeat 3 Wave lines\nwith 2 different enemies.\n\nMapsize: Small",
button = "1"
},
{
map = "mission2",
x = 370,
y = 190,
x = 410,
y = 260,
needMission = "mission1",
title = "Mission 2",
description = "Defeat 3 Wave lines\nwith 2 different enemies.\n\nMapsize: Medium",
button = "2",
},
{
map = "mission3",
x = 420,
y = 270,
x = 410,
y = 320,
needMission = "mission2",
title = "Mission 3",
description = "Defeat 4 Wave lines\nwith 2 different enemies.\n\nMapsize: Small",
button = "3",
},
}
7 changes: 6 additions & 1 deletion love2d/enemy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ function love.turris.newEnemy(enemyType, map, x, y, baseX, baseY)
o.update = function(dt)
o.ai.update(dt)
end

o.getBaseDamage = function()
return o.enemyType.baseDamage
end

o.updateVelocity = function(dirX, dirY)
o.xVel = dirX * o.speed
Expand Down Expand Up @@ -137,7 +141,8 @@ function love.turris.updateEnemies(o, dt)
-- TODO: destroy base (explosion!)
-- TODO: after explosions have finished -> transition to game over state
love.sounds.playSound("sounds/einschlag.mp3")
turMap.data[o.baseX][o.baseY].addHealth(-5) --TODO: Each creep does different damage to the base
local damage = e.getBaseDamage()
turMap.data[o.baseX][o.baseY].addHealth(-damage) --TODO: Each creep does different damage to the base, see issue #87
turGame.effectTimer = 0

gameOverEffect = 0
Expand Down
9 changes: 9 additions & 0 deletions love2d/enemyType.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ function love.turris.newEnemyType(id, sheet, maxHealth, baseSpeed)
o.sheet = sheet
o.maxHealth = maxHealth
o.baseSpeed = baseSpeed

if o.id==1 then
o.baseDamage = 12
elseif o.id==2 then
o.baseDamage = 30
else
print ("warning: unknown creep id: ", o.id)
end

o.playDeathSound = function()
if o.id == 1 then
love.sounds.playSound("sounds/phaser_rotating.mp3")
Expand Down
14 changes: 8 additions & 6 deletions love2d/game.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ function love.turris.newGame()
massTower.setMassGeneration(5)

o.map.init()

o.player.setMass(20)
o.player.setEnergy(o.map.energy or 20)
o.player.setMass(o.map.mass or 20)

o.imgLaser = G.newImage("gfx/laserbeam_blue.png")
o.imgLaser:setWrap("repeat", "repeat")
Expand Down Expand Up @@ -121,6 +121,8 @@ function love.turris.newGame()
o.layerGameOver = require("layer/gameover")
o.layerWin = require("layer/win")
o.layerCountdown = require("layer/countdown")
o.layerMissionBriefing = require("layer/missionBriefing")
o.update(0.001)
end

-- gameplay
Expand Down Expand Up @@ -338,9 +340,9 @@ function love.turris.newGame()
if energyCost <= o.player.energy then
local e = t.determineTarget(o.enemies, distance_euclid)
t.target = e --TODO just do that inside tower module

if e then
laserVolume = laserVolume + 0.25
laserVolume = laserVolume + 0.45
o.player.addEnergy(-energyCost)
if e.health > 0.0 then
e.health = e.health - t.type.damage*dt
Expand All @@ -361,8 +363,8 @@ function love.turris.newGame()

-- test
--TODO: -> player.update
-- o.player.addMass(dt*2)
-- o.player.addEnergy(dt*5)
-- o.player.addMass(dt*2)
-- o.player.addEnergy(dt*5)
end
--------------------- drawing starts here

Expand Down
1 change: 0 additions & 1 deletion love2d/layer/gameover.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ o.draw = function()
G.printf("Game Over!", 0, 240, W.getWidth(), "center")
G.setColor(255, 255, 255, 127)
G.printf("Click to go to the main menu", 0, 320, W.getWidth(), "center")
--love.setgamestate(4)
end
end

Expand Down
30 changes: 30 additions & 0 deletions love2d/layer/missionBriefing.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
local o = {}

o.text = ""

o.guiMenu = love.gui.newGui()
o.init = function(mission)
o.text = mission.briefingText or mission.description
o.btnOkay = o.guiMenu.newButton(W.getWidth()/2, W.getHeight()*0.75, 66, 42, "OK")
o.mission = mission
end

o.update = function(dt)
o.guiMenu.update(dt)
if o.btnOkay.isHit() then
love.sounds.playSound("sounds/button_pressed.wav")
love.setgamestate(14, o.mission)
o.guiMenu.flushMouse()
end
end

o.draw = function()
G.setFont(FONT)
G.setColor(255, 127, 0, 127)
local scale = 1---(o.countdown-o.oldcountdown)/2
G.printf(o.text, 0, 240, W.getWidth(), "center",0,scale,scale)
G.setColor(255, 255, 255, 127)
o.guiMenu.draw()
end

return o
3 changes: 1 addition & 2 deletions love2d/layer/win.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ o.draw = function()
G.printf("Stage clear!", 0, 240, W.getWidth(), "center")
G.setColor(255, 255, 255, 127)
G.printf("Click to go to the main menu", 0, 320, W.getWidth(), "center")
--love.setgamestate(4)
end
end
end

return o
25 changes: 19 additions & 6 deletions love2d/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ require "util"
-- states
stateMainMenu = require("state/main_menu")
stateIntro = require("state/intro")
stateOutro = require("state/outro")
stateWorldMenu = require("state/world_menu")
stateCredits = require("state/credits")
stateSettings = require("state/settings_menu")
Expand Down Expand Up @@ -49,14 +50,13 @@ function love.load()
S = love.sounds
FS = love.filesystem
loadOptions()
--saveOptions() --TODO temporarily added for testing
FONT = G.newFont(32)
FONT_LARGE = G.newFont(64)
FONT_SMALL = G.newFont(24)

currentgamestate = 12 -- TODO: make "skip intro" an option

stateMainMenu.setVersion("v0.6.4")
stateMainMenu.setVersion("v0.6.5")
end

function love.getgamestate()
Expand Down Expand Up @@ -86,18 +86,22 @@ function love.setgamestate(newgamestate, option)
love.sounds.playBackground("sounds/music/Chiptune_2step_mp3.mp3", "menu")
elseif newgamestate == 1 then
turGame.layerGameOver.effectTimer = 0
--love.sounds.playBackground("sounds/music/turres_music_1.mp3", "menu")
love.sounds.playBackground("sounds/music/turres_music_1.mp3", "menu")
love.sounds.loopSound("sounds/weapons/laser_loop.ogg")
love.sounds.setSoundVolume(0,"sounds/weapons/laser_loop.ogg")

elseif newgamestate == 4 or newgamestate == 13 then
elseif newgamestate == 4 then
turGame.layerGameOver.effectTimer = 0
love.sounds.playBackground("sounds/music/game_over_music.mp3", "game")
elseif newgamestate == 13 then
turGame.layerGameOver.effectTimer = 0
love.sounds.playBackground("sounds/music/level_up.mp3", "game")
elseif newgamestate == 11 then
stateWorldMenu.init()
elseif newgamestate == 14 then
love.turris.reinit(option)
turGame.layerCountdown.init()
elseif newgamestate == 16 then
love.turris.reinit(option.map)
turGame.layerMissionBriefing.init(option)
end

if currentgamestate == 5 then
Expand Down Expand Up @@ -135,6 +139,10 @@ function love.update(dt)
turGame.layerWin.update(dt)
elseif (currentgamestate == 14)then
turGame.layerCountdown.update(dt)
elseif (currentgamestate == 15)then
stateOutro.update(dt)
elseif (currentgamestate == 16)then
turGame.layerMissionBriefing.update(dt)
end
TEsound.cleanup() --Important, Clears all the channels in TEsound
end
Expand Down Expand Up @@ -178,6 +186,11 @@ function love.draw()
elseif currentgamestate == 14 then --countdown
turGame.draw()
turGame.layerCountdown.draw()
elseif currentgamestate == 15 then --outro
stateOutro.draw()
elseif (currentgamestate == 16)then
turGame.draw()
turGame.layerMissionBriefing.draw()
end

if stateSettingsVideoShaders.optionScanlines then
Expand Down
2 changes: 2 additions & 0 deletions love2d/map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ function love.turris.newMap(path)
o.spawn = map.spawn
o.tower = map.tower
o.random = map.random
o.energy = map.energy
o.mass = map.mass
if map.ground then
o.groundColor = map.ground.color
o.groundImg = map.ground.img or "ground01"
Expand Down
4 changes: 2 additions & 2 deletions love2d/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ function love.turris.newPlayer()

local o = {}

o.mass = 20
o.energy = 20
o.mass = 99999
o.energy = 99999

o.addMass = function(mass)
o.mass = o.mass + mass
Expand Down
Binary file added love2d/sounds/music/level_up.mp3
Binary file not shown.
Loading

0 comments on commit 0ef4463

Please sign in to comment.