- 注册时间
- 2008-2-19
- 最后登录
- 2019-5-19
⑥精研
●~ ●~ ●
- 积分
- 1635
|
这个脚本的效果是当某开关打开,相应的事件闪烁不同的颜色,严重影响游戏帧数,症状是在游戏中进一下别的地图再回原地图,速度会变得很卡,帧数下降到11左右!但是这效果我又不想放弃,有什么优化的办法么?
- Goahead1_Color = [255,0,0] #颜色红色[R,G,B]
- Goahead1_Count = 20 # 闪烁间隔
- Goahead2_Color = [0,0,255] #颜色蓝色[R,G,B]
- Goahead2_Count = 20 # 闪烁间隔
- Goahead3_Color = [255,0,255] #颜色紫色[R,G,B]
- Goahead3_Count = 20 # 闪烁间隔
- Goahead4_Color = [0,255,0] #颜色绿色[R,G,B]
- Goahead4_Count = 20 # 闪烁间隔
- Goahead5_Color = [255,255,0] #颜色黄色[R,G,B]
- Goahead5_Count = 20 # 闪烁间隔
- Goahead6_Color = [0,255,255] #颜色浅蓝色[R,G,B]
- Goahead6_Count = 20 # 闪烁间隔
- class Sprite_Character < RPG::Sprite
-   #燃烧持续扣血
-   def update_tone1
-     @count ||= Goahead1_Count
-     if @count <= 0
-       @count = Goahead1_Count
-       for i in 1..20
-         if @character.moving? and @character.id == i and $game_switches[i+600] == true
-           name = $game_map.events[i].name
-           data = name.split(/,/)
-           data[1] = data[1].to_i - $game_variables[31] - 20
-           $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
-         end
-       end
-     else
-       @count -= 1
-     end
-     if @count < Goahead1_Count/2
-       self.tone.set(*Goahead1_Color)
-     else
-       self.tone.set(0,0,0,0)
-     end
-   end
-   #冰冻减慢速度
-   def update_tone2
-     @count ||= Goahead2_Count
-     if @count <= 0
-       @count = Goahead2_Count
-       for i in 1..20
-         if @character.moving? and @character.id == i and $game_switches[i+625] == true
-           $game_map.events[i].move_speed = 1
-         end
-       end
-     else
-       @count -= 1
-     end
-     if @count < Goahead2_Count/2
-       self.tone.set(*Goahead2_Color)
-     else
-       self.tone.set(0,0,0,0)
-     end
-   end
-   
-   #麻痹原地打转
-   def update_tone3
-     @count ||= Goahead3_Count
-     if @count <= 0
-       @count = Goahead3_Count
-       for i in 1..20
-         if @character.moving? and @character.id == i and $game_switches[i+650] == true
-           $game_map.events[i].move_speed = 0
-         end
-       end
-     else
-       @count -= 1
-     end
-     if @count < Goahead3_Count/2
-       self.tone.set(*Goahead3_Color)
-     else
-       self.tone.set(0,0,0,0)
-     end
-   end
-   
-   #中毒持续扣血
-   def update_tone4
-     @count ||= Goahead4_Count
-     if @count <= 0
-       @count = Goahead4_Count
-       for i in 1..20
-         if @character.moving? and @character.id == i and $game_switches[i+675] == true
-           name = $game_map.events[i].name
-           data = name.split(/,/)
-           data[1] = data[1].to_i - $game_variables[34]
-           $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
-         end
-       end
-     else
-       @count -= 1
-     end
-     if @count < Goahead4_Count/2
-       self.tone.set(*Goahead4_Color)
-     else
-       self.tone.set(0,0,0,0)
-     end
-   end
-   
-   
-   
-   
-   
-   alias goahead1_update update
-   def update
-     reset = true
-     for i in 1..20
-     if @character.is_a?(Game_Event) and @character.id == i and $game_switches[i+600] == true
-       update_tone1
-       reset = false
-     end
-     if @character.is_a?(Game_Event) and @character.id == i and $game_switches[i+625] == true
-       update_tone2
-       reset = false
-     end
-     if @character.is_a?(Game_Event) and @character.id == i and $game_switches[i+650] == true
-       update_tone3
-       reset = false
-     end
-     if @character.is_a?(Game_Event) and @character.id == i and $game_switches[i+675] == true
-       update_tone4
-       reset = false
-     end
-     if @character.is_a?(Game_Event) and @character.id == i and $game_switches[i+700] == true
-       update_tone5
-       reset = false
-     end
-     if @character.is_a?(Game_Event) and @character.id == i and $game_switches[i+725] == true
-       update_tone6
-       reset = false
-     end
-     self.tone.set(0, 0, 0) if reset
-     end
-     goahead1_update
-   end
- end
复制代码 |
|