From 6227a1c681c0559add922a7e68cd634fcc85df41 Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Tue, 1 Mar 2022 18:19:59 +0530 Subject: * Cosmetic Changes in Menu * New Fonts Added * Menu rendering changes * Removed Hacky text co-ordinate calculations * Replaced with love.text * Disappearing Notification messages implemented --- assets/fonts/C800.ttf | Bin 0 -> 10004 bytes assets/fonts/Lazer84.ttf | Bin 0 -> 36776 bytes assets/images/tileset.png | Bin 3048 -> 3024 bytes assets/maps/level1.lua | 142 +++++++++++++++++++++++----------------------- core/constants.lua | 2 + core/map.lua | 3 +- core/notifications.lua | 43 +++++++++----- scenes/level1_scene.lua | 2 +- scenes/menu_scene.lua | 33 +++++++---- 9 files changed, 126 insertions(+), 99 deletions(-) create mode 100644 assets/fonts/C800.ttf create mode 100644 assets/fonts/Lazer84.ttf diff --git a/assets/fonts/C800.ttf b/assets/fonts/C800.ttf new file mode 100644 index 0000000..e57f558 Binary files /dev/null and b/assets/fonts/C800.ttf differ diff --git a/assets/fonts/Lazer84.ttf b/assets/fonts/Lazer84.ttf new file mode 100644 index 0000000..369779c Binary files /dev/null and b/assets/fonts/Lazer84.ttf differ diff --git a/assets/images/tileset.png b/assets/images/tileset.png index ed35eff..cd90a99 100644 Binary files a/assets/images/tileset.png and b/assets/images/tileset.png differ diff --git a/assets/maps/level1.lua b/assets/maps/level1.lua index 1e32139..423becc 100644 --- a/assets/maps/level1.lua +++ b/assets/maps/level1.lua @@ -9,7 +9,7 @@ return { tilewidth = 16, tileheight = 16, nextlayerid = 7, - nextobjectid = 30, + nextobjectid = 32, properties = {}, tilesets = { { @@ -135,7 +135,7 @@ return { 6, 7, 6, 6, 195, 197, 0, 6, 6, 6, 8, 8, 8, 8, 7, 7, 195, 197, 0, 8, 8, 7, 7, 7, 7, 7, 7, 8, 0, 8, 0, 6, 6, 6, 0, 0, 195, 197, 8, 7, 7, 8, 8, 8, 8, 7, 0, 7, 195, 197, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 0, 6, 6, 6, 6, 0, 195, 197, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 195, 197, 0, 8, 8, 8, 8, 8, 7, 8, 8, 8, 8, 8, 0, 6, - 6, 6, 6, 6, 195, 193, 165, 0, 8, 8, 7, 7, 7, 7, 7, 0, 195, 197, 7, 7, 8, 8, 8, 8, 8, 8, 8, 7, 8, 0, 7, 6, + 6, 6, 6, 7, 195, 193, 165, 0, 8, 8, 7, 7, 7, 7, 7, 0, 195, 197, 7, 7, 8, 8, 8, 8, 8, 8, 8, 7, 8, 0, 7, 6, 6, 6, 6, 6, 227, 162, 197, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 197, 8, 7, 7, 8, 8, 8, 8, 8, 7, 7, 8, 7, 7, 6, 6, 6, 7, 0, 0, 195, 193, 164, 164, 164, 164, 164, 164, 164, 164, 164, 194, 197, 8, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 7, 7, 7, 227, 228, 228, 228, 228, 162, 161, 228, 228, 228, 228, 228, 229, 7, 7, 8, 7, 8, 8, 0, 7, 0, 8, 8, 7, 0, 6, @@ -211,6 +211,57 @@ return { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, + { + type = "tilelayer", + x = 0, + y = 0, + width = 32, + height = 32, + id = 3, + name = "foreground", + visible = true, + opacity = 1, + offsetx = 0, + offsety = 0, + parallaxx = 1, + parallaxy = 1, + properties = {}, + encoding = "lua", + data = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } + }, { type = "objectgroup", draworder = "topdown", @@ -254,14 +305,14 @@ return { } }, { - id = 26, + id = 27, name = "potion", type = "interactive", shape = "rectangle", - x = 208.5, - y = 80.75, - width = 15, - height = 15.25, + x = 179.969, + y = 117, + width = 8.04438, + height = 11, rotation = 0, visible = true, properties = { @@ -270,14 +321,14 @@ return { } }, { - id = 27, + id = 30, name = "potion", type = "interactive", shape = "rectangle", - x = 176.5, - y = 112.25, - width = 15, - height = 16, + x = 211.917, + y = 85.0417, + width = 8.04438, + height = 11, rotation = 0, visible = true, properties = { @@ -286,14 +337,14 @@ return { } }, { - id = 28, + id = 31, name = "potion", type = "interactive", shape = "rectangle", - x = 224, - y = 112.25, - width = 15.75, - height = 15.25, + x = 227.943, + y = 116.965, + width = 8.04438, + height = 11, rotation = 0, visible = true, properties = { @@ -399,10 +450,10 @@ return { name = "", type = "", shape = "rectangle", - x = 64, + x = 66.25, y = 48, - width = 32, - height = 16, + width = 27.25, + height = 9.6875, rotation = 0, visible = true, properties = {} @@ -447,57 +498,6 @@ return { properties = {} } } - }, - { - type = "tilelayer", - x = 0, - y = 0, - width = 32, - height = 32, - id = 3, - name = "foreground", - visible = true, - opacity = 1, - offsetx = 0, - offsety = 0, - parallaxx = 1, - parallaxy = 1, - properties = {}, - encoding = "lua", - data = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 97, 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 129, 130, 0, 0, 0, 0, 33, 34, 0, 0, 0, 3, 132, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - } } } } diff --git a/core/constants.lua b/core/constants.lua index 5284e6d..7077f1f 100644 --- a/core/constants.lua +++ b/core/constants.lua @@ -2,6 +2,8 @@ constants = {} constants.resetBgColor = {0.15, 0.15, 0.15} constants.resetFgColor = {1, 1, 1} +constants.defaultFontSize = 12 +constants.defaultFont = love.graphics.newFont('assets/fonts/C800.ttf', constants.defaultFontSize) function constants:resetColors() love.graphics.setColor(constants.resetFgColor) diff --git a/core/map.lua b/core/map.lua index acbdc4a..280057a 100644 --- a/core/map.lua +++ b/core/map.lua @@ -5,7 +5,6 @@ Moonshine = require("libs.moonshine") Camera = require("libs.hump.camera") Windfield = require("libs.windfield") require("libs.tserial") -print(TSerial) require("core.notifications") local zoomFactor = 2 @@ -146,7 +145,7 @@ function Map:draw() drawMapLayer("decorations") love.graphics.draw(player.sprite, player.x, player.y) drawMapLayer("foreground") - _gameWorld:draw() + -- _gameWorld:draw() -- Debug Collision Draw camera:detach() notifications:draw() end) diff --git a/core/notifications.lua b/core/notifications.lua index 05950f2..ec0a1e1 100644 --- a/core/notifications.lua +++ b/core/notifications.lua @@ -1,31 +1,48 @@ Class = require("libs.hump.class") Timer = require("libs.hump.timer") +require("core.constants") Notifications = Class { init = function(self, zoomFactor) - color = {1, 0, 0, 1} - local windowWidth, windowHeight = love.graphics.getDimensions() + windowWidth, windowHeight = love.graphics.getDimensions() end, - _message={} + messages={} } function Notifications:update(dt) - Timer.update(dt) + for i,obj in pairs(self.messages) do + if obj.timer then + obj.timer:update(dt) + end + end end function Notifications:draw() - if self._message then - love.graphics.setColor(color) - love.graphics.print(self._message, 10, wind) + love.graphics.setFont(constants.defaultFont) + local defaultY = windowHeight - 20 + for i,obj in pairs(self.messages) do + love.graphics.setColor(obj.color) + love.graphics.print(obj.message, 10, defaultY) + defaultY = defaultY - 15 end end function Notifications:send(message) - self._message = message - color = {1, 0, 0, 1} - if Timer then - Timer.clear() - end - Timer.tween(5, color, {0, 0, 0, 0}, 'linear') + local messageItem={ + message=message, + color={1, 0, 0, 1}, + timer=nil + } + table.insert(self.messages, messageItem) + for i,obj in pairs(self.messages) do + if obj.timer==nil then + obj.timer = Timer.new() + obj.timer:tween(5, obj.color, {0, 0, 0, 0}, 'linear', function() + obj.timer:clear() + obj.timer = nil + table.remove(self.messages, 1) + end) + end + end end return Notifications \ No newline at end of file diff --git a/scenes/level1_scene.lua b/scenes/level1_scene.lua index e5f4ec0..fb1ee0a 100644 --- a/scenes/level1_scene.lua +++ b/scenes/level1_scene.lua @@ -35,7 +35,7 @@ end function printMessage() - print('Hello') + -- print('Hello') end return level1 \ No newline at end of file diff --git a/scenes/menu_scene.lua b/scenes/menu_scene.lua index 13bf8fd..8fd1587 100644 --- a/scenes/menu_scene.lua +++ b/scenes/menu_scene.lua @@ -7,16 +7,21 @@ require("core.constants") -- scenes require("scenes.level1_scene"); -local titleFontSize = 25 +local titleFontSize1 = 35 +local titleFontSize2 = 40 local msgFontSize = 15 -local defaultFontFactor = 8 +local defaultFontFactor = 10.30 local windowWidth = love.graphics.getWidth() local windowHeight = love.graphics.getHeight() function menu:init() - titleFont = love.graphics.newFont('assets/fonts/minecraftia.ttf', titleFontSize) - startMsgFont = love.graphics.newFont('assets/fonts/minecraftia.ttf', msgFontSize) + titleFont1 = love.graphics.newFont('assets/fonts/C800.ttf', titleFontSize1) + titleFont2 = love.graphics.newFont('assets/fonts/Lazer84.ttf', titleFontSize2) + startMsgFont = love.graphics.newFont('assets/fonts/C800.ttf', msgFontSize) music = love.audio.newSource("assets/music/Stevia Sphere - Drum machine dreams.ogg", "stream") + titleText1 = love.graphics.newText(titleFont1, "Enemy is in Another") + titleText2 = love.graphics.newText(titleFont2, "Dungeon") + msgText = love.graphics.newText(startMsgFont, "Press X to START") effect = Moonshine(windowWidth, windowHeight, Moonshine.effects.crt) .chain(Moonshine.effects.vignette) .chain(Moonshine.effects.scanlines) @@ -27,16 +32,17 @@ function menu:init() effect.chromasep.radius = 2 music:setLooping(true) - msgFontColor = {0, 0, 0} - titleFontColor = {1, 1, 1} + msgFontColor = {0, 0, 0, 0} + titleFontColor1 = {1, 1, 1} + titleFontColor2 = {1, 0, 0} starfield = generateStarfield() fadeIn = function() - Timer.tween(0.5, msgFontColor, {1, 1, 1}, 'linear', fadeOut) + Timer.tween(0.5, msgFontColor, {1, 1, 1, 1}, 'linear', fadeOut) end fadeOut = function() - Timer.tween(0.5, msgFontColor, {0, 0, 0}, 'linear', fadeIn) + Timer.tween(0.5, msgFontColor, {0, 0, 0, 0}, 'linear', fadeIn) end fadeIn() @@ -59,14 +65,17 @@ end function menu:draw() effect(function() - love.graphics.setFont(titleFont) - love.graphics.setColor(titleFontColor) + love.graphics.setFont(titleFont1) + love.graphics.setColor(titleFontColor1) love.graphics.draw(starfield, love.graphics.getWidth() * 0.5, love.graphics.getHeight() * 0.5) - love.graphics.print("Enemy is in Another Dungeon",(windowWidth * 0.5) - (titleFontSize * defaultFontFactor), (windowHeight * 0.5) - 50) + love.graphics.draw(titleText1,(windowWidth * 0.5) - (titleText1:getWidth() * 0.5), (windowHeight * 0.5) - 50) + love.graphics.setColor(titleFontColor2) + love.graphics.setFont(titleFont2) + love.graphics.draw(titleText2,(windowWidth * 0.5) - (titleText2:getWidth() * 0.5), (windowHeight * 0.5) + 2, -0.17) love.graphics.setFont(startMsgFont) love.graphics.setColor(msgFontColor) - love.graphics.print("Press X to START", (windowWidth * 0.5) - (msgFontSize * (defaultFontFactor/1.5)), windowHeight - 50) + love.graphics.draw(msgText, (windowWidth * 0.5) - (msgText:getWidth() * 0.5), windowHeight - 50) end) end -- cgit v1.2.3