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

Project1

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

[已经过期] 唔……全方位震动脚本不起作用?

[复制链接]

Lv4.逐梦者

送快递的水表员

梦石
10
星屑
4847
在线时间
3303 小时
注册时间
2012-6-27
帖子
7160

开拓者贵宾

跳转到指定楼层
1
发表于 2012-10-10 13:56:46 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 Password 于 2012-10-13 13:09 编辑

好吧……这是原脚本,会报错。
  1. #===============================================================
  2. # 脚本来自黑幕 : [url=http://diyrpg.net]http://diyrpg.net[/url]  你可选择不保留
  3. # 作者 : 狐狸
  4. # 移植修改 Eienshinken
  5. #==============================================================================
  6. # ■ Game_Screen
  7. #------------------------------------------------------------------------------
  8. #  更改色调以及画面闪烁、保存画面全体关系处理数据的类。本类的实例请参考
  9. # $game_screen。
  10. #==============================================================================
  11. class Game_Screen
  12.   #--------------------------------------------------------------------------
  13.   # ● 定义实例变量
  14.   #--------------------------------------------------------------------------
  15.   attr_reader   :shake_x                    # 震动位置X坐标
  16.   attr_reader   :shake_y                    # 震动位置Y坐标
  17.   #--------------------------------------------------------------------------
  18.   # ● 初试化对像
  19.   #--------------------------------------------------------------------------
  20.   alias ini initialize
  21.   def initialize
  22.     ini
  23.     @shake_x = 0
  24.     @shake_y = 0
  25.     @shake_power_fox = 0
  26.     @shake_duration_fox = 0
  27.     #加入半透明
  28.     $Back = Sprite.new
  29.     #$Back.bitmap =  Bitmap.new("")
  30.     $Back.opacity = 0
  31.     $Back.z = 9999
  32.     @tone_zhenshu = 0
  33.     @tone_mingan = 0
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 开始震动
  37.   #     power    : 强度
  38.   #     duration : 帧数
  39.   #     fangxiang: 方向 0为左右 1为上下 2为上下左右
  40.   #--------------------------------------------------------------------------
  41.   def start_shake_fox(power, duration,fangxiang = 0)
  42.     @shake_power_fox = power
  43.     @shake_duration_fox = duration
  44.     @fangxiang = fangxiang
  45.     if fangxiang == 2
  46.     @fudu = power/(duration/8)
  47.   else
  48.     @fudu = power/(duration/4)
  49.     end
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● 刷新震动X
  53.   #--------------------------------------------------------------------------
  54.   def zhendongx
  55.     # 画面震动X坐标计算
  56.     if @shake_duration_fox >= 1 or @shake_x != 0
  57.       #p @shake_duration % 8,@shake_power
  58.       #总 40帧 强度20 次数10
  59.       case @shake_duration_fox % 4
  60.       when 0,2
  61.         @shake_x = 0
  62.       when 3
  63.         @shake_x = @shake_power_fox
  64.       when 1
  65.         @shake_x = -@shake_power_fox
  66.         @shake_power_fox -= @fudu if @shake_power_fox > 0
  67.       end
  68.       if @shake_duration_fox >= 1
  69.         @shake_duration_fox -= 1
  70.       end
  71.     end
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 刷新震动Y
  75.   #--------------------------------------------------------------------------
  76.   def zhendongy
  77.     # 画面震动Y坐标计算
  78.     if @shake_duration_fox >= 1 or @shake_y != 0
  79.       #总 40帧 强度20 次数10
  80.       case @shake_duration_fox % 4
  81.       when 0,2
  82.         @shake_y = 0
  83.       when 3
  84.         @shake_y = @shake_power_fox
  85.       when 1
  86.         @shake_y = -@shake_power_fox
  87.         @shake_power_fox -= @fudu if @shake_power_fox > 0
  88.       end
  89.       if @shake_duration_fox >= 1
  90.         @shake_duration_fox -= 1
  91.       end
  92.     end
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 刷新震动XY同时
  96.   #--------------------------------------------------------------------------
  97.   def zhendongxy
  98.     # 画面同时震动XY坐标计算
  99.     if @shake_duration_fox >= 1 or @shake_x != 0 or @shake_y != 0
  100.       #总 40帧 强度20 次数10
  101.       case @shake_duration_fox % 8
  102.       when 0
  103.         @shake_x = -@shake_power_fox
  104.       when 7,5
  105.         @shake_x = 0
  106.       when 6
  107.         @shake_x = @shake_power_fox
  108.       when 4
  109.         @shake_y = -@shake_power_fox
  110.       when 3
  111.         @shake_y = 0
  112.       when 2
  113.         @shake_y = @shake_power_fox
  114.       when 1
  115.         @shake_y = 0
  116.         @shake_power_fox -= @fudu if @shake_power_fox > 0
  117.       end
  118.       if @shake_duration_fox >= 1
  119.         @shake_duration_fox -= 1
  120.       end
  121.     end
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 开始淡入
  125.   #     tone     : 明暗
  126.   #     zhenshu : 时间
  127.   #--------------------------------------------------------------------------
  128.   def start_tone(tone, zhenshu,pic = nil)
  129.     if pic != nil
  130.       $Back.bitmap =  Bitmap.new("Graphics/Transitions/#{pic}" )
  131.       $Back.zoom_x = 1
  132.       $Back.zoom_y = 1
  133.     else
  134.       $Back.bitmap =  Bitmap.new("Graphics/Transitions/淡入淡出" )
  135.       $Back.zoom_x = 10
  136.       $Back.zoom_y = 10
  137.     end
  138.     @tone_mingan = tone
  139.     @tone_zhenshu = zhenshu*2
  140.     if @tone_zhenshu == 0
  141.       case @tone_mingan
  142.       when 0
  143.         $Back.opacity = 0
  144.       when 1
  145.         $Back.opacity = 255
  146.       end
  147.     end
  148.   end
  149.   #淡入
  150.   def tonein(zhenshu,pic = nil)
  151.     start_tone(0, zhenshu,pic)
  152.     $game_system.map_interpreter.wait_count = zhenshu * 2
  153.   end
  154.   #淡出
  155.   def toneout(zhenshu,pic = nil)
  156.     start_tone(1, zhenshu,pic)
  157.     $game_system.map_interpreter.wait_count = zhenshu * 2
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ● 刷新画面
  161.   #--------------------------------------------------------------------------
  162.   alias update_fox update
  163.   def update
  164.     update_fox
  165.     #淡入淡出
  166.     if @tone_zhenshu >= 1
  167.       d = @tone_zhenshu
  168.       if @tone_mingan == 0
  169.         $Back.opacity = ($Back.opacity * (d - 1) + 255) / d
  170.       elsif @tone_mingan == 1
  171.         $Back.opacity = ($Back.opacity * (d - 1)) / d
  172.       end
  173.       @tone_zhenshu -= 1
  174.     end
  175.     #画面震动
  176.     if @shake_duration_fox >= 1
  177.       Graphics.update
  178.       case @fangxiang
  179.       when 0
  180.         zhendongx
  181.       when 1
  182.         zhendongy
  183.       else
  184.         zhendongxy
  185.       end
  186.     end
  187.   end
  188. end
  189. #==============================================================================
  190. # ■ Interpreter
  191. #------------------------------------------------------------------------------
  192. #  执行事件命令的解释器。本类在 Game_System 类
  193. # 与 Game_Event 类的内部使用。
  194. #=============================================
  195. class Interpreter
  196.   attr_accessor :wait_count                  # 窗口计数
  197. end

  198. #==============================================================================
  199. # ■ Spriteset_Map
  200. #------------------------------------------------------------------------------
  201. #  处理地图画面活动块和元件的类。本类在
  202. # Scene_Map 类的内部使用。
  203. #==============================================================================

  204. class Spriteset_Map
  205.   #--------------------------------------------------------------------------
  206.   # ● 刷新画面
  207.   #--------------------------------------------------------------------------
  208.   alias update_fox update
  209.   def update
  210.     update_fox
  211.     @viewport1.ox = $game_map.screen.shake_x
  212.     @viewport1.oy = $game_map.screen.shake_y
  213.     # Eienshinken
  214.     @viewport2.ox = $game_map.screen.shake_x
  215.     @viewport2.oy = $game_map.screen.shake_y
  216.     @viewport3.ox = $game_map.screen.shake_x
  217.     @viewport3.oy = $game_map.screen.shake_y
  218.     @viewport4.ox = $game_map.screen.shake_x
  219.     @viewport4.oy = $game_map.screen.shake_y
  220.     @viewport5.ox = $game_map.screen.shake_x
  221.     @viewport5.oy = $game_map.screen.shake_y
  222.     @viewport6.ox = $game_map.screen.shake_x
  223.     @viewport6.oy = $game_map.screen.shake_y
  224.   end
  225. end
