1
0
Fork 0
mirror of https://github.com/ctruLua/ctruLua.git synced 2025-10-27 16:39:29 +00:00

Fixed the the getBox() function (only usable in the library)

This commit is contained in:
Firew0lf 2015-09-01 18:23:12 +02:00
parent e8471ce6e6
commit e0ff7ad9c4

View file

@ -4,10 +4,12 @@ local mod = {}
-- Module functions
local function getBox(tx, ty, i, sx, sy)
x = (i%tx)
y = math.floor(i/tx)
x = ((i*sx)%tx)
y = math.floor((i*sx)/tx)*sy
gfx.text(150, 150, tx.."/"..ty.." -> "..x.."/"..y)
return (x*sx), (y*sy)
return x, y
end
-- Sprite object methods
@ -39,10 +41,12 @@ end
-- Set to 0 to hide the sprite
local function setAnimation(self, anim)
self.currentAnimation = anim
self.currentFrame = 1
if not self.animations[anim] then
return false
end
if not self.animations[anim].animation[self.currentFrame] then
self.currentFrame = 1
end
return true
end