赞 | 5 |
VIP | 359 |
好人卡 | 195 |
积分 | 3 |
经验 | 560179 |
最后登录 | 2024-5-17 |
在线时间 | 1373 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 270
- 在线时间
- 1373 小时
- 注册时间
- 2005-10-16
- 帖子
- 5113

|
本帖最后由 亿万星辰 于 2012-7-7 07:49 编辑
自己加行 return 0 就行了- #--------------------------------------------------------------------------
- # ● 获取指定位置的事件 ID
- # x : X 坐标
- # y : Y 坐标
- #--------------------------------------------------------------------------
- def check_event(x, y)
- for event in $game_map.events.values
- if event.x == x and event.y == y
- return event.id
- end
- end
- return 0
- end
复制代码 $game_variables[变量id] = $game_map.check_event(x, y)
然后只要判断 $game_variables[变量id] 就能知道是不是没事件了~有事件的情况下是数字,没有的话是0。
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------
- # ● 获取指定位置的事件 ID
- # x : X 坐标
- # y : Y 坐标
- #--------------------------------------------------------------------------
- def check_event(x, y)
- result = []
- for event in $game_map.events.values
- if event.x == x and event.y == y
- result.push(event.id)
- end
- end
- return result
- end
复制代码 $game_variables[变量id] = $game_map.check_event(x, y)
然后只要判断 $game_variables[变量id].empty? 就能知道是不是没事件了~false的情况下是有事件,没有的话是true。
要获取其中的元素可以用each或者其他的方法从数组里获取。 |
评分
-
查看全部评分
|