aboutsummaryrefslogtreecommitdiff
path: root/scenes
diff options
context:
space:
mode:
authorIndrajith K L2022-02-28 02:48:20 +0530
committerIndrajith K L2022-02-28 02:48:20 +0530
commit48a80e29d52ded091d1f9425315957892f0070f7 (patch)
treefd30745880ccfb01ff066c33c1ab4b538363796f /scenes
parent16db60e07d19f8c7c2138839a004b73242e80b19 (diff)
downloadYEAD-48a80e29d52ded091d1f9425315957892f0070f7.tar.gz
YEAD-48a80e29d52ded091d1f9425315957892f0070f7.tar.bz2
YEAD-48a80e29d52ded091d1f9425315957892f0070f7.zip
* Fixes DELTA issue in GameState => Map Class
* Shader Changes in Menu * Adds New Particles generator for Starfield * Player Movement * Basic Collision Detection
Diffstat (limited to 'scenes')
-rw-r--r--scenes/level1_scene.lua14
-rw-r--r--scenes/menu_scene.lua51
2 files changed, 39 insertions, 26 deletions
diff --git a/scenes/level1_scene.lua b/scenes/level1_scene.lua
index 5b774ea..30406df 100644
--- a/scenes/level1_scene.lua
+++ b/scenes/level1_scene.lua
@@ -4,28 +4,24 @@ Map = require("utils.map")
-- imports
require("utils.constants")
-local map = nil
-
function level1:init()
- constants.resetColors()
- map = Map("level1")
+ constants.resetColors()
+ map = Map("level1")
end
function level1:enter(previous)
-
end
function level1:update(dt)
- map.update(dt)
+ map:update(dt)
end
function level1:draw()
- map.draw()
- --love.graphics.print("Level 1", 100, 200)
+ map:draw()
end
function level1:keypressed(key, scancode)
- map.keypressed(key, scancode)
+ map:keypressed(key, scancode)
end
function level1:leave()
diff --git a/scenes/menu_scene.lua b/scenes/menu_scene.lua
index a513d6d..a930dcc 100644
--- a/scenes/menu_scene.lua
+++ b/scenes/menu_scene.lua
@@ -2,7 +2,8 @@ menu = {} -- Menu Game State
local Timer = require "libs.hump.timer"
local Gamestate = require("libs.hump.gamestate")
-
+Moonshine = require("libs.moonshine")
+require("utils.constants")
-- scenes
require("scenes.level1_scene");
@@ -13,10 +14,18 @@ local windowWidth = love.graphics.getWidth()
local windowHeight = love.graphics.getHeight()
function menu:init()
- print("Entering Menu")
titleFont = love.graphics.newFont('assets/fonts/minecraftia.ttf', titleFontSize)
startMsgFont = love.graphics.newFont('assets/fonts/minecraftia.ttf', msgFontSize)
music = love.audio.newSource("assets/music/Stevia Sphere - Drum machine dreams.ogg", "stream")
+ 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
+
music:setLooping(true)
msgFontColor = {0, 0, 0}
titleFontColor = {1, 1, 1}
@@ -32,6 +41,7 @@ function menu:init()
fadeIn()
music:play()
+ constants.resetColors()
end
function menu:enter(previous)
@@ -48,15 +58,16 @@ function menu:update(dt)
end
function menu:draw()
- love.graphics.setFont(titleFont)
- love.graphics.setColor(titleFontColor)
- 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.setFont(startMsgFont)
- love.graphics.setColor(msgFontColor)
- love.graphics.print("Press X to START", (windowWidth * 0.5) - (msgFontSize * (defaultFontFactor/1.5)), windowHeight - 50)
-
+ effect(function()
+ love.graphics.setFont(titleFont)
+ love.graphics.setColor(titleFontColor)
+ 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.setFont(startMsgFont)
+ love.graphics.setColor(msgFontColor)
+ love.graphics.print("Press X to START", (windowWidth * 0.5) - (msgFontSize * (defaultFontFactor/1.5)), windowHeight - 50)
+ end)
end
function menu:keyreleased(key, scancode)
@@ -67,12 +78,18 @@ end
function generateStarfield()
image = love.graphics.newImage("assets/images/particle.png")
- psystem = love.graphics.newParticleSystem(image, 500)
- psystem:setParticleLifetime(2, 15) -- Particles live at least 2s and at most 5s.
- psystem:setEmissionRate(500)
- psystem:setSizeVariation(1)
- psystem:setLinearAcceleration(-20, -20, 20, 20) -- Random movement in all directions.
- psystem:setColors(1, 1, 1, 1, 1, 1, 1, 0) -- Fade to transparency.
+ psystem = love.graphics.newParticleSystem(image, 2500)
+ psystem:setEmissionRate(466.67)
+ psystem:setParticleLifetime(2*.5, 2)
+ psystem:setSizeVariation(0.63)
+ psystem:setRadialAcceleration(946.67*0.5, 946.67*0.5)
+ psystem:setColors(love.math.random(), 1, love.math.random(), 1, love.math.random(), 1, 1, 0)
+ psystem:setEmissionArea('normal', 39, 39)
+ psystem:setDirection(-4.79)
+ psystem:setSizes(3.13, 3, 0.1)
+ psystem:setSizeVariation(0.63)
+ psystem:setTangentialAcceleration(500*0.5, 500)
+
return psystem
end