diff options
author | Aki <nthirtyone@gmail.com> | 2016-07-16 05:13:47 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2016-07-16 05:13:47 +0200 |
commit | 937f24699ce35a0c42b67c0fa8c1de8b9947b6a0 (patch) | |
tree | 47ff6545dccaeb075e875bb5a12512619b07e39d /main.lua | |
parent | 6055ca3eacf8b28b76132d4709d5da36814d6811 (diff) | |
download | roflnauts-937f24699ce35a0c42b67c0fa8c1de8b9947b6a0.zip roflnauts-937f24699ce35a0c42b67c0fa8c1de8b9947b6a0.tar.gz roflnauts-937f24699ce35a0c42b67c0fa8c1de8b9947b6a0.tar.bz2 |
Sprites color keying and new sprites
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -2,17 +2,33 @@ -- WHOLE CODE HAS FLAG OF "need a cleanup" -- Pretend you didn't see this +-- This is work for scene manager Scene = nil function changeScene(scene) Scene = scene end +-- Should be moved to scene/camera function getScale() return math.max(1, math.floor(love.graphics.getWidth() / 320)-1, math.floor(love.graphics.getHeight() / 180)-1) end function getRealScale() return math.max(love.graphics.getWidth() / 320, love.graphics.getHeight() / 180) end +-- Should be moved anywhere; engine object +function newImage(path) + local imagedata = love.image.newImageData(path) + local transparency = function(x, y, r, g, b, a) + if (r == 0 and g == 128 and b == 64) or + (r == 0 and g == 240 and b == 6) then + a = 0 + end + return r, g, b, a + end + imagedata:mapPixel(transparency) + local image = love.graphics.newImage(imagedata) + return image +end -- Require require "world" |