Skip to content

Commit

Permalink
Integrate nibbl-z's editor changes and tweaks + music
Browse files Browse the repository at this point in the history
music and more editor tools
  • Loading branch information
29cmb authored Jul 29, 2024
2 parents 39aac80 + 00e7b26 commit b1eae3d
Show file tree
Hide file tree
Showing 19 changed files with 339 additions and 20 deletions.
Binary file added audio/editor.flp
Binary file not shown.
Binary file added audio/editor.mp3
Binary file not shown.
Binary file added audio/main.flp
Binary file not shown.
Binary file added audio/main.mp3
Binary file not shown.
Binary file added audio/menu.flp
Binary file not shown.
Binary file added audio/menu.mp3
Binary file not shown.
306 changes: 286 additions & 20 deletions editor.lua

Large diffs are not rendered by default.

Binary file added images/MoveButton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/PaintButton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ScaleButton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/brightness.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/hue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/saturation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ local editor = require("editor")
local utils = require("modules.utils")
local fonts = require("modules.font")
local pause = require('modules.pause')
local audio = require("modules.audio")
local win = require('modules.win')

local inMenu = true
Expand Down Expand Up @@ -62,6 +63,8 @@ local menuButtons = {
local data = love.filesystem.load(lvl)()
player:load(world)
level:loadLevel(data)
audio.Menu:stop()
audio.Ingame:play()
end
end
},
Expand All @@ -73,6 +76,8 @@ local menuButtons = {
local data = love.filesystem.load(lvl)()
if editor.IsLoaded == false then editor:Load() end
editor:LoadLevel(lvl, data)
audio.Menu:stop()
audio.Editor:play()
end
end
},
Expand Down Expand Up @@ -123,14 +128,26 @@ local menuButtons = {

function love.load()
if sprite.IsLoaded == false then sprite:Init() end
if audio.IsLoaded == false then audio:Init() end
if fonts.IsLoaded == false then fonts:Load() end
if pause.IsLoaded == false then pause:Load() end
if win.IsLoaded == false then win:Load() end
if editor.InEditor == true then editor:Load() return end

world:setCallbacks(beginContact, endContact)
level:init(world)

audio.Ingame:setVolume(0.5)
audio.Ingame:setLooping(true)

audio.Menu:setVolume(0.5)
audio.Menu:setLooping(true)

audio.Editor:setVolume(0.5)
audio.Editor:setLooping(true)

audio.Menu:play()

love.filesystem.setIdentity("blue-goose-platformer")
end

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

function love.mousemoved(x, y, dx, dy)
if editor.InEditor == true then editor:MouseMoved(x,y, dx, dy) return end
end

function beginContact(a, b)
if a:getUserData() == "Player" then
if b:getUserData() == "Spike" and player.IsWater == false then
Expand All @@ -206,6 +227,9 @@ end
function endContact() end

function main:Exit()
audio.Ingame:stop()
audio.Menu:play()

inMenu = true
end

Expand Down
17 changes: 17 additions & 0 deletions modules/audio.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local audio = {
["Ingame"] = {"audio/main.mp3", "stream"},
["Menu"] = {"audio/menu.mp3", "stream"},
["Editor"] = {"audio/editor.mp3", "stream"}
}
audio.IsLoaded = false

function audio:Init()
for index, sound in pairs(self) do
if type(sound) == "table" then
self[index] = love.audio.newSource(sound[1], sound[2])
end
end
self.IsLoaded = true
end

return audio
3 changes: 3 additions & 0 deletions modules/pause.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pause.IsLoaded = false
local Sprites = require("modules.sprite")
local utils = require("modules.utils")
local level = require("modules.level")
local audio = require("modules.audio")

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

editor.InEditor = false
audio.Editor:stop()
audio.Menu:play()
else
main:Exit()
level:Unload()
Expand Down
2 changes: 2 additions & 0 deletions modules/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ local level = require("modules.level")
local win = require("modules.win")
local movementDirections = {a = {-1,0}, d = {1,0}, space = {0,-1}}
local respawning = false


player.MovementData = {
["Speed"] = 9000,
["MaxSpeed"] = 400,
Expand Down
7 changes: 7 additions & 0 deletions modules/sprite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ local sprite = {
["Sponge"] = "images/Sponge.jpg",
["SpongeButton"] = "images/SpongeButton.png",
["WinButton"] = "images/WinButton.png",
["MoveButton"] = "images/MoveButton.png",
["ScaleButton"] = "images/ScaleButton.png",
["PaintButton"] = "images/PaintButton.png",
["EndFlag"] = "images/EndFlag.png",
["SaveButton"] = "images/SaveButton.png",
["MainMenu"] = "images/MainMenu.png",
["PauseMenu"] = "images/PauseMenu.png",
["DeleteButton"] = "images/DeleteButton.png",
["Hue"] = "images/hue.png",
["Saturation"] = "images/saturation.png",
["Brightness"] = "images/brightness.png",
["Slider"] = "images/slider.png",
["WinScreen"] = "images/WinScreen.png"
}
sprite.IsLoaded = false
Expand Down

0 comments on commit b1eae3d

Please sign in to comment.