summaryrefslogtreecommitdiffhomepage
path: root/test/sprite.rb
diff options
context:
space:
mode:
authorTom Black <[email protected]>2018-10-11 22:48:47 -0700
committerTom Black <[email protected]>2018-10-11 22:48:47 -0700
commita4a7e23038e26ecc63d94b5e815c36dff2ffb433 (patch)
tree45f937c897466f25be07203032026953f0acea25 /test/sprite.rb
parentee4a4815b65f4d785cb8167717a1bc436e8b7674 (diff)
downloadruby2d-a4a7e23038e26ecc63d94b5e815c36dff2ffb433.tar.gz
ruby2d-a4a7e23038e26ecc63d94b5e815c36dff2ffb433.zip
Sprite `play` method now takes opts hash
Diffstat (limited to 'test/sprite.rb')
-rw-r--r--test/sprite.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/sprite.rb b/test/sprite.rb
index e62488b..e0042b7 100644
--- a/test/sprite.rb
+++ b/test/sprite.rb
@@ -84,7 +84,7 @@ atlas = Sprite.new(
}
)
-atlas.play :count, :loop
+atlas.play animation: :count, loop: true
on :key_down do |e|
@@ -95,9 +95,9 @@ on :key_down do |e|
coin1.play
coin2.play
boom.play
- atlas.play :count
+ atlas.play animation: :count
when 'b'
- boom.play nil, nil, nil do
+ boom.play do
puts "Boom animation finished!"
end
when 's'
@@ -106,33 +106,33 @@ on :key_down do |e|
hero.stop
atlas.stop
when 'left'
- hero.play :walk, :loop, :flip_h
+ hero.play animation: :walk, loop: true, flip: :horizontal
when 'right'
- hero.play :walk, :loop
+ hero.play animation: :walk, loop: true
when 'up'
- hero.play :climb, :loop
+ hero.play animation: :climb, loop: true
when 'down'
- hero.play :climb, :loop, :flip_v
+ hero.play animation: :climb, loop: true, flip: :vertical
when 'h'
- hero.play :climb, :loop, :flip_hv
+ hero.play animation: :climb, loop: true, flip: :both
when 'c'
- hero.play :cheer
+ hero.play animation: :cheer
end
end
on :key_held do |e|
case e.key
when 'a'
- hero.play :walk, :loop, :flip_h
+ hero.play animation: :walk, loop: true, flip: :horizontal
hero.x -= 1
when 'd'
- hero.play :walk, :loop
+ hero.play animation: :walk, loop: true
hero.x += 1
when 'w'
- hero.play :climb, :loop
+ hero.play animation: :climb, loop: true
hero.y -= 1
when 's'
- hero.play :climb, :loop, :flip_v
+ hero.play animation: :climb, loop: true, flip: :vertical
hero.y += 1
when 'z'
hero.width = get(:mouse_x)