查看: 1508|回复: 3

[已经过期] 关于在scene_map的刷新脚本中用跳过的方法提高效率

[复制链接]
梦石
0
星屑
50
在线时间
130 小时
注册时间
2008-8-12
回帖
117
发表于 2013-3-21 10:02:09 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 兔毛鹿 于 2013-3-21 10:06 编辑

下面的脚本添加在scene_map的def update 下,在游戏中1~10号事件有可能行走图为空白,如果我在这段脚本里加了一句next if ,那么如果循环到空白行走图的事件next if 下面一整段是否就不会执行了?  从而因为跳过不需要判断的空白事件效率会有所提高?

if $game_switches[405] == true and $game_switches[20] == false
  for j in 1..10
    next if $game_map.events[j].character_name == ""
    a = $game_map.events[11].screen_x
    b = $game_map.events[j].screen_x
    c = $game_map.events[11].screen_y
    d = $game_map.events[j].screen_y
    if $game_map.events[11].direction == 4
      if a-b <= 40 and a-b > 0 and (c-d).abs <= 24
        $game_switches[405] = false
        $game_map.events[j].animation_id = 300
        if $game_map.events[j].x < $game_map.events[11].x
          $game_map.events[j].turn_right
        else
          $game_map.events[j].turn_left
        end
        $game_map.events[j].move_backward
        $game_map.need_refresh = true
        $game_map.events[j].damage = 86
        $game_map.events[j].critical = false
        $game_map.events[j].damage_pop = true
      end
    end
  end
end
Tomorrow
梦石
0
星屑
50
在线时间
130 小时
注册时间
2008-8-12
回帖
117
 楼主| 发表于 2013-3-28 11:22:14 | 显示全部楼层
怎么办啊怎么办
Tomorrow
回复

使用道具 举报

梦石
0
星屑
275
在线时间
1373 小时
注册时间
2005-10-16
回帖
5038

贵宾

发表于 2013-3-28 15:11:51 | 显示全部楼层
嗯,是这样的~

貌似是个ARPG的伤害处理~

if a-b <= 40 and a-b > 0 and (c-d).abs <= 24
既然屏幕上的水平距离是小于等于40大于0的,那么
if $game_map.events[j].x < $game_map.events[11].x
这个判断的意义似乎不太大啊~

评分

参与人数 1星屑 +66 收起 理由
hcm + 66 感谢回答

查看全部评分

我只个搬答案的
叔叔我已经当爹了~
婚后闪人了……
回复

使用道具 举报

梦石
0
星屑
50
在线时间
130 小时
注册时间
2008-8-12
回帖
117
 楼主| 发表于 2013-3-29 10:19:35 | 显示全部楼层
亿万星辰 发表于 2013-3-28 15:11
嗯,是这样的~

貌似是个ARPG的伤害处理~

那个挨打目标转向的判定好像是重复了。。。跳过真的有效么?不过在游戏中感觉不明显啊
Tomorrow
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部