diff options
| author | Tom Black <[email protected]> | 2018-09-04 00:45:00 -0700 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2018-09-12 14:40:27 -0700 |
| commit | 632e007e711ba8e4e7d9b3a39cd64e32ca58afd1 (patch) | |
| tree | d28aeacc312c2e736ceb2028f21c234738cbfbf5 /test/testcard.rb | |
| parent | 36754d58e1e17c11cc243f896d63cd9e1daf95ed (diff) | |
| download | ruby2d-632e007e711ba8e4e7d9b3a39cd64e32ca58afd1.tar.gz ruby2d-632e007e711ba8e4e7d9b3a39cd64e32ca58afd1.zip | |
Sprite enhancements
Add ability to flip the sprite, run a block after an animation, properly change the width and height, and other fixes.
Diffstat (limited to 'test/testcard.rb')
| -rw-r--r-- | test/testcard.rb | 17 |
1 files changed, 8 insertions, 9 deletions
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 |
