| 赞 | 0  | 
 
| VIP | 0 | 
 
| 好人卡 | 0 | 
 
| 积分 | 3 | 
 
| 经验 | 0 | 
 
| 最后登录 | 2016-4-8 | 
 
| 在线时间 | 27 小时 | 
 
 
 
 
 
Lv2.观梦者 
	- 梦石
 - 0 
 
        - 星屑
 - 2801 
 
        - 在线时间
 - 27 小时
 
        - 注册时间
 - 2015-2-28
 
        - 帖子
 - 4
 
 
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
以下这个跳跃脚本,下降速度可以设置,但没有上升速度设置,怎么设置上升速度 
 
 
 
#encoding:utf-8 
#============================================================================== 
# ■ Game_CharacterBase 
#------------------------------------------------------------------------------ 
#  管理地图人物的基本类。是所有地图人物类的共通父类。拥有坐标、图片等基本信息。 
#============================================================================== 
=begin  
  Hello!大家好 
  我是 茄子 
   
  很久没有来6R了,现在看见新的编辑器出来不免心动了,又玩起来RMVA来! 
  鄙人历来喜欢动作类游戏,希望这个脚本能给大家一点好的用处! 
  这是一个简单的【跳跃+重力脚本】 
  使用方法很简单 
  (1) 
   大家根据范例里的每个事件的设置看吧! 
  (2) 
  修改角色跳跃高度 建议取值 1-5 
  $game_player.g_height = 5 # 基本值为5 越低则越高 
  (3) 
  让所有角色能发动跳跃请打开跳跃开关即可跳跃1次! 
  比如让主角跳跃1次 
  $game_player.jump_start = true 
  比如让事件1号跳跃1次 
  $game_map.events[1].jump_start = true 
  范例在Scene_Map中按下空格键即可让主角跳跃一次! 
    if Input.trigger?(:C) 
      $game_player.jump_start 
    end 
   当然让事件跳跃只要在事件的【移动路线】里面的【脚本】使用jump_start 
   就可以让事件跳跃了! 
               if passable?(@real_x.round, @y, 2) and @y <= $game_map.height 
         @g_speed_down += 0.01 
         my = get_down_pos(@y) 
         dt = my - @y 
         if dt > @g_speed_down 
           @y += @g_speed_down 
         else 
           @y += dt 
         end 
         @real_y = @y 
         @isDown = true 
       else 
=end 
#============================================================================== 
class Game_CharacterBase 
  #-------------------------------------------------------------------------- 
  # ● 全局开关 
  #--------------------------------------------------------------------------  
  $gravity_key = true  
  #-------------------------------------------------------------------------- 
  # ● 定义实例变量 
  #-------------------------------------------------------------------------- 
   attr_accessor :g_speed_down 
   attr_accessor :g_speed_up 
   attr_accessor :g_key 
   attr_accessor :isDown 
   attr_accessor :isUp 
   attr_accessor :g_height 
   attr_accessor :jump_key 
   attr_accessor :jump_number 
   attr_accessor :gravity_key 
   attr_accessor :double_key 
  #-------------------------------------------------------------------------- 
  # ● 初始化对象 
  #-------------------------------------------------------------------------- 
  def initialize 
    init_public_members 
    init_private_members 
    @g_speed_down = 0 # 0.098 
    @g_speed_up =  # 0.5 
    @g_height = 5 # 越低跳的越高,建议1到10之间(5为正常高度) 
    @jump_number = 0 
    @g_key = true 
    @isDown = false 
    @isUp = false 
    @jump_key = false 
    @gravity_key = true 
    @double_key = false 
  end 
  #-------------------------------------------------------------------------- 
  # ● 总判断 
  #-------------------------------------------------------------------------- 
  def start_can? 
    # 如果行走图为空则无【跳跃重力】 
    return false if @character_name == ""  
    # 如果重力开关关闭则无【跳跃重力】 
    return ($gravity_key == false or @gravity_key == false) 
  end 
  #-------------------------------------------------------------------------- 
  # ● 起跳 
  #-------------------------------------------------------------------------- 
  def jump_start 
    if jump_can? 
    @g_speed_up = 1 
    @jump_key = true 
    @isDown = false 
    @g_key = false 
    @jump_number += 1 
    return  
    end 
  end 
  #-------------------------------------------------------------------------- 
  # ● 可否再跳 
  #-------------------------------------------------------------------------- 
  def jump_can? 
    if @double_key 
      if $game_variables[1] == 1 
        return @jump_number <= $game_variables[2] # 1则为最高跳跃2次,可自行修改如4则可跳跃5次 
      end 
    end 
  end 
  #-------------------------------------------------------------------------- 
  # ● 更新画面 
  #-------------------------------------------------------------------------- 
  def update 
    update_animation 
    update_gravity 
    update_real_jump 
    return update_jump if jumping? 
    return update_move if moving? 
    return update_stop 
  end 
 
  #-------------------------------------------------------------------------- 
  # ● 跳跃效果 
  #-------------------------------------------------------------------------- 
  def update_real_jump 
      # 如果重力开关关闭则重力失效 
      if start_can? 
         return 
       end 
      # 如果不在下落时 
      if @jump_key == true && @isDown == false 
        @g_key = false 
          if passable?(@x, @real_y.floor, 8) and @y > 0 
             if @g_speed_up > 0 
               @g_speed_up -= @g_height*0.01 
               @y -= @g_speed_up 
               @real_y = @y 
             else    
               @jump_key = false 
               @real_y = @real_y 
               @y = @real_y  
               @g_key = true  
             end 
           else 
               @jump_key = false  
               @real_y = @real_y 
               @y = @real_y  
               @g_key = true  
          end      
      end 
  end 
  #-------------------------------------------------------------------------- 
  # ● 重力效果 
  #-------------------------------------------------------------------------- 
  def update_gravity 
      # 如果重力开关关闭则重力失效 
      if start_can? 
         return 
      end 
      # 如果下落开关打开的话 
      if @g_key == true 
        if passable?(@real_x.round, @y, 2) and @y <= $game_map.height 
         @g_speed_down += 0.01 
         my = get_down_pos(@y) 
         dt = my - @y 
         if dt > @g_speed_down 
           @y += @g_speed_down 
         else 
           @y += dt 
         end 
         @real_y = @y 
         @isDown = true 
       else 
 
         @jump_number = 0 
         @real_y = @real_y.floor 
         @y = @real_y 
         @g_speed_down = 0 # 下降速度 