复制代码

这是报错内容

点评

脚本没上完吧?不会用,没效果。  发表于 2012-10-10 16:55

Lv3.寻梦者 (版主)

八宝粥的基叔

梦石
0
星屑
4644
在线时间
5238 小时
注册时间
2009-4-29
帖子
14318

贵宾

2
发表于 2012-10-10 14:10:50 | 只看该作者
我怎么看不到任何内容,而且点评不能{:2_270:}

点评

所以说没有效果……前面是有一段关于闪烁和色调改变的我给去掉了,因为加上的话会报错  发表于 2012-10-11 11:13
现在好了,但是不能用pre……  发表于 2012-10-10 14:19
《逝去的回忆3:四叶草之梦》真情发布,欢迎点击图片下载试玩喵。

《逝去的回忆3》的讨论群:
一群:192885514
二群:200460747
回复

使用道具 举报

Lv2.观梦者

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

贵宾

3
发表于 2012-10-11 07:54:17 | 只看该作者
本帖最后由 亿万星辰 于 2012-10-11 08:02 编辑

  1. #==============================================================================
  2. # ■ Spriteset_Map
  3. #------------------------------------------------------------------------------
  4. #  处理地图画面活动块和元件的类。本类在 Scene_Map 类的内部使用。
  5. #==============================================================================

  6.   #--------------------------------------------------------------------------
  7.   # ● 更新显示端口
  8.   #--------------------------------------------------------------------------
  9.   def update_viewports
  10.     @viewport1.tone = $game_map.screen.tone
  11.     x_ = rand(2)
  12.     y_ = rand(2)
  13.     # 设置画面的色调与震动位置
  14.     @viewport1.ox = (-1) ** x_ * $game_map.screen.shake
  15.     @viewport1.oy = (-1) ** y_ * $game_map.screen.shake
  16.     #让图片也可以震动
  17.     @viewport2.ox = (-1) ** x_ * $game_map.screen.shake
  18.     @viewport2.oy = (-1) ** y_ * $game_map.screen.shake
  19.     #让动画也可以震动
  20.     @viewport3.ox = (-1) ** x_ * $game_map.screen.shake
  21.     @viewport3.oy = (-1) ** y_ * $game_map.screen.shake
  22.     @viewport2.color = $game_map.screen.flash_color
  23.     @viewport3.color.set(0, 0, 0, 255 - $game_map.screen.brightness)
  24.     @viewport1.update
  25.     @viewport2.update
  26.     @viewport3.update
  27.   end
  28. end
