From 39aac80d9c6eb5a044b79bd89cd66ccfd63c447b Mon Sep 17 00:00:00 2001 From: Cmb <71194682+29cmb@users.noreply.github.com> Date: Mon, 29 Jul 2024 12:13:22 -0400 Subject: [PATCH] Added winscreen (this was kinda painful) --- images/WinScreen.png | Bin 0 -> 15389 bytes main.lua | 9 +++++++- modules/level.lua | 41 ++++++++++++++++++++++++++---------- modules/player.lua | 5 ++--- modules/sprite.lua | 3 ++- modules/win.lua | 48 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 90 insertions(+), 16 deletions(-) create mode 100644 images/WinScreen.png create mode 100644 modules/win.lua diff --git a/images/WinScreen.png b/images/WinScreen.png new file mode 100644 index 0000000000000000000000000000000000000000..824089406210d996bfe58ae9b23b6d5ed8fdc4b5 GIT binary patch literal 15389 zcmeI3cUY5Kx8MV!pdhHIAQFlO5DOiVj&c-26_H*Q5a|en4gnj-0!UDh4x;pq^d@oy zBGL(w5~9*WiPVsUz}>IsobQ?Y+?ly^=gv2OeSh$T=gqs@+H0-7)^F`Rxo)6!@BrTd z7z}n0sr}mx7;KLa490BEwhuf>_P_59KK6TSTlm6Y?A*{F6D&EE7Y0-AMgDgAW?>6(+e8aOF9M`{emkk>e95BNgqdSagoQzniRW#5;JIMRfJsvFZCwk*$#iMY1{Q zyVuZ{6#Q~r&pj=E6rtjn7f_oibVS4Pcc$}6{i1c;+J!F;NjRKJ6_Umf1sk%&=!;t?U=?VWkne@9@OJ_oiXWEgj6WJuuky4?_j)V5Xv6Oe`?inQJg680_g` z4HzuqHp?LxER*+NkN+i;e<{R&+ZvKgQA~PDVaT0RSV2>pPO0$pDRh;2xH-n{0A3~) zt+Q%QYEjhRB zCNpkfTF#qysL`vt(1sP6_bFbp=yxkkC1aF4R|mzCkH2&3_}s=_mCE0~h&_$uM9S0* z=!`ZfV_U$$o+RV7HDrmQmwWGxnVfQXI{&AZ{I$&nHEhZ8E=lC%seGNnconOA2fIn@ z7CS1~unP&2+N`$& zMVd#|JE^$4_ph4l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ua @@ -7,6 +7,7 @@ local editor = require("editor") local utils = require("modules.utils") local fonts = require("modules.font") local pause = require('modules.pause') +local win = require('modules.win') local inMenu = true local levelPage = 1 @@ -124,6 +125,7 @@ function love.load() if sprite.IsLoaded == false then sprite: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) @@ -146,6 +148,7 @@ function love.draw() level:draw() player:draw() pause:Draw() + win:Draw() end end @@ -165,14 +168,16 @@ end function love.keypressed(key) if key == "j" and editor.InEditor == false then player:WaterToggle() - elseif key == "escape" and (inMenu == false or editor.InEditor == true) then + elseif key == "escape" and (inMenu == false or editor.InEditor == true) and win.WinVisible == false then pause.Paused = not pause.Paused end end function love.mousepressed(x, y, button) + if win.WinVisible == true then win:MouseClick(x, y) return end if pause.Paused == true then pause:MouseClick(x, y) return end if editor.InEditor == true then editor:MousePressed(x, y, button) return end + if inMenu == true then for _,btn in pairs(menuButtons) do if utils:CheckCollision(x, y, 1, 1, btn.Transform[1], btn.Transform[2], btn.Transform[3], btn.Transform[4]) then @@ -192,6 +197,8 @@ function beginContact(a, b) player:YieldRespawn() elseif b:getUserData() == "Sponge" and player.IsWater == true then player:YieldRespawn() + elseif b:getUserData() == "Flag" then + win.WinVisible = true end end end diff --git a/modules/level.lua b/modules/level.lua index e969e19..c464587 100644 --- a/modules/level.lua +++ b/modules/level.lua @@ -10,6 +10,7 @@ end function level:loadLevel(data) print(data) if data.Start then self.map.Start = data.Start end + if data.End then self.map.End = data.End end for _,platform in pairs(data.Platforms) do local body = love.physics.newBody(world, platform.X + (platform.W / 2), platform.Y + (platform.H / 2), "static") local shape = love.physics.newRectangleShape(platform.W, platform.H) @@ -75,6 +76,16 @@ function level:loadLevel(data) player.body:setX(self.map.Start.X) player.body:setY(self.map.Start.Y) end + + if self.map.End then + local body = love.physics.newBody(world, self.map.End.X + (60 / 2), self.map.End.Y + (60 / 2), "static") + local shape = love.physics.newRectangleShape(60, 60) + local fixutre = love.physics.newFixture(body, shape) + fixutre:setUserData("Flag") + fixutre:setSensor(true) + + self.map.End.Fixture = fixutre + end end function level:Unload() @@ -84,19 +95,27 @@ end function level:draw() if self.map ~= {} then - for _,platform in pairs(self.map) do - if platform.type == "Platform" then - love.graphics.setColor(platform.color.R, platform.color.B, platform.color.G) - love.graphics.rectangle("fill", platform.transform[1] - player.CameraData.CameraX, platform.transform[2] - player.CameraData.CameraY, platform.transform[3], platform.transform[4]) - love.graphics.setColor(1, 1, 1) - elseif platform.type == "Spike" then - love.graphics.draw(sprite.Spike, platform.transform[1] - player.CameraData.CameraX, platform.transform[2] - player.CameraData.CameraY) - elseif platform.type == "Sponge" then - love.graphics.draw(sprite.Sponge, platform.transform[1] - player.CameraData.CameraX, platform.transform[2] - player.CameraData.CameraY, 0, platform.transform[3] / 536, platform.transform[4] / 350) - elseif platform.type == "Gate" then - love.graphics.draw(sprite.Water, platform.transform[1] - player.CameraData.CameraX, platform.transform[2] - player.CameraData.CameraY, 0, platform.transform[3] / 643, platform.transform[4] / 360) + for _,platform in pairs(self.map) do + if type(platform) == "table" then + if platform.type then + if platform.type == "Platform" then + love.graphics.setColor(platform.color.R, platform.color.B, platform.color.G) + love.graphics.rectangle("fill", platform.transform[1] - player.CameraData.CameraX, platform.transform[2] - player.CameraData.CameraY, platform.transform[3], platform.transform[4]) + love.graphics.setColor(1, 1, 1) + elseif platform.type == "Spike" then + love.graphics.draw(sprite.Spike, platform.transform[1] - player.CameraData.CameraX, platform.transform[2] - player.CameraData.CameraY) + elseif platform.type == "Sponge" then + love.graphics.draw(sprite.Sponge, platform.transform[1] - player.CameraData.CameraX, platform.transform[2] - player.CameraData.CameraY, 0, platform.transform[3] / 536, platform.transform[4] / 350) + elseif platform.type == "Gate" then + love.graphics.draw(sprite.Water, platform.transform[1] - player.CameraData.CameraX, platform.transform[2] - player.CameraData.CameraY, 0, platform.transform[3] / 643, platform.transform[4] / 360) + end + end end end + + if self.map.End then + love.graphics.draw(sprite.EndFlag, self.map.End.X - player.CameraData.CameraX, self.map.End.Y - player.CameraData.CameraY) + end end end diff --git a/modules/player.lua b/modules/player.lua index 33f66e5..f5ead99 100644 --- a/modules/player.lua +++ b/modules/player.lua @@ -3,6 +3,7 @@ local player = {} local sprite = require("modules.sprite") local pause = require("modules.pause") 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 = { @@ -59,10 +60,8 @@ function player:update(dt) self.MovementData.OnGround = true end - - for key, data in pairs(movementDirections) do - if love.keyboard.isDown(key) and pause.Paused == false then + if love.keyboard.isDown(key) and (pause.Paused == false and win.WinVisible == false) then local impulseX = 0 local impulseY = 0 diff --git a/modules/sprite.lua b/modules/sprite.lua index 66ffa85..a464fa0 100644 --- a/modules/sprite.lua +++ b/modules/sprite.lua @@ -14,7 +14,8 @@ local sprite = { ["SaveButton"] = "images/SaveButton.png", ["MainMenu"] = "images/MainMenu.png", ["PauseMenu"] = "images/PauseMenu.png", - ["DeleteButton"] = "images/DeleteButton.png" + ["DeleteButton"] = "images/DeleteButton.png", + ["WinScreen"] = "images/WinScreen.png" } sprite.IsLoaded = false diff --git a/modules/win.lua b/modules/win.lua new file mode 100644 index 0000000..89cd553 --- /dev/null +++ b/modules/win.lua @@ -0,0 +1,48 @@ +local sprite = require("modules.sprite") +local utils = require("modules.utils") +local win = {} +win.WinVisible = false +win.IsLoaded = false + +function win:Load() + main = require("main") + level = require("modules.level") + player = require("modules.player") + self.IsLoaded = true +end + +local buttons = { + ["Exit"] = { + ["Transform"] = {200, 217, 397, 125}, + ["Callback"] = function() + main:Exit() + level:Unload() + win.WinVisible = false + end + }, + ["Restart"] = { + ["Transform"] = {200, 355, 397, 125}, + ["Callback"] = function() + player.body:setX(level.map.Start.X or 0) + player.body:setY(level.map.Start.Y or 0) + win.WinVisible = false + end + } +} + +function win:Draw() + if self.WinVisible == true then + love.graphics.draw(sprite.WinScreen) + end +end + +function win:MouseClick(x, y) + for _,btn in pairs(buttons) do + if utils:CheckCollision(x, y, 1, 1, btn["Transform"][1], btn["Transform"][2], btn["Transform"][3], btn["Transform"][4]) then + btn.Callback() + end + end +end + + +return win \ No newline at end of file