From 038cd2f1a5b99dbc523b8b2b42551e0261e83aa7 Mon Sep 17 00:00:00 2001 From: Andrew Havens Date: Sat, 23 Dec 2017 01:11:46 -0800 Subject: Add ability to get width/height based on current frame of animation. --- lib/ruby2d/sprite.rb | 8 ++++++++ 1 file changed, 8 insertions(+) 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) -- cgit v1.2.3