7 Star 15 Fork 6

紫荊 / TankGame

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bomb.rb 549 Bytes
一键复制 编辑 原始数据 按行查看 历史
紫荊 提交于 2017-06-14 22:05 . 爆炸类
# -*- coding: UTF-8 -*-
module TankGame
# 爆炸类
class Bomb
# 构造器方法
def initialize tg, x, y
@tg, @x, @y = tg, x, y
@step = 0
end
# 画爆炸
def draw cr
img = @tg.bomb_image[@step/4].scale Tank::WIDTH, Tank::HEIGHT # 设置图片宽高
cr.set_source_pixbuf(img, @x, @y).paint # 设置来源,并画出图片
@step == 11 ? @tg.bombs.delete(self) : @step += 1 # 以动画形式切换图片
end
end
end
Ruby
1
https://gitee.com/ysjrdfaps/tankgame.git
git@gitee.com:ysjrdfaps/tankgame.git
ysjrdfaps
tankgame
TankGame
master

搜索帮助