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

Project1

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

[已经过期] 这个脚本影响帧数,请教有什么优化的办法

 关闭 [复制链接]

Lv4.逐梦者

梦石
3
星屑
6420
在线时间
1131 小时
注册时间
2007-12-26
帖子
2402
跳转到指定楼层
1
发表于 2009-12-11 13:12:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 幻耶 于 2009-12-11 13:37 编辑

这个脚本的效果是当某开关打开,相应的事件闪烁不同的颜色,严重影响游戏帧数,症状是在游戏中进一下别的地图再回原地图,速度会变得很卡,帧数下降到11左右!但是这效果我又不想放弃,有什么优化的办法么
  1. Goahead1_Color = [255,0,0] #颜色红色[R,G,B]
  2. Goahead1_Count = 20 # 闪烁间隔
  3. Goahead2_Color = [0,0,255] #颜色蓝色[R,G,B]
  4. Goahead2_Count = 20 # 闪烁间隔
  5. Goahead3_Color = [255,0,255] #颜色紫色[R,G,B]
  6. Goahead3_Count = 20 # 闪烁间隔
  7. Goahead4_Color = [0,255,0] #颜色绿色[R,G,B]
  8. Goahead4_Count = 20 # 闪烁间隔
  9. Goahead5_Color = [255,255,0] #颜色黄色[R,G,B]
  10. Goahead5_Count = 20 # 闪烁间隔
  11. Goahead6_Color = [0,255,255] #颜色浅蓝色[R,G,B]
  12. Goahead6_Count = 20 # 闪烁间隔

  13. class Sprite_Character < RPG::Sprite
  14.   #燃烧持续扣血
  15.   def update_tone1
  16.     @count ||= Goahead1_Count
  17.     if @count <= 0
  18.       @count = Goahead1_Count
  19.       for i in 1..20
  20.         if @character.moving? and @character.id == i and $game_switches[i+600] == true
  21.           name = $game_map.events[i].name
  22.           data = name.split(/,/)
  23.           data[1] = data[1].to_i - $game_variables[31] - 20
  24.           $game_map.events[i].name = data[0].to_s+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s+","+data[6].to_s+","+data[7].to_s+","+data[8].to_s
  25.         end
  26.       end
  27.     else
  28.       @count -= 1
  29.     end
  30.     if @count < Goahead1_Count/2
  31.       self.tone.set(*Goahead1_Color)
  32.     else
  33.       self.tone.set(0,0,0,0)
  34.     end
  35.   end

  36.   #冰冻减慢速度
  37.   def update_tone2
  38.     @count ||= Goahead2_Count
  39.     if @count <= 0
  40.       @count = Goahead2_Count
  41.       for i in 1..20
  42.         if @character.moving? and @character.id == i and $game_switches[i+625] == true
  43.           $game_map.events[i].move_speed = 1
  44.         end
  45.       end
  46.     else
  47.       @count -= 1
  48.     end
  49.     if @count < Goahead2_Count/2
  50.       self.tone.set(*Goahead2_Color)
  51.     else
  52.       self.tone.set(0,0,0,0)
  53.     end
  54.   end
  55.   
  56.   #麻痹原地打转
  57.   def update_tone3
  58.     @count ||= Goahead3_Count
  59.     if @count <= 0
  60.       @count = Goahead3_Count
  61.       for i in 1..20
  62.         if @character.moving? and @character.id == i and $game_switches[i+650] == true
  63.           $game_map.events[i].move_speed = 0
  64.         end
  65.       end
  66.     else
  67.       @count -= 1
  68.     end
  69.     if @count < Goahead3_Count/2
  70.       self.tone.set(*Goahead3_Color)
  71.     else
  72.       self.tone.set(0,0,0,0)
  73.     end
  74.   end
  75.   
  76.   #中毒持续扣血
  77.   def update_tone4
  78.     @count ||= Goahead4_Count
  79.     if @count <= 0
  80.       @count = Goahead4_Count
  81.       for i in 1..20
  82.         if @character.moving? and @character.id == i and $game_switches[i+675] == true
  83.           name = $game_map.events[i].name
  84.           data = name.split(/,/)

  85.           data[1] = data[1].to_i - $game_variables[34]
  86.           $game_map.events[i].name = data[0].to_s+","+data[1].to_s+","+data[2].to_s+","+data[3].to_s+","+data[4].to_s+","+data[5].to_s+","+data[6].to_s+","+data[7].to_s+","+data[8].to_s
  87.         end
  88.       end
  89.     else
  90.       @count -= 1
  91.     end
  92.     if @count < Goahead4_Count/2
  93.       self.tone.set(*Goahead4_Color)
  94.     else
  95.       self.tone.set(0,0,0,0)
  96.     end
  97.   end
  98.   
  99.   
  100.   
  101.   
  102.   
  103.   alias goahead1_update update
  104.   def update
  105.     reset = true
  106.     for i in 1..20
  107.     if @character.is_a?(Game_Event) and @character.id == i and $game_switches[i+600] == true
  108.       update_tone1
  109.       reset = false
  110.     end
  111.     if @character.is_a?(Game_Event) and @character.id == i and $game_switches[i+625] == true
  112.       update_tone2
  113.       reset = false
  114.     end
  115.     if @character.is_a?(Game_Event) and @character.id == i and $game_switches[i+650] == true
  116.       update_tone3
  117.       reset = false
  118.     end
  119.     if @character.is_a?(Game_Event) and @character.id == i and $game_switches[i+675] == true
  120.       update_tone4
  121.       reset = false
  122.     end
  123.     if @character.is_a?(Game_Event) and @character.id == i and $game_switches[i+700] == true
  124.       update_tone5
  125.       reset = false
  126.     end
  127.     if @character.is_a?(Game_Event) and @character.id == i and $game_switches[i+725] == true
  128.       update_tone6
  129.       reset = false
  130.     end
  131.     self.tone.set(0, 0, 0) if reset
  132.     end
  133.     goahead1_update
  134.   end
  135. end
复制代码
囡囚囨囚囨図囨囧
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
21 小时
注册时间
2007-7-3
帖子
573
2
发表于 2009-12-11 15:00:47 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
3
星屑
6420
在线时间
1131 小时
注册时间
2007-12-26
帖子
2402
3
 楼主| 发表于 2009-12-11 15:03:06 | 只看该作者
好像是你写的吧。。。我乱改了一下~:funk:
求优化
囡囚囨囚囨図囨囧
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-2 03:45

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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