加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 黑米馒头 于 2024-2-11 20:55 编辑
在游戏里设置 种族,但是当游戏保存之后,在数据库重新添加一个角色,然后读档的时候就会出现脚本错误,因为新添加的角色没有种族,导致下面图片也显示不出来了
下面这段脚本怎么会跳出脚本错误,看不懂?
def draw_actor_zhongzu(actor, x, y) # 文本内容 text = "Graphics/Pictures/图片显示/头像/种族/" # 种族分歧 case actor.zhongzu # 人族 when "人"; facename = text + "人" # 仙族 when "仙"; facename = text + "仙" # 妖族 when "妖"; facename = text + "妖" # 兽族 when "兽"; facename = text + "兽" # 巫族 when "巫"; facename = text + "巫" # 鬼族 when "鬼"; facename = text + "鬼" end bitmap = Bitmap.new(facename) src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) self.contents.blt(x, y, bitmap, src_rect) self.z = 9999 end
def draw_actor_zhongzu(actor, x, y)
# 文本内容
text = "Graphics/Pictures/图片显示/头像/种族/"
# 种族分歧
case actor.zhongzu
# 人族
when "人"; facename = text + "人"
# 仙族
when "仙"; facename = text + "仙"
# 妖族
when "妖"; facename = text + "妖"
# 兽族
when "兽"; facename = text + "兽"
# 巫族
when "巫"; facename = text + "巫"
# 鬼族
when "鬼"; facename = text + "鬼"
end
bitmap = Bitmap.new(facename)
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(x, y, bitmap, src_rect)
self.z = 9999
end
|