Skip to content

Commit b1eae3d

Browse files
authored
Integrate nibbl-z's editor changes and tweaks + music
music and more editor tools
2 parents 39aac80 + 00e7b26 commit b1eae3d

19 files changed

+339
-20
lines changed

audio/editor.flp

363 KB
Binary file not shown.

audio/editor.mp3

1.32 MB
Binary file not shown.

audio/main.flp

216 KB
Binary file not shown.

audio/main.mp3

1.03 MB
Binary file not shown.

audio/menu.flp

536 KB
Binary file not shown.

audio/menu.mp3

1.2 MB
Binary file not shown.

editor.lua

+286-20
Large diffs are not rendered by default.

images/MoveButton.png

1.45 KB
Loading

images/PaintButton.png

1.68 KB
Loading

images/ScaleButton.png

1.24 KB
Loading

images/brightness.png

4.21 KB
Loading

images/hue.png

1.2 KB
Loading

images/saturation.png

6.28 KB
Loading

images/slider.png

225 Bytes
Loading

main.lua

+24
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ local editor = require("editor")
77
local utils = require("modules.utils")
88
local fonts = require("modules.font")
99
local pause = require('modules.pause')
10+
local audio = require("modules.audio")
1011
local win = require('modules.win')
1112

1213
local inMenu = true
@@ -62,6 +63,8 @@ local menuButtons = {
6263
local data = love.filesystem.load(lvl)()
6364
player:load(world)
6465
level:loadLevel(data)
66+
audio.Menu:stop()
67+
audio.Ingame:play()
6568
end
6669
end
6770
},
@@ -73,6 +76,8 @@ local menuButtons = {
7376
local data = love.filesystem.load(lvl)()
7477
if editor.IsLoaded == false then editor:Load() end
7578
editor:LoadLevel(lvl, data)
79+
audio.Menu:stop()
80+
audio.Editor:play()
7681
end
7782
end
7883
},
@@ -123,14 +128,26 @@ local menuButtons = {
123128

124129
function love.load()
125130
if sprite.IsLoaded == false then sprite:Init() end
131+
if audio.IsLoaded == false then audio:Init() end
126132
if fonts.IsLoaded == false then fonts:Load() end
127133
if pause.IsLoaded == false then pause:Load() end
128134
if win.IsLoaded == false then win:Load() end
129135
if editor.InEditor == true then editor:Load() return end
130136

131137
world:setCallbacks(beginContact, endContact)
132138
level:init(world)
139+
140+
audio.Ingame:setVolume(0.5)
141+
audio.Ingame:setLooping(true)
142+
143+
audio.Menu:setVolume(0.5)
144+
audio.Menu:setLooping(true)
133145

146+
audio.Editor:setVolume(0.5)
147+
audio.Editor:setLooping(true)
148+
149+
audio.Menu:play()
150+
134151
love.filesystem.setIdentity("blue-goose-platformer")
135152
end
136153

@@ -191,6 +208,10 @@ function love.mousereleased(x, y)
191208
if editor.InEditor == true then editor:MouseReleased(x, y) return end
192209
end
193210

211+
function love.mousemoved(x, y, dx, dy)
212+
if editor.InEditor == true then editor:MouseMoved(x,y, dx, dy) return end
213+
end
214+
194215
function beginContact(a, b)
195216
if a:getUserData() == "Player" then
196217
if b:getUserData() == "Spike" and player.IsWater == false then
@@ -206,6 +227,9 @@ end
206227
function endContact() end
207228

208229
function main:Exit()
230+
audio.Ingame:stop()
231+
audio.Menu:play()
232+
209233
inMenu = true
210234
end
211235

modules/audio.lua

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
local audio = {
2+
["Ingame"] = {"audio/main.mp3", "stream"},
3+
["Menu"] = {"audio/menu.mp3", "stream"},
4+
["Editor"] = {"audio/editor.mp3", "stream"}
5+
}
6+
audio.IsLoaded = false
7+
8+
function audio:Init()
9+
for index, sound in pairs(self) do
10+
if type(sound) == "table" then
11+
self[index] = love.audio.newSource(sound[1], sound[2])
12+
end
13+
end
14+
self.IsLoaded = true
15+
end
16+
17+
return audio

modules/pause.lua

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pause.IsLoaded = false
55
local Sprites = require("modules.sprite")
66
local utils = require("modules.utils")
77
local level = require("modules.level")
8+
local audio = require("modules.audio")
89

910
function pause:Load()
1011
main = require('main')
@@ -34,6 +35,8 @@ local buttons = {
3435
if choice == 2 then editor.buttons.Save.Callback() end
3536

3637
editor.InEditor = false
38+
audio.Editor:stop()
39+
audio.Menu:play()
3740
else
3841
main:Exit()
3942
level:Unload()

modules/player.lua

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ local level = require("modules.level")
66
local win = require("modules.win")
77
local movementDirections = {a = {-1,0}, d = {1,0}, space = {0,-1}}
88
local respawning = false
9+
10+
911
player.MovementData = {
1012
["Speed"] = 9000,
1113
["MaxSpeed"] = 400,

modules/sprite.lua

+7
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,18 @@ local sprite = {
1010
["Sponge"] = "images/Sponge.jpg",
1111
["SpongeButton"] = "images/SpongeButton.png",
1212
["WinButton"] = "images/WinButton.png",
13+
["MoveButton"] = "images/MoveButton.png",
14+
["ScaleButton"] = "images/ScaleButton.png",
15+
["PaintButton"] = "images/PaintButton.png",
1316
["EndFlag"] = "images/EndFlag.png",
1417
["SaveButton"] = "images/SaveButton.png",
1518
["MainMenu"] = "images/MainMenu.png",
1619
["PauseMenu"] = "images/PauseMenu.png",
1720
["DeleteButton"] = "images/DeleteButton.png",
21+
["Hue"] = "images/hue.png",
22+
["Saturation"] = "images/saturation.png",
23+
["Brightness"] = "images/brightness.png",
24+
["Slider"] = "images/slider.png",
1825
["WinScreen"] = "images/WinScreen.png"
1926
}
2027
sprite.IsLoaded = false

0 commit comments

Comments
 (0)