diff options
author | Indrajith K L | 2022-03-01 02:48:49 +0530 |
---|---|---|
committer | Indrajith K L | 2022-03-01 02:48:49 +0530 |
commit | f5eaa22a1c9598c9f7a55a41614d1ce4769dee4a (patch) | |
tree | afbb7585324e9efbfd5820f07d9a0239193d3e99 /utils | |
parent | 05add67d6f95c51a3501bc15a742cf9fccc4b67e (diff) | |
download | YEAD-f5eaa22a1c9598c9f7a55a41614d1ce4769dee4a.tar.gz YEAD-f5eaa22a1c9598c9f7a55a41614d1ce4769dee4a.tar.bz2 YEAD-f5eaa22a1c9598c9f7a55a41614d1ce4769dee4a.zip |
* Adds Ambience SFX & Management
* Notification - In-Progress
* Collision Callbacks
* Interactive & Pickable entities - In-Progress
Diffstat (limited to 'utils')
-rw-r--r-- | utils/constants.lua | 11 | ||||
-rw-r--r-- | utils/enitity.lua | 0 | ||||
-rw-r--r-- | utils/map.lua | 126 | ||||
-rw-r--r-- | utils/screen_shaker.lua | 28 |
4 files changed, 0 insertions, 165 deletions
diff --git a/utils/constants.lua b/utils/constants.lua deleted file mode 100644 index 5284e6d..0000000 --- a/utils/constants.lua +++ /dev/null @@ -1,11 +0,0 @@ -constants = {} - -constants.resetBgColor = {0.15, 0.15, 0.15} -constants.resetFgColor = {1, 1, 1} - -function constants:resetColors() - love.graphics.setColor(constants.resetFgColor) - love.graphics.setBackgroundColor(constants.resetBgColor) -end - -return constants
\ No newline at end of file diff --git a/utils/enitity.lua b/utils/enitity.lua deleted file mode 100644 index e69de29..0000000 --- a/utils/enitity.lua +++ /dev/null diff --git a/utils/map.lua b/utils/map.lua deleted file mode 100644 index 1f06487..0000000 --- a/utils/map.lua +++ /dev/null @@ -1,126 +0,0 @@ -Class = require("libs.hump.class") -Gamestate = require("libs.hump.gamestate") -STI = require("libs.sti") -Moonshine = require("libs.moonshine") -Camera = require("libs.hump.camera") -Windfield = require("libs.windfield") - -zoomFactor = 2 -player = { - x=0, - y=0, - sprite=love.graphics.newImage("assets/images/player_demo.png"), - speed=100 -} - -windowWidth, windowHeight = love.graphics.getDimensions() -_w = windowWidth/zoomFactor -_h = windowHeight/zoomFactor - -Map = Class { - __include=Gamestate, - init = function(self, mapName) - _gameWorld = Windfield.newWorld(0,0) - effect = Moonshine(windowWidth, windowHeight, Moonshine.effects.crt) - .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 - - camera = Camera() - camera:zoom(zoomFactor) - currentMap = STI("assets/maps/"..mapName..".lua") - if currentMap.layers["entities"] then - for i,obj in pairs(currentMap.layers["entities"].objects) do - player.x = obj.x - player.y = obj.y - player.collider = _gameWorld:newBSGRectangleCollider(player.x, player.y, 8, 8, 0) - player.collider:setFixedRotation(true) - end - end - - if currentMap.layers["walls"] then - for i,obj in pairs(currentMap.layers["walls"].objects) do - local wall = _gameWorld:newRectangleCollider(obj.x, obj.y, obj.width, obj.height) - wall:setType("static") - end - end - end, - entities={} -} - -function Map:update(dt) - - local vx = 0 - local vy = 0 - - if love.keyboard.isDown("up") then - vy = player.speed * -1 - end - - if love.keyboard.isDown("down") then - vy = player.speed - end - - if love.keyboard.isDown("left") then - vx = player.speed * -1 - end - - if love.keyboard.isDown("right") then - vx = player.speed - end - - player.collider:setLinearVelocity(vx, vy) - - _gameWorld:update(dt) - player.x = player.collider:getX() - 4 - player.y = player.collider:getY() - 4 - - camera:lookAt(player.x, player.y) - currentMap:update(dt) - - if camera.x < _w/2 then - camera.x = _w/2 - end - - if camera.y < _h/2 then - camera.y = _h/2 - end - - local mapWidth = currentMap.width * currentMap.tilewidth - local mapHeight = currentMap.height * currentMap.tileheight - - if camera.x > (mapWidth - _w/2) then - camera.x = (mapWidth - _w/2) - end - - if camera.y > (mapHeight - _h/2) then - camera.y = (mapHeight - _h/2) - end -end - -function Map:draw() - effect(function() - camera:attach() - drawMapLayer("ground") - drawMapLayer("decorations") - love.graphics.draw(player.sprite, player.x, player.y) - drawMapLayer("foreground") - -- _gameWorld:draw() - camera:detach() - end) -end - -function Map:keypressed(key, scancode) -end - -function drawMapLayer(layerName) - if currentMap.layers[layerName].visible then - currentMap:drawLayer(currentMap.layers[layerName]) - end -end - -return Map
\ No newline at end of file diff --git a/utils/screen_shaker.lua b/utils/screen_shaker.lua deleted file mode 100644 index aef89e4..0000000 --- a/utils/screen_shaker.lua +++ /dev/null @@ -1,28 +0,0 @@ -Class = require("libs.hump.class") -Shack = require("libs.shack") -local Timer = require("libs.hump.Timer") - -ScreenShaker = Class { - init = function(self) - monsterGrowl = love.audio.newSource("assets/sfx/sfx_deathscream_alien1.wav", "static") - local width, height = love.graphics.getDimensions() - Shack:setDimensions(width, height) - Timer.every(10, shakeScreen) - end -} - -function ScreenShaker:update(dt) - Timer.update(dt) - Shack:update(dt) -end - -function ScreenShaker:draw() - Shack:apply() -end - -function shakeScreen() - Shack:setShake(20) - monsterGrowl:play() -end - -return ScreenShaker
\ No newline at end of file |