设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3159|回复: 19
打印 上一主题 下一主题

[已经解决] 新手菜单第四章的“半身像”错在最后一步,求助。

[复制链接]

Lv2.观梦者

梦石
0
星屑
325
在线时间
252 小时
注册时间
2014-4-11
帖子
265
跳转到指定楼层
1
发表于 2015-9-23 21:14:12 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x


之前的帖子犯了理解错误,现在的问题是,在半身像教程前面的步骤都有戏没有影响,但唯独到了最后一步会报错,不太理解“def draw_item(index)部分”指的仅仅是“def draw_item(index)”这一小段,还是指什么……

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9397
在线时间
2748 小时
注册时间
2008-9-5
帖子
3543

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

2
发表于 2015-9-23 21:24:41 | 只看该作者
截图不完整但看起来像是括弧没对好……
检查脚本上下文是否有多余或者没配对的括弧?
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
325
在线时间
252 小时
注册时间
2014-4-11
帖子
265
3
 楼主| 发表于 2015-9-23 21:34:39 | 只看该作者
cinderelmini 发表于 2015-9-23 21:24
截图不完整但看起来像是括弧没对好……
检查脚本上下文是否有多余或者没配对的括弧? ...

这个是又改回去了,直接用“draw_actor_HalfBody(actor, rect.x, rect.y, enabled)“替换”draw_item(index)“的话就会出错
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
325
在线时间
252 小时
注册时间
2014-4-11
帖子
265
4
 楼主| 发表于 2015-9-23 21:37:45 | 只看该作者
cinderelmini 发表于 2015-9-23 21:24
截图不完整但看起来像是括弧没对好……
检查脚本上下文是否有多余或者没配对的括弧? ...

只有一句话不知道该怎么改……
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (版主)

…あたしは天使なんかじゃないわ

梦石
0
星屑
2208
在线时间
4033 小时
注册时间
2010-10-4
帖子
10779

开拓者贵宾

5
发表于 2015-9-23 21:40:48 | 只看该作者
本帖最后由 taroxd 于 2015-9-23 21:42 编辑
眼中目之瞳 发表于 2015-9-23 21:37
只有一句话不知道该怎么改……


指的应该是修改方法体吧

RUBY 代码复制
  1. def show
  2.   # 方法体从这里开始
  3.   puts "hello world"
  4.   # 到这里结束
  5. end
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
325
在线时间
252 小时
注册时间
2014-4-11
帖子
265
6
 楼主| 发表于 2015-9-23 21:45:48 | 只看该作者
taroxd 发表于 2015-9-23 21:40
指的应该是修改方法体吧

def show

嗯,所以具体是怎么改……
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
325
在线时间
252 小时
注册时间
2014-4-11
帖子
265
7
 楼主| 发表于 2015-9-23 21:52:46 | 只看该作者
本帖最后由 眼中目之瞳 于 2015-9-23 22:00 编辑
taroxd 发表于 2015-9-23 21:40
指的应该是修改方法体吧

def show


RUBY 代码复制
  1. def show
  2.   # 方法体从这里开始
  3.   puts "draw_actor_HalfBody(actor, rect.x, rect.y, enabled)"
  4.   # 到这里结束
  5. end


这样一弄头像和血量都消失了,【修改————】



不知道半身像怎么排列,跟头像图片同一名字一种排列方法还空白……
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
325
在线时间
252 小时
注册时间
2014-4-11
帖子
265
8
 楼主| 发表于 2015-9-23 22:09:17 | 只看该作者
taroxd 发表于 2015-9-23 21:40
指的应该是修改方法体吧

def show

而且面向新人的话,如果要加额外的代码原LZ也应该会贴出来才对……
回复 支持 反对

使用道具 举报

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9397
在线时间
2748 小时
注册时间
2008-9-5
帖子
3543

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

9
发表于 2015-9-23 23:59:11 | 只看该作者
眼中目之瞳 发表于 2015-9-23 21:37
只有一句话不知道该怎么改……

所以把你出错的那篇代码发出来可行?
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
325
在线时间
252 小时
注册时间
2014-4-11
帖子
265
10
 楼主| 发表于 2015-9-24 05:20:07 | 只看该作者
cinderelmini 发表于 2015-9-23 23:59
所以把你出错的那篇代码发出来可行?

