From 632e007e711ba8e4e7d9b3a39cd64e32ca58afd1 Mon Sep 17 00:00:00 2001 From: Tom Black Date: Tue, 4 Sep 2018 00:45:00 -0700 Subject: Sprite enhancements Add ability to flip the sprite, run a block after an animation, properly change the width and height, and other fixes. --- test/testcard.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'test/testcard.rb') diff --git a/test/testcard.rb b/test/testcard.rb index 4e629bc..7ae153f 100644 --- a/test/testcard.rb +++ b/test/testcard.rb @@ -221,13 +221,14 @@ Text.new(x: 144, y: 202, text: "B", font: font, color: [0.0, 0.0, 1.0, 1.0]) fps = Text.new(x: 10, y: 470, text: "", font: font) # Sprites -s1 = Sprite.new(450, 200, "#{media}/sprite_sheet.png") -s1.add(forwards: [ - [ 0, 0, 50, 50, 30], - [ 50, 0, 50, 50, 40], - [100, 0, 50, 50, 50], - [150, 0, 50, 50, 60] -]) +spr = Sprite.new( + "#{media}/sprite_sheet.png", + x: 450, y: 200, + clip_width: 50, + time: 500, + loop: true +) +spr.play # Pointer for mouse pointer = Square.new(size: 10) @@ -293,8 +294,6 @@ update do pointer_outline.color = [0, 1, 0, 0] end - s1.animate(:forwards) - if (get :frames) % 20 == 0 fps.text = "FPS: #{(get :fps).round(3)}" end -- cgit v1.2.3