summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrew Havens <[email protected]>2017-12-23 01:11:46 -0800
committerTom Black <[email protected]>2018-01-02 20:12:46 -0800
commit038cd2f1a5b99dbc523b8b2b42551e0261e83aa7 (patch)
tree5cfd5c5cff566926a6801fc6ebd11756301e4376
parent4de4bdc2147b2e0aab1c9d7d1200d2dc61d75d55 (diff)
downloadruby2d-038cd2f1a5b99dbc523b8b2b42551e0261e83aa7.tar.gz
ruby2d-038cd2f1a5b99dbc523b8b2b42551e0261e83aa7.zip
Add ability to get width/height based on current frame of animation.
-rw-r--r--lib/ruby2d/sprite.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ruby2d/sprite.rb b/lib/ruby2d/sprite.rb
index 5e88975..e6a6efa 100644
--- a/lib/ruby2d/sprite.rb
+++ b/lib/ruby2d/sprite.rb
@@ -63,6 +63,14 @@ module Ruby2D
end
end
+ def width
+ @current_animation ? @animations[@current_animation][@current_frame][2] : @default[2]
+ end
+
+ def height
+ @current_animation ? @animations[@current_animation][@current_frame][3] : @default[3]
+ end
+
private
def clip(x, y, w, h)