223 lines
7.7 KiB
Lua
223 lines
7.7 KiB
Lua
|
|
local files = require("modules.files")
|
|
|
|
local module = {}
|
|
|
|
local introVideo
|
|
local sillyVideo
|
|
local playedIntro = false
|
|
|
|
local mirror
|
|
local evilMirror
|
|
local oldPosition
|
|
local oldSpritePosition
|
|
local showCutscene = false
|
|
local endedIntro = false
|
|
local evilAtlas
|
|
local startedEvilVideo = false
|
|
local endedEvilVideo = false
|
|
local paused = false
|
|
|
|
local evilShaderScript = [[
|
|
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords) {
|
|
vec4 pixel = Texel(texture, texture_coords); //Current pixel
|
|
pixel.r = pixel.r - 0.1;
|
|
pixel.g = pixel.g - 0.1;
|
|
if (pixel.b > 0.05) {
|
|
pixel.b = pixel.b + 0.1;
|
|
}
|
|
return pixel;
|
|
}
|
|
]]
|
|
|
|
local evilShader = love.graphics.newShader(evilShaderScript)
|
|
|
|
--receptor.position = Vector2(600 + (79* i), settings.Downscroll and 430 or 0)
|
|
local nextplayerReceptorPosition = Vector2(600, 430) -- Its gonna be a forced downscroll so idc lmao lmao skill issue
|
|
local currentplayerReceptorPosition = Vector2(600, 430)
|
|
|
|
local moveAway = false
|
|
|
|
function module.onCreate()
|
|
introVideo = love.graphics.newVideo("videos/open.ogv")
|
|
sillyVideo = love.graphics.newVideo("videos/SO_STAY_FINAL_1.ogv")
|
|
sillyVideo:getSource():setVolume(0)
|
|
|
|
mirror = Image("images/billy/silly_mirror.png")
|
|
mirror.layer = -20
|
|
mirror.resize = Vector2(1,1)
|
|
mirror.position.y = -300
|
|
mirror.position.x = -800
|
|
|
|
evilMirror = Image("images/billy/broken_mirror.png")
|
|
evilMirror.layer = -21 -- I will put this one forward on break mirror event ig
|
|
evilMirror.resize = Vector2(1,1)
|
|
evilMirror.position.y = -300
|
|
evilMirror.position.x = -800
|
|
|
|
local floor = Rect("images/billy/bgAssets.png", "images/billy/bgAssets.json")
|
|
floor.layer = -15
|
|
floor:Frame("Silly_floor", 0)
|
|
floor.quads["Silly_floor"][0].resize = Vector2(1.4, 1)
|
|
floor.position.y = -300
|
|
floor.position.x = -100
|
|
|
|
local asset1 = Rect("images/billy/bgAssets.png", "images/billy/bgAssets.json")
|
|
asset1.layer = -10
|
|
asset1:Frame("Silly_idk_1", 0)
|
|
asset1.quads["Silly_idk_1"][0].resize = Vector2(1, 1)
|
|
asset1.position.y = -540
|
|
asset1.position.x = -800
|
|
|
|
for index, receptor in next, sharedVars.opponentReceptors do
|
|
receptor.ui = false
|
|
receptor.position = Vector2(200 * (index - 1), 300)
|
|
receptor.layer = -5
|
|
end
|
|
|
|
-- local asset2 = Rect("images/billy/bgAssets.png", "images/billy/bgAssets.json")
|
|
-- asset2.layer = -8
|
|
-- asset2:Frame("Silly_idk_2", 0)
|
|
-- asset2.quads["Silly_idk_2"][0].resize = Vector2(0.5, 0.5)
|
|
-- local asset3 = Rect("images/billy/bgAssets.png", "images/billy/bgAssets.json")
|
|
-- asset3.layer = -7
|
|
-- asset3:Frame("Yo_y_mi_silly_pana", 0)
|
|
-- asset3.quads["Yo_y_mi_silly_pana"][0].resize = Vector2(0.5, 0.5)
|
|
|
|
evilAtlas = Atlas("sprites/lyric")
|
|
evilAtlas.position = Vector2(50000,50000)
|
|
evilAtlas.layer = 1
|
|
|
|
sharedVars.settings.Downscroll = true -- forcing downscroll because i am not coding upscroll positions dawg
|
|
moveAway = false
|
|
end
|
|
|
|
function module.onEvent(event)
|
|
if event.name == "ill make" then
|
|
if event.var1 == "anim" then
|
|
oldPosition = sharedVars.characters.dad.stagePosition
|
|
oldSpritePosition = sharedVars.characters.dad.sprite.position
|
|
sharedVars.characters.dad.stagePosition = Vector2(50000,5000)
|
|
sharedVars.characters.dad.sprite.position = Vector2(50000,5000)
|
|
evilAtlas.position = Vector2(920, 600)
|
|
evilAtlas:PlayAnimation("story_of_yourtalebilly")
|
|
elseif event.var1 == "vid" then
|
|
evilAtlas:Destroy()
|
|
sharedVars.characters.dad.stagePosition = oldPosition
|
|
sharedVars.characters.dad.sprite.position = oldPosition
|
|
sillyVideo:play()
|
|
startedEvilVideo = true
|
|
nextplayerReceptorPosition = Vector2(324, -90)
|
|
for index, receptor in next, sharedVars.opponentReceptors do
|
|
receptor.ui = false
|
|
receptor.position = Vector2(10000,10000) -- not visible honk mimimi
|
|
receptor.layer = -5
|
|
end
|
|
elseif event.var1 == "break mirror" then
|
|
evilMirror.layer = -19
|
|
elseif event.var1 == "die" then
|
|
elseif event.var1 == "pre" then
|
|
nextplayerReceptorPosition = Vector2(600, -90) --Those are tweened to look bettah
|
|
moveAway = true
|
|
sharedVars.ui.timebar = false
|
|
sharedVars.ui.health = false
|
|
sharedVars.ui.score = false
|
|
sharedVars.ui.ratings = false
|
|
--[[
|
|
local ui = {
|
|
timebar = true,
|
|
healthIcons = true, -- If halth is false it wont render either way
|
|
health = true,
|
|
score = true,
|
|
ratings = true,
|
|
}
|
|
]]
|
|
elseif event.var1 == "hud in" then
|
|
nextplayerReceptorPosition = Vector2(324, 430)
|
|
end
|
|
end
|
|
end
|
|
|
|
function module.onUpdate(dt, el)
|
|
|
|
currentplayerReceptorPosition = currentplayerReceptorPosition:Lerp(nextplayerReceptorPosition, .05)
|
|
for index, note in next, sharedVars.notes do
|
|
if not note.mustPress then
|
|
note.sprite.position = sharedVars.opponentReceptors[note.direction].position:Add(Vector2(0, -1000))
|
|
note.sprite.layer = -3
|
|
note.sprite.ui = false
|
|
note.sprite.alpha = 0.4
|
|
end
|
|
end
|
|
for index, note in next, sharedVars.holds do
|
|
if not note.mustPress then
|
|
note.sprite.position = sharedVars.opponentReceptors[note.direction].position:Add(Vector2(0, -1000))
|
|
note.sprite.layer = -4
|
|
note.sprite.ui = false
|
|
note.sprite.alpha = 0.05
|
|
end
|
|
end
|
|
|
|
for index, receptor in next, sharedVars.receptors do
|
|
receptor.position = Vector2(currentplayerReceptorPosition.x + 79 * (index - 1), currentplayerReceptorPosition.y)
|
|
end
|
|
for index, receptor in next, sharedVars.splashes do
|
|
receptor.position = Vector2(currentplayerReceptorPosition.x - 30 + 79 * (index - 1), currentplayerReceptorPosition.y - 30)
|
|
end
|
|
for index, receptor in next, sharedVars.opponentReceptors do
|
|
receptor.position = receptor.position:Lerp(moveAway and Vector2(200 * (index - 1), -100) or Vector2(200 * (index - 1), 600), .05)
|
|
receptor.alpha = 0.4
|
|
end
|
|
|
|
if el > 0 and not introVideo:isPlaying() and not paused and not playedIntro then
|
|
introVideo:play()
|
|
playedIntro = true
|
|
elseif el > 0 and not introVideo:isPlaying() and not paused and playedIntro then
|
|
endedIntro = true
|
|
end
|
|
if not sillyVideo:isPlaying() and not paused and startedEvilVideo and not endedEvilVideo then
|
|
endedEvilVideo = true
|
|
nextplayerReceptorPosition = Vector2(600, 430)
|
|
sharedVars.globalShader = evilShader
|
|
end
|
|
end
|
|
|
|
function module.drawBelowUI() -- i am sorry
|
|
if sillyVideo and sillyVideo:isPlaying() then
|
|
love.graphics.draw(sillyVideo, 0, 0, 0, 1.5, 1.5)
|
|
end
|
|
end
|
|
|
|
function module.onDraw()
|
|
if introVideo and introVideo:isPlaying() then
|
|
love.graphics.draw(introVideo, 0, 0, 0, 2.3, 2.3)
|
|
end
|
|
end
|
|
|
|
function module.onPause()
|
|
sillyVideo:pause()
|
|
introVideo:pause()
|
|
end
|
|
|
|
function module.onUnpause()
|
|
if startedEvilVideo and not endedEvilVideo then
|
|
sillyVideo:play()
|
|
end
|
|
if not endedIntro then
|
|
introVideo:play()
|
|
end
|
|
end
|
|
|
|
function module.onClose()
|
|
if sillyVideo then
|
|
sillyVideo:pause()
|
|
sillyVideo = nil
|
|
end
|
|
if introVideo then
|
|
introVideo:pause()
|
|
introVideo = nil
|
|
end
|
|
sharedVars.globalShader = nil
|
|
end
|
|
|
|
return module |