Project1

标题: show脚本显示图片 [打印本页]

作者: 俄罗斯方块    时间: 2014-4-26 23:34
标题: show脚本显示图片
本帖最后由 俄罗斯方块 于 2014-4-27 13:03 编辑

我在picture文件夹里放了张图命名为"123",然后用脚本$game_map.screen.pictures.show("123", 0, 0, 200, 50, 50, 255, 0)来显示这个图片。
但系统报错,说没有找到方法"show"。
别告诉我用事件自带的显示图片的功能,我想知道我错在哪儿。
作者: 喵呜喵5    时间: 2014-4-27 00:33
$game_map.screen.pictures属于Game_Pictures类,代码如下:
  1. class Game_Pictures
  2.   #--------------------------------------------------------------------------
  3.   # ● 初始化对象
  4.   #--------------------------------------------------------------------------
  5.   def initialize
  6.     @data = []
  7.   end
  8.   #--------------------------------------------------------------------------
  9.   # ● 获取图片
  10.   #--------------------------------------------------------------------------
  11.   def [](number)
  12.     @data[number] ||= Game_Picture.new(number)
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 迭代
  16.   #--------------------------------------------------------------------------
  17.   def each
  18.     @data.compact.each {|picture| yield picture } if block_given?
  19.   end
  20. end
复制代码
而你要的show方法则在Game_Picture类里面
作者: 俄罗斯方块    时间: 2014-4-27 11:38
喵呜喵5 发表于 2014-4-27 00:33
$game_map.screen.pictures属于Game_Pictures类,代码如下:而你要的show方法则在Game_Picture类里面 ...
  1. xxx = Game_Picture.new(1)
  2. xxx.show("123",1,0,0,50,50,150,1)
复制代码
我用这个脚本,确实也没报错了。
可是图片并没有显示出来啊?
作者: 喵呜喵5    时间: 2014-4-27 12:58
俄罗斯方块 发表于 2014-4-27 11:38
我用这个脚本,确实也没报错了。
可是图片并没有显示出来啊?

$game_map.screen.pictures[1].show("123",1,0,0,50,50,150,1)
作者: 俄罗斯方块    时间: 2014-4-27 13:03
喵呜喵5 发表于 2014-4-27 12:58
$game_map.screen.pictures[1].show("123",1,0,0,50,50,150,1)

谢谢。问题解决了。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1