复制代码

点评

就是能上下左右一起震动  发表于 2012-10-11 14:25
我只个搬答案的
叔叔我已经当爹了~
婚后闪人了……
回复

使用道具 举报

Lv4.逐梦者

送快递的水表员

梦石
10
星屑
4847
在线时间
3303 小时
注册时间
2012-6-27
帖子
7160

开拓者贵宾

4
 楼主| 发表于 2012-10-11 11:12:58 | 只看该作者
亿万星辰 发表于 2012-10-11 07:54

这个该怎么用……放到哪里?还是替换什么?能详细说下吗,谢谢。

点评

话说你想要的是全方位是指的什么样的效果呢?  发表于 2012-10-11 13:33
回复

使用道具 举报

Lv2.观梦者

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

贵宾

5
发表于 2012-10-11 13:22:01 | 只看该作者
Password 发表于 2012-10-11 11:12
这个该怎么用……放到哪里?还是替换什么?能详细说下吗,谢谢。

放到最后,或者把对应的原脚本修改掉~

点评

不配合,单独的  发表于 2012-10-11 13:31
还是不起作用……不报错,是配合那两段脚本用吗?  发表于 2012-10-11 13:27
我只个搬答案的
叔叔我已经当爹了~
婚后闪人了……
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-28 02:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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