feat: greyscale emblem for ko characters
This commit is contained in:
parent
706468dad6
commit
cd174e3153
3 changed files with 38 additions and 5 deletions
23
sonic-radiance.love/game/modules/drawing/greyscale.lua
Normal file
23
sonic-radiance.love/game/modules/drawing/greyscale.lua
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
local GrayScale = {}
|
||||||
|
|
||||||
|
local greyscaleShader = love.graphics.newShader[[
|
||||||
|
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ){
|
||||||
|
vec4 pixel = Texel(texture, texture_coords );//This is the current pixel color
|
||||||
|
number average = (pixel.r+pixel.b+pixel.g)/3.0;
|
||||||
|
pixel.r = average;
|
||||||
|
pixel.g = average;
|
||||||
|
pixel.b = average;
|
||||||
|
return pixel;
|
||||||
|
}
|
||||||
|
]]
|
||||||
|
|
||||||
|
|
||||||
|
function GrayScale.startShader()
|
||||||
|
love.graphics.setShader(greyscaleShader)
|
||||||
|
end
|
||||||
|
|
||||||
|
function GrayScale.endShader()
|
||||||
|
love.graphics.setShader()
|
||||||
|
end
|
||||||
|
|
||||||
|
return GrayScale
|
|
@ -1,4 +1,5 @@
|
||||||
local Emblem = Object:extend()
|
local Emblem = Object:extend()
|
||||||
|
local greyscale = require "game.modules.drawing.greyscale"
|
||||||
|
|
||||||
function Emblem:new(abstract, scene)
|
function Emblem:new(abstract, scene)
|
||||||
self.assets = scene.assets
|
self.assets = scene.assets
|
||||||
|
@ -16,15 +17,27 @@ end
|
||||||
function Emblem:drawForeground(x, y)
|
function Emblem:drawForeground(x, y)
|
||||||
local emblem2 = "m_" .. self.abstract.data.class
|
local emblem2 = "m_" .. self.abstract.data.class
|
||||||
core.screen:setScissor(x, y-16, 32, 40)
|
core.screen:setScissor(x, y-16, 32, 40)
|
||||||
|
if (self.abstract.hp > 0) then
|
||||||
self.assets.sprites[self.charid]:drawAnimation(x+14, y+14)
|
self.assets.sprites[self.charid]:drawAnimation(x+14, y+14)
|
||||||
|
else
|
||||||
|
greyscale.startShader()
|
||||||
|
self.assets.sprites[self.charid]:drawFrame(1, x+14, y+14)
|
||||||
|
end
|
||||||
core.screen:resetScissor( )
|
core.screen:resetScissor( )
|
||||||
self.assets.images[emblem2]:draw(x, y)
|
self.assets.images[emblem2]:draw(x, y)
|
||||||
|
greyscale.endShader()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Emblem:drawBackground(x, y)
|
function Emblem:drawBackground(x, y)
|
||||||
local emblem1 = "e_" .. self.abstract.data.class
|
local emblem1 = "e_" .. self.abstract.data.class
|
||||||
|
|
||||||
|
if (self.abstract.hp > 0) then
|
||||||
self.assets.images[emblem1]:draw(x, y)
|
self.assets.images[emblem1]:draw(x, y)
|
||||||
|
else
|
||||||
|
greyscale.startShader()
|
||||||
|
self.assets.images[emblem1]:draw(x, y)
|
||||||
|
greyscale.endShader()
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,7 @@ local StatusBar = require "game.modules.gui.statusbar"
|
||||||
local SelectionSystem = require "scenes.battlesystem.controllers.fighters.systems.selection"
|
local SelectionSystem = require "scenes.battlesystem.controllers.fighters.systems.selection"
|
||||||
local actionList = require "scenes.battlesystem.controllers.fighters.systems.actions"
|
local actionList = require "scenes.battlesystem.controllers.fighters.systems.actions"
|
||||||
|
|
||||||
local POSITIONS = {3, 1, 5}
|
|
||||||
local HEROES_LINE = 2;
|
local HEROES_LINE = 2;
|
||||||
|
|
||||||
local HUDBASE = 8
|
|
||||||
local HUDSIZE = 91
|
local HUDSIZE = 91
|
||||||
|
|
||||||
function HeroFighter:new(owner, character, id)
|
function HeroFighter:new(owner, character, id)
|
||||||
|
|
Loading…
Reference in a new issue