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:
parent
e8471ce6e6
commit
e0ff7ad9c4
1 changed files with 8 additions and 4 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue