On Sat, Jul 19, 2008 at 08:55:43AM +0000, Ryan Sattler wrote:
> Hi,I've been writing a little game (a bejewelled clone) in Shoes using
> Windows XP. I want to pause the app at certain points during the resolution
> of a move in order to create a crude animation so that the player can see
> what is happening. However, if I try to use Kernel.pause in the main code of
> the game (outside of the Shoes.app block), Shoes doesn't work any more (it
> starts but never pops up a window).
Do you mean Kernel.sleep? What you'll need to do is use `start` and
`stop` on the animation to pause it. Or there is a method called
`toggle` which will switch between paused and un-paused whenever
it's used.
Shoes.app do
@shape = oval 10, 10, 30, 30
@anim = animate do |i|
@shape.displace(0, (Math.sin(i) * 6).to_i)
end
flow :margin_top => 70 do
button "Pause" do
@anim.toggle
end
end
end
_why