| 赞 | 2 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2020-7-27 |
| 在线时间 | 1379 小时 |
- 梦石
- 0
- 星屑
- 76
- 在线时间
- 1379 小时
- 注册时间
- 2012-7-5
- 回帖
- 1643

|
发表于 2015-8-27 10:48:26
|
显示全部楼层
插入Main前即可 需要别的特技自己加
- class Object
- def tap
- yield self
- return self
- end
- end
- class << Color
- def white
- new 255, 255, 255
- end
- def empty
- new 0, 0, 0, 0
- end
- end
- class Bitmap
- def clear_rect *a
- fill_rect case a.size
- when 1 then a[0]
- when 4 then a
- end, Color.empty
- end
- end
- def sign i, b = true
- i > 0 ? 1 : b ? i < 0 ? -1 : 0 : i == 0 ? 1 : -1
- end
- def dbfd a, b, c
- (a - b).abs < c ? sign(a - b) : (a - b) / c
- end
- def center obj
- obj.x = 320 - obj.src_rect.width / 2
- obj.y = 240 - obj.src_rect.height / 2
- obj
- end
- def sprite_with bitmap, x, y, w, h
- Sprite.new.tap { |s|
- s.bitmap = bitmap
- s.src_rect = Rect.new x, y, w, h
- }
- end
- def white_block w, h
- sprite_with Bitmap.new(w, h).tap { |b|
- b.fill_rect b.rect, Color.white
- }, 0, 0, w, h
- end
- 雪碧条 = center white_block 320, 24
- 雪碧条.src_rect.width = 0
- loop do
- Graphics.update
- Input.update
- break if 雪碧条.src_rect.width == 320
- 雪碧条.src_rect.width += dbfd 320, 雪碧条.src_rect.width, 9
- end
- 雪碧条.bitmap.dispose
- 雪碧条.dispose
复制代码 |
评分
-
查看全部评分
|