From f5eaa22a1c9598c9f7a55a41614d1ce4769dee4a Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Tue, 1 Mar 2022 02:48:49 +0530 Subject: * Adds Ambience SFX & Management * Notification - In-Progress * Collision Callbacks * Interactive & Pickable entities - In-Progress --- assets/images/icon.png | Bin 0 -> 513 bytes assets/images/tileset.png | Bin 3238 -> 3048 bytes assets/maps/level1.lua | 271 +++++++++++++++++++++++++--------- assets/sfx/heartbeat_fast_0.wav | Bin 0 -> 397080 bytes assets/sfx/hits/README.txt | 4 + assets/sfx/monster_growl.wav | Bin 0 -> 448152 bytes assets/sfx/sfx_deathscream_alien1.wav | Bin 133922 -> 0 bytes conf.lua | 2 + core/ambience.lua | 15 ++ core/constants.lua | 11 ++ core/enitity.lua | 0 core/map.lua | 164 ++++++++++++++++++++ core/notifications.lua | 31 ++++ core/screen_shaker.lua | 28 ++++ game_icon.ico | Bin 0 -> 16791 bytes libs/tserial.lua | 46 ++++++ scenes/level1_scene.lua | 8 +- scenes/menu_scene.lua | 2 +- utils/constants.lua | 11 -- utils/enitity.lua | 0 utils/map.lua | 126 ---------------- utils/screen_shaker.lua | 28 ---- 22 files changed, 509 insertions(+), 238 deletions(-) create mode 100644 assets/images/icon.png create mode 100644 assets/sfx/heartbeat_fast_0.wav create mode 100644 assets/sfx/hits/README.txt create mode 100644 assets/sfx/monster_growl.wav delete mode 100644 assets/sfx/sfx_deathscream_alien1.wav create mode 100644 core/ambience.lua create mode 100644 core/constants.lua create mode 100644 core/enitity.lua create mode 100644 core/map.lua create mode 100644 core/notifications.lua create mode 100644 core/screen_shaker.lua create mode 100644 game_icon.ico create mode 100644 libs/tserial.lua delete mode 100644 utils/constants.lua delete mode 100644 utils/enitity.lua delete mode 100644 utils/map.lua delete mode 100644 utils/screen_shaker.lua diff --git a/assets/images/icon.png b/assets/images/icon.png new file mode 100644 index 0000000..221a69c Binary files /dev/null and b/assets/images/icon.png differ diff --git a/assets/images/tileset.png b/assets/images/tileset.png index 40ffa80..ed35eff 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 41084c5..1e32139 100644 --- a/assets/maps/level1.lua +++ b/assets/maps/level1.lua @@ -8,8 +8,8 @@ return { height = 32, tilewidth = 16, tileheight = 16, - nextlayerid = 6, - nextobjectid = 25, + nextlayerid = 7, + nextobjectid = 30, properties = {}, tilesets = { { @@ -34,7 +34,76 @@ return { height = 16 }, properties = {}, - wangsets = {}, + wangsets = { + { + name = "white_path", + tile = -1, + properties = {}, + colors = { + { + color = { 255, 0, 0 }, + name = "whitePath_terrain", + probability = 1, + tile = -1, + properties = {} + } + }, + wangtiles = { + { + wangid = { 1, 1, 1, 0, 1, 1, 1, 1 }, + tileid = 160 + }, + { + wangid = { 1, 1, 1, 1, 1, 0, 1, 1 }, + tileid = 161 + }, + { + wangid = { 0, 0, 1, 1, 1, 0, 0, 0 }, + tileid = 162 + }, + { + wangid = { 0, 0, 1, 1, 1, 1, 1, 0 }, + tileid = 163 + }, + { + wangid = { 0, 0, 0, 0, 1, 1, 1, 0 }, + tileid = 164 + }, + { + wangid = { 1, 0, 1, 1, 1, 1, 1, 1 }, + tileid = 192 + }, + { + wangid = { 1, 1, 1, 1, 1, 1, 1, 0 }, + tileid = 193 + }, + { + wangid = { 1, 1, 1, 1, 1, 0, 0, 0 }, + tileid = 194 + }, + { + wangid = { 1, 1, 1, 1, 1, 1, 1, 1 }, + tileid = 195 + }, + { + wangid = { 1, 0, 0, 0, 1, 1, 1, 1 }, + tileid = 196 + }, + { + wangid = { 1, 1, 1, 0, 0, 0, 0, 0 }, + tileid = 226 + }, + { + wangid = { 1, 1, 1, 0, 0, 0, 1, 1 }, + tileid = 227 + }, + { + wangid = { 1, 0, 0, 0, 0, 0, 1, 1 }, + tileid = 228 + } + } + } + }, tilecount = 1024, tiles = {} } @@ -57,38 +126,38 @@ return { properties = {}, encoding = "lua", data = { - 0, 0, 0, 0, 0, 0, 0, 0, 0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 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, + 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 195, 197, 8, 6, 6, 8, 8, 8, 7, 7, 8, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 6, + 6, 0, 7, 7, 7, 7, 163, 164, 165, 7, 195, 197, 6, 6, 6, 6, 6, 6, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 6, 0, 7, 7, 6, 163, 194, 196, 197, 6, 195, 197, 6, 6, 6, 6, 6, 6, 163, 164, 164, 165, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 6, 0, 7, 6, 6, 195, 196, 196, 193, 165, 195, 197, 6, 6, 6, 6, 163, 164, 194, 196, 196, 193, 165, 7, 7, 0, 0, 0, 0, 7, 7, 6, + 6, 7, 7, 6, 6, 227, 162, 196, 196, 193, 194, 193, 164, 164, 164, 164, 194, 196, 196, 196, 196, 196, 197, 7, 7, 0, 0, 0, 0, 0, 6, 6, + 6, 7, 7, 7, 7, 163, 194, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 161, 229, 7, 7, 7, 7, 7, 7, 7, 6, 6, + 6, 7, 7, 7, 6, 195, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 193, 165, 7, 7, 7, 7, 7, 0, 0, 6, 6, + 6, 7, 7, 7, 6, 227, 228, 162, 196, 161, 162, 196, 196, 196, 196, 196, 196, 196, 196, 196, 161, 228, 229, 7, 0, 7, 7, 0, 0, 6, 6, 6, + 6, 7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, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 } }, { @@ -157,8 +226,8 @@ return { objects = { { id = 2, - name = "", - type = "", + name = "player", + type = "player", shape = "rectangle", x = 128, y = 112, @@ -167,6 +236,70 @@ return { rotation = 0, visible = true, properties = {} + }, + { + id = 25, + name = "sign", + type = "interactive", + shape = "rectangle", + x = 240, + y = 47.25, + width = 15.5, + height = 17, + rotation = 0, + visible = true, + properties = { + ["data"] = "Beware of the Alien Monster", + ["interactive_type"] = "message_notification" + } + }, + { + id = 26, + name = "potion", + type = "interactive", + shape = "rectangle", + x = 208.5, + y = 80.75, + width = 15, + height = 15.25, + rotation = 0, + visible = true, + properties = { + ["data"] = "Acquired Potion", + ["interactive_type"] = "pickable" + } + }, + { + id = 27, + name = "potion", + type = "interactive", + shape = "rectangle", + x = 176.5, + y = 112.25, + width = 15, + height = 16, + rotation = 0, + visible = true, + properties = { + ["data"] = "Acquired Potion", + ["interactive_type"] = "pickable" + } + }, + { + id = 28, + name = "potion", + type = "interactive", + shape = "rectangle", + x = 224, + y = 112.25, + width = 15.75, + height = 15.25, + rotation = 0, + visible = true, + properties = { + ["data"] = "Acquired Potion", + ["interactive_type"] = "pickable" + } } } }, @@ -332,38 +465,38 @@ return { properties = {}, encoding = "lua", data = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 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, 1, - 1, 0, 0, 0, 129, 130, 0, 0, 0, 0, 33, 34, 0, 0, 0, 3, 132, 133, 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 } } } diff --git a/assets/sfx/heartbeat_fast_0.wav b/assets/sfx/heartbeat_fast_0.wav new file mode 100644 index 0000000..7fd7b2a Binary files /dev/null and b/assets/sfx/heartbeat_fast_0.wav differ diff --git a/assets/sfx/hits/README.txt b/assets/sfx/hits/README.txt new file mode 100644 index 0000000..537ebef --- /dev/null +++ b/assets/sfx/hits/README.txt @@ -0,0 +1,4 @@ +Adapted from Punch, slap, n' kick.wav +by CGEffex +http://freesound.org/people/CGEffex/sounds/98341/ +http://creativecommons.org/licenses/by/3.0/ \ No newline at end of file diff --git a/assets/sfx/monster_growl.wav b/assets/sfx/monster_growl.wav new file mode 100644 index 0000000..9fc1c91 Binary files /dev/null and b/assets/sfx/monster_growl.wav differ diff --git a/assets/sfx/sfx_deathscream_alien1.wav b/assets/sfx/sfx_deathscream_alien1.wav deleted file mode 100644 index 7786710..0000000 Binary files a/assets/sfx/sfx_deathscream_alien1.wav and /dev/null differ diff --git a/conf.lua b/conf.lua index 1ae0863..8fbb0e5 100644 --- a/conf.lua +++ b/conf.lua @@ -4,4 +4,6 @@ function love.conf(t) t.window.fullscreen = false t.window.title = "" t.window.usedpiscale = true + t.window.icon = "assets/images/icon.png" + t.console = true end \ No newline at end of file diff --git a/core/ambience.lua b/core/ambience.lua new file mode 100644 index 0000000..13919d9 --- /dev/null +++ b/core/ambience.lua @@ -0,0 +1,15 @@ +Class = require("libs.hump.class") + +Ambience = Class { + init = function(self, ambienceTypes) + if ambienceTypes then + for i,ambience in pairs(ambienceTypes) do + local ambientSound = love.audio.newSource("assets/sfx/"..ambience..".ogg", "static") + ambientSound:setLooping(true) + ambientSound:play() + end + end + end +} + +return Ambience \ No newline at end of file diff --git a/core/constants.lua b/core/constants.lua new file mode 100644 index 0000000..5284e6d --- /dev/null +++ b/core/constants.lua @@ -0,0 +1,11 @@ +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/core/enitity.lua b/core/enitity.lua new file mode 100644 index 0000000..e69de29 diff --git a/core/map.lua b/core/map.lua new file mode 100644 index 0000000..acbdc4a --- /dev/null +++ b/core/map.lua @@ -0,0 +1,164 @@ +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") +require("libs.tserial") +print(TSerial) +require("core.notifications") + +local zoomFactor = 2 +local player = { + x=0, + y=0, + sprite=love.graphics.newImage("assets/images/player_demo.png"), + speed=100 +} + +local windowWidth, windowHeight = love.graphics.getDimensions() +local _w = windowWidth/zoomFactor +local _h = windowHeight/zoomFactor + +Map = Class { + __include=Gamestate, + init = function(self, mapName) + _gameWorld = Windfield.newWorld(0,0) + _gameWorld:addCollisionClass('player') + _gameWorld:addCollisionClass('interactive') + 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 + + notifications = Notifications(zoomFactor) + 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 + if obj.name=="player" and obj.type=="player" then + player.x = obj.x + player.y = obj.y + player.collider = _gameWorld:newBSGRectangleCollider(player.x, player.y, 8, 8, 0) + + player.collider:setFixedRotation(true) + player.collider:setCollisionClass('player') + end + + if obj.type=="interactive" then + local collider = _gameWorld:newRectangleCollider(obj.x, obj.y, obj.width, obj.height) + local interactiveData = { + type = obj.type, + interactive_type = obj.properties.interactive_type, + data = obj.properties.data + } + collider:setObject(interactiveData) + collider:setCollisionClass('interactive') + collider:setType("static") + end + 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 + + if player.collider:enter('interactive') then + local _interColliderData = player.collider:getEnterCollisionData('interactive') + local interactiveCollider = _interColliderData.collider + local interactiveData = interactiveCollider:getObject() + + if interactiveData.interactive_type=="pickable" then + notifications:send(interactiveData.data) + end + + if interactiveData.interactive_type=="message_notification" then + notifications:send(interactiveData.data) + end + end + notifications:update(dt) +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() + notifications:draw() + 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/core/notifications.lua b/core/notifications.lua new file mode 100644 index 0000000..05950f2 --- /dev/null +++ b/core/notifications.lua @@ -0,0 +1,31 @@ +Class = require("libs.hump.class") +Timer = require("libs.hump.timer") +Notifications = Class { + init = function(self, zoomFactor) + color = {1, 0, 0, 1} + local windowWidth, windowHeight = love.graphics.getDimensions() + end, + _message={} +} + +function Notifications:update(dt) + Timer.update(dt) +end + +function Notifications:draw() + if self._message then + love.graphics.setColor(color) + love.graphics.print(self._message, 10, wind) + 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') +end + +return Notifications \ No newline at end of file diff --git a/core/screen_shaker.lua b/core/screen_shaker.lua new file mode 100644 index 0000000..0316559 --- /dev/null +++ b/core/screen_shaker.lua @@ -0,0 +1,28 @@ +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/monster_growl.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 diff --git a/game_icon.ico b/game_icon.ico new file mode 100644 index 0000000..2f02cfb Binary files /dev/null and b/game_icon.ico differ diff --git a/libs/tserial.lua b/libs/tserial.lua new file mode 100644 index 0000000..c082e14 --- /dev/null +++ b/libs/tserial.lua @@ -0,0 +1,46 @@ +--- TSerial v1.3, a simple table serializer which turns tables into Lua script +-- @author Taehl (SelfMadeSpirit@gmail.com) +TSerial = {} + +--- Serializes a table into a string, in form of Lua script. +-- @param t table to be serialized (may not contain any circular reference) +-- @param drop if true, unserializable types will be silently dropped instead of raising errors +-- if drop is a function, it will be called to serialize unsupported types +-- @param indent if true, output "human readable" mode with newlines and indentation (for debug) +-- @return string recreating given table +function TSerial.pack(t, drop, indent) + assert(type(t) == "table", "Can only TSerial.pack tables.") + local s, indent = "{"..(indent and "\n" or ""), indent and math.max(type(indent)=="number" and indent or 0,0) + for k, v in pairs(t) do + local tk, tv, skip = type(k), type(v) + if tk == "boolean" then k = k and "[true]" or "[false]" + elseif tk == "string" then if string.format("%q",k) ~= '"'..k..'"' then k = '['..string.format("%q",k)..']' end + elseif tk == "number" then k = "["..k.."]" + elseif tk == "table" then k = "["..TSerial.pack(k, drop, indent and indent+1).."]" + elseif type(drop) == "function" then k = "["..string.format("%q",drop(k)).."]" + elseif drop then skip = true + else error("Attempted to TSerial.pack a table with an invalid key: "..tostring(k)) + end + if tv == "boolean" then v = v and "true" or "false" + elseif tv == "string" then v = string.format("%q", v) + elseif tv == "number" then -- no change needed + elseif tv == "table" then v = TSerial.pack(v, drop, indent and indent+1) + elseif type(drop) == "function" then v = "["..string.format("%q",drop(v)).."]" + elseif drop then skip = true + else error("Attempted to TSerial.pack a table with an invalid value: "..tostring(v)) + end + if not skip then s = s..string.rep("\t",indent or 0)..k.."="..v..","..(indent and "\n" or "") end + end + return s..string.rep("\t",(indent or 1)-1).."}" +end + +--- Loads a table into memory from a string (like those output by Tserial.pack) +-- @param s a string of Lua defining a table, such as "{2,4,8,ex="ample"}" +-- @return a table recreated from the given string +function TSerial.unpack(s) + assert(type(s) == "string", "Can only TSerial.unpack strings.") + assert(loadstring("TSerial.table="..s))() + local t = TSerial.table + TSerial.table = nil + return t +end \ No newline at end of file diff --git a/scenes/level1_scene.lua b/scenes/level1_scene.lua index f532703..e5f4ec0 100644 --- a/scenes/level1_scene.lua +++ b/scenes/level1_scene.lua @@ -1,12 +1,14 @@ level1 = {} -- Level1 State -require("utils.screen_shaker") -Map = require("utils.map") +require("core.screen_shaker") +Map = require("core.map") -- imports -require("utils.constants") +require("core.constants") +require("core.ambience") function level1:init() constants.resetColors() screenShake = ScreenShaker() + ambience = Ambience({"atmosphere1","thunder"}) map = Map("level1") end diff --git a/scenes/menu_scene.lua b/scenes/menu_scene.lua index a930dcc..13bf8fd 100644 --- a/scenes/menu_scene.lua +++ b/scenes/menu_scene.lua @@ -3,7 +3,7 @@ menu = {} -- Menu Game State local Timer = require "libs.hump.timer" local Gamestate = require("libs.hump.gamestate") Moonshine = require("libs.moonshine") -require("utils.constants") +require("core.constants") -- scenes require("scenes.level1_scene"); 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 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 -- cgit v1.2.3