From 7bdcdc5bfaa9d0b008b92eb71a3a67b6be30932a Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 6 May 2019 20:43:51 +0200 Subject: [PATCH] modules/assets: add getDimensions() to tileset, sprite and animators --- gamecore/modules/assets/animator.lua | 4 ++++ gamecore/modules/assets/sprites.lua | 4 ++++ gamecore/modules/assets/tileset.lua | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/gamecore/modules/assets/animator.lua b/gamecore/modules/assets/animator.lua index b64c293..1498153 100644 --- a/gamecore/modules/assets/animator.lua +++ b/gamecore/modules/assets/animator.lua @@ -106,6 +106,10 @@ function Animator:animationExist(name) return (self.sprite.data.animations[self.currentAnimation] ~= nil) end +function Animator:getDimensions() + return self.sprite:getDimensions() +end + -- DRAW FUNCTIONS -- Draw animations using these functions diff --git a/gamecore/modules/assets/sprites.lua b/gamecore/modules/assets/sprites.lua index 1282363..ddf4f89 100644 --- a/gamecore/modules/assets/sprites.lua +++ b/gamecore/modules/assets/sprites.lua @@ -70,6 +70,10 @@ function Sprite:animationExist(name) return self.animator:animationExist(name) end +function Sprite:getDimensions() + return self.tileset:getDimensions() +end + -- DRAW FUNCTIONS -- Draw sprites using these functions diff --git a/gamecore/modules/assets/tileset.lua b/gamecore/modules/assets/tileset.lua index 9c83c4f..55d6643 100644 --- a/gamecore/modules/assets/tileset.lua +++ b/gamecore/modules/assets/tileset.lua @@ -86,6 +86,10 @@ function Tileset:getTile(n) return self.quads[n] end +function Tileset:getDimensions() + return self.width, self.height +end + -- DRAW FUNCTIONS -- Draw tileset using these functions