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

Project1

 找回密码
 注册会员
搜索

请问有无画面垂直震动脚本?

查看数: 2883 | 评论数: 1 | 收藏 1
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2016-9-9 08:40

正文摘要:

画面水平震动是这个,$game_screen.start_shake(X,X,X) 可以调到很大数值 然后我好奇,有没有垂直震动? 因为我有这个 画了垂直跳台没画水平跳台。 ...

回复

夜狠简单 发表于 2016-9-10 19:52:53
  1. #==============================================================================
  2. # ■ Game_Screen
  3. #------------------------------------------------------------------------------
  4. # 更改色调以及画面闪烁、保存画面全体关系处理数据的类。本类的实例请参考
  5. # $game_screen。
  6. # $game_screen.start_vibration(power, speed, duration)强度,速度,时间
  7. #==============================================================================
  8. class Game_Screen
  9. attr_reader   :vibration       #震动
  10.   #--------------------------------------------------------------------------
  11.   # ● 初试化对像
  12.   #--------------------------------------------------------------------------
  13.   alias initialize16910 initialize
  14.   def initialize
  15.     initialize16910
  16.     @vibration_power = 0
  17.     @vibration_speed = 0
  18.     @vibration_duration = 0
  19.     @vibration_direction = 1
  20.     @vibration = 0
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 开始震动
  24.   #     power    : 强度
  25.   #     speed    : 速度
  26.   #     duration : 时间
  27.   #--------------------------------------------------------------------------
  28.   def start_vibration(power, speed, duration)
  29.     @vibration_power = power
  30.     @vibration_speed = speed
  31.     @vibration_duration = duration
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 刷新画面
  35.   #--------------------------------------------------------------------------
  36.   alias update16910 update
  37.   def update
  38.    update16910
  39.    if @vibration_duration >= 1 or @vibration != 0
  40.       delta = (@vibration_power * @vibration_speed * @vibration_direction) / 10.0
  41.       if @vibration_duration <= 1 and @vibration * (@vibration + delta) < 0
  42.         @vibration = 0
  43.       else
  44.         @vibration += delta
  45.       end
  46.       if @vibration > @vibration_power * 2
  47.         @vibration_direction = -1
  48.       end
  49.       if @vibration < - @vibration_power * 2
  50.         @vibration_direction = 1
  51.       end
  52.       if @vibration_duration >= 1
  53.         @vibration_duration -= 1
  54.       end
  55.     end
  56.   end
  57. end

  58. #==============================================================================
  59. # ■ Spriteset_Map
  60. #------------------------------------------------------------------------------
  61. #  处理地图画面活动块和元件的类。本类在
  62. # Scene_Map 类的内部使用。
  63. #==============================================================================
  64. class Spriteset_Map
  65.   #--------------------------------------------------------------------------
  66.   # ● 刷新画面
  67.   #--------------------------------------------------------------------------
  68.   alias update16910 update
  69.   def update
  70.     update16910
  71.     @viewport1.oy = $game_screen.vibration
  72.   end
  73. end
复制代码

评分

参与人数 2星屑 +100 梦石 +1 收起 理由
hys111111 + 1 认可答案
89444640 + 100 非常感谢

查看全部评分

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

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

GMT+8, 2024-9-22 06:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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