=begin   若为正数:数值越大越快,修改建议在0到1之间(0为正常速度) 
         若为负数:则等上升完毕后,还会继续上升,修改数值越小越高,建议修改在0到-1之间(0为正常速度) 
=end          
         @isDown = false 
       end 
      end 
    end 
  #-------------------------------------------------------------------------- 
  # ● 取得上一个障碍点的 
  #-------------------------------------------------------------------------- 
  def get_up_pos(sy) 
      my = sy.floor 
      while(true) 
         if passable?(@x, my, 8) == false 
           return my 
         else 
           my -= 1 
         end 
      end 
  end 
  #-------------------------------------------------------------------------- 
  # ● 取得下一个障碍点的 
  #-------------------------------------------------------------------------- 
  def get_down_pos(sy) 
      my = sy.floor 
      while(true) 
         if passable?(@x, my, 2) == false 
           return my 
         else 
           my += 1 
         end 
      end 
  end 
  #-------------------------------------------------------------------------- 
  # ● 判定是否移动中 
  #-------------------------------------------------------------------------- 
  def moving? 
    if start_can? 
    @real_x != @x 
    else 
    @real_x != @x || @real_y != @y 
    end 
  end 
  #-------------------------------------------------------------------------- 
  # ● 径向移动 
  #     d       : 方向(2,4,6,8) 
  #     turn_ok : 是否可以改变方向 
  #-------------------------------------------------------------------------- 
  def move_straight(d, turn_ok = true) 
       if start_can? 
         if d == 2 or d == 8 
           return 
         end 
       end 
       @move_succeed = passable?(@x, @y, d) 
       if @move_succeed 
          set_direction(d) 
          @x = $game_map.round_x_with_direction(@x, d) 
          @y = $game_map.round_y_with_direction(@y, d) 
          @real_x = $game_map.x_with_direction(@x, reverse_dir(d)) 
          @real_y = $game_map.y_with_direction(@y, reverse_dir(d)) 
          increase_steps 
       elsif turn_ok 
          set_direction(d) 
          check_event_trigger_touch_front 
       end 
     end 
end 
#encoding:utf-8 
#============================================================================== 
# ■ Scene_Map 
#------------------------------------------------------------------------------ 
#  地图画面 
#============================================================================== 
 
class Scene_Map < Scene_Base 
  #-------------------------------------------------------------------------- 
  # ● 更新画面 
  #-------------------------------------------------------------------------- 
  def update 
    super 
    if Input.trigger?(:C) 
      $game_player.jump_start 
    end 
    $game_map.update(true) 
    $game_player.update 
    $game_timer.update 
    @spriteset.update 
    update_scene if scene_change_ok? 
  end 
end |   
 
 
 
 |