Changeset 132 for trunk/samples
- Timestamp:
- 08/23/2007 11:23:01 (13 months ago)
- Files:
-
- 1 modified
-
trunk/samples/bounce.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/samples/bounce.rb
r131 r132 1 size = 602 1 xspeed, yspeed = 8.4, 6.6 3 2 xdir, ydir = 1, 1 4 3 5 4 Shoes.app do 5 background greenyellow 6 6 nostroke 7 icon = image "static/shoes-icon.png", :left => 100, :top => 100 8 7 9 x, y = self.width / 2, self.height / 2 10 size = icon.size 8 11 animate(30) do 9 clear do 10 background greenyellow 11 x += xspeed * xdir 12 y += yspeed * ydir 12 x += xspeed * xdir 13 y += yspeed * ydir 13 14 14 xdir *= -1 if x > self.width - sizeor x < 015 ydir *= -1 if y > self.height - sizeor y < 015 xdir *= -1 if x > self.width - size[0] or x < 0 16 ydir *= -1 if y > self.height - size[1] or y < 0 16 17 17 oval :left => x + size / 2, :top => y + size / 2, :radius => size, :center => true 18 end 18 icon.move x.to_i, y.to_i 19 19 end 20 20 end