RUBY 代码复制
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Window_MenuStatus
  4. #------------------------------------------------------------------------------
  5. #  菜单画面中,显示队伍成员状态的窗口
  6. #==============================================================================
  7.  
  8. class Window_MenuStatus < Window_Selectable
  9.   #--------------------------------------------------------------------------
  10.   # ● 定义实例变量
  11.   #--------------------------------------------------------------------------
  12.   attr_reader   :pending_index            # 保留位置(整队用)
  13.   #--------------------------------------------------------------------------
  14.   # ● 初始化对象
  15.   #--------------------------------------------------------------------------
  16.   def initialize(x, y)
  17.     super(x, y, window_width, window_height)
  18.     @pending_index = -1
  19.     refresh
  20.   end
  21. #--------------------------------------------------------------------------
  22.   # ● 获取窗口的宽度
  23.   #--------------------------------------------------------------------------
  24.   def window_width
  25.     Graphics.width
  26.   end
  27.   #--------------------------------------------------------------------------
  28.   # ● 获取窗口的高度
  29.   #--------------------------------------------------------------------------
  30.   def window_height
  31.     Graphics.height - 96
  32.   end
  33. #--------------------------------------------------------------------------
  34.   # ● 获取项目数
  35.   #--------------------------------------------------------------------------
  36.   def item_max
  37.     $game_party.members.size
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● 获取项目的高度
  41.   #--------------------------------------------------------------------------
  42.   def item_height
  43.     height - standard_padding * 2
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 获取项目的宽度
  47.   #--------------------------------------------------------------------------
  48.   def item_width
  49.     (width - standard_padding * 2 + spacing) /col_max - spacing
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● 获取行间距的宽度
  53.   #--------------------------------------------------------------------------
  54.   def spacing
  55.     return 0
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● 绘制项目
  59.   #--------------------------------------------------------------------------
  60.    def show
  61.   # 方法体从这里开始
  62.   puts "draw_actor_HalfBody(actor, rect.x, rect.y, enabled)"
  63.   # 到这里结束
  64. end
  65.  
  66.   #--------------------------------------------------------------------------
  67.   # ● 绘制项目的背景
  68.   #--------------------------------------------------------------------------
  69.   def draw_item_background(index)
  70.     if index == @pending_index
  71.       contents.fill_rect(item_rect(index), pending_color)
  72.     end
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ● 按下确定键时的处理
  76.   #--------------------------------------------------------------------------
  77.   def process_ok
  78.     super
  79.     $game_party.menu_actor = $game_party.members[index]
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 返回上一个选择的位置
  83.   #--------------------------------------------------------------------------
  84.   def select_last
  85.     select($game_party.menu_actor.index || 0)
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 设置保留位置(整队用)
  89.   #--------------------------------------------------------------------------
  90.   def pending_index=(index)
  91.     last_pending_index = @pending_index
  92.     @pending_index = index
  93.     redraw_item(@pending_index)
  94.     redraw_item(last_pending_index)
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● 获取列数
  98.   #--------------------------------------------------------------------------
  99.   def col_max
  100.     return 4 #跟据分辨率的不同可以改
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 获取首列位置
  104.   #--------------------------------------------------------------------------
  105.   def top_col
  106.     ox / (item_width + spacing)
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ● 设置首列位置
  110.   #--------------------------------------------------------------------------
  111.   def top_col=(col)
  112.     col = 0 if col < 0
  113.     #col = col_max - 1 if col > col_max
  114.     self.ox = col * (item_width + spacing)
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● 获取尾列位置
  118.   #--------------------------------------------------------------------------
  119.   def bottom_col
  120.     top_col + col_max - 1
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 设置尾列位置
  124.   #--------------------------------------------------------------------------
  125.   def bottom_col=(col)
  126.     self.top_col = col - (col_max - 1)
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ● 确保光标在画面范围内滚动
  130.   #--------------------------------------------------------------------------
  131.   def ensure_cursor_visible
  132.     self.top_col = index if index < top_col
  133.     self.bottom_col = index if index > bottom_col
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ● 获取项目的绘制矩形
  137.   #--------------------------------------------------------------------------
  138.   def item_rect(index)
  139.     rect = super
  140.     rect.x = index * (item_width + spacing)
  141.     rect.y = 0
  142.     rect
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # ● 获取对齐方向
  146.   #--------------------------------------------------------------------------
  147.   def alignment
  148.     return 1
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● 光标向下移动
  152.   #--------------------------------------------------------------------------
  153.   def cursor_down(wrap = false)
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 光标向上移动
  157.   #--------------------------------------------------------------------------
  158.   def cursor_up(wrap = false)
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● 光标移至下一页
  162.   #--------------------------------------------------------------------------
  163.   def cursor_pagedown
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 光标移至上一页
  167.   #--------------------------------------------------------------------------
  168.   def cursor_pageup
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● 计算窗口内容的宽度
  172.   #--------------------------------------------------------------------------
  173.   def contents_width
  174.     (item_width + spacing) * item_max - spacing
  175.   end
  176.     #--------------------------------------------------------------------------
  177.   # ● 计算窗口内容的宽度
  178.   #--------------------------------------------------------------------------
  179.   def contents_height
  180.     item_height
  181.   end
  182. end


这个是已经按“taroxd”的建议改完的,不会报错但不显示头像和数值。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-24 04:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表