diff options
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | conf.lua | 6 | ||||
-rw-r--r-- | core/constants.lua | 2 | ||||
-rw-r--r-- | core/map.lua | 42 | ||||
-rw-r--r-- | core/notifications.lua | 6 |
5 files changed, 46 insertions, 17 deletions
@@ -4,6 +4,13 @@ Source code of my ```LÖVE Jam 2022``` entry. This game is written in lua and LÖVE 2D framework. You may need LÖVE 2D installed to run. +### Controls +``` +WASD - Move +F4 - Toggle Fullscreen +ESCAPE - Exit +``` + ### Libraries Used - [anim8](https://github.com/kikito/anim8) - [hump](https://github.com/vrld/hump) @@ -1,7 +1,7 @@ function love.conf(t) - t.window.width = 800 - t.window.height = 600 - t.window.fullscreen = false + t.window.width = 1280 + t.window.height = 720 + t.window.fullscreen = true t.window.title = "<Your Enemy is in Another Dungeon>" t.window.usedpiscale = true t.window.icon = "assets/images/icon.png" diff --git a/core/constants.lua b/core/constants.lua index 7077f1f..b6cdf6a 100644 --- a/core/constants.lua +++ b/core/constants.lua @@ -2,7 +2,7 @@ constants = {} constants.resetBgColor = {0.15, 0.15, 0.15} constants.resetFgColor = {1, 1, 1} -constants.defaultFontSize = 12 +constants.defaultFontSize = 13 constants.defaultFont = love.graphics.newFont('assets/fonts/C800.ttf', constants.defaultFontSize) function constants:resetColors() diff --git a/core/map.lua b/core/map.lua index 280057a..2bd0110 100644 --- a/core/map.lua +++ b/core/map.lua @@ -1,19 +1,20 @@ Class = require("libs.hump.class") Gamestate = require("libs.hump.gamestate") STI = require("libs.sti") -Moonshine = require("libs.moonshine") +local Moonshine = require("libs.moonshine") Camera = require("libs.hump.camera") Windfield = require("libs.windfield") require("libs.tserial") require("core.notifications") -local zoomFactor = 2 +local zoomFactor = 3 local player = { x=0, y=0, sprite=love.graphics.newImage("assets/images/player_demo.png"), speed=100 } +local fullscreen = true local windowWidth, windowHeight = love.graphics.getDimensions() local _w = windowWidth/zoomFactor @@ -29,10 +30,11 @@ Map = Class { .chain(Moonshine.effects.vignette) .chain(Moonshine.effects.scanlines) .chain(Moonshine.effects.chromasep) + effect.scanlines.thickness = .2 effect.scanlines.opacity = .5 effect.chromasep.angle = 1 - effect.chromasep.radius = 2 + effect.chromasep.radius = 3 notifications = Notifications(zoomFactor) camera = Camera() @@ -74,23 +76,22 @@ Map = Class { } function Map:update(dt) - local vx = 0 local vy = 0 - if love.keyboard.isDown("up") then + if love.keyboard.isDown("w") then vy = player.speed * -1 end - - if love.keyboard.isDown("down") then - vy = player.speed - end - - if love.keyboard.isDown("left") then + + if love.keyboard.isDown("a") then vx = player.speed * -1 end + + if love.keyboard.isDown("s") then + vy = player.speed + end - if love.keyboard.isDown("right") then + if love.keyboard.isDown("d") then vx = player.speed end @@ -149,9 +150,16 @@ function Map:draw() camera:detach() notifications:draw() end) + end function Map:keypressed(key, scancode) + if(scancode=="f4") then + fullscreen = not fullscreen + love.window.setFullscreen(fullscreen) + print("Fullscreen Toggle") + resize() + end end function drawMapLayer(layerName) @@ -160,4 +168,14 @@ function drawMapLayer(layerName) end end +function resize() + _width, _height = love.graphics.getDimensions() + if not(fullscreen) then + _width = 1280 + _height = 720 + end + effect.resize(_width,_height) + notifications.calculateWindowDimensions() +end + return Map
\ No newline at end of file diff --git a/core/notifications.lua b/core/notifications.lua index ec0a1e1..26096ca 100644 --- a/core/notifications.lua +++ b/core/notifications.lua @@ -3,11 +3,15 @@ Timer = require("libs.hump.timer") require("core.constants") Notifications = Class { init = function(self, zoomFactor) - windowWidth, windowHeight = love.graphics.getDimensions() + self.calculateWindowDimensions() end, messages={} } +function Notifications:calculateWindowDimensions() + windowWidth, windowHeight = love.graphics.getDimensions() +end + function Notifications:update(dt) for i,obj in pairs(self.messages) do if obj.timer then |