设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 70|回复: 0

[转载发布] EatYourBeetS Jump Script

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9068

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58857
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68819

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    EatYourBeetS Jump Script v 1.0.3



    Introduction

    This script allow you to jump any time by pressing a button, you can set Jump Button, Jump Se, and delay between jumps, as well

    as regions and terrain tag which are always "unjumpable" however the script already recognize most of the impassable tiles, the only ones not easily recognizable are vertical walls large 1 tile.

    I suggest either using Regions/TerrainTag or making walls large 2 tiles.

     

    P.S:  The Keyboard_Full_input module can easily be accessed from other scripts too, it covers almost every keyboard input, you are free to detach it from this script if you want.

     

    Features

    -Jump anywhere

    -Jump anytime

    -Jump 0, 1, or 2 tiles , automatically checked.

    -Jump!

     

    Video




    Obviously the Space Button Image is only used to show which tiles can't be jumped, it isn't actually included in the script   


     

     

    How to Use

    Place it under materials and above main, customize anything you want, enjoy!

     

    Script


     

                    Code:       
    1. #=============================================================================## #  EatYourBeetS stealing script  v 1.0.3## -1.0.3: Added turn on spot while pressing a default key# -1.0.2: Added Party Followers Jump and Sprite Change# -1.0.1: Added Jump speed and Jump height###  Desc: This script allow you to jump any time by pressing a button, you#        can set Jump Button, Jump Se, and delay between jumps, as well#        as regions and terrain tag which are always "unjumpable"#        however the script already recognize most of the impassable tiles#        the only ones not easily recognizable are vertical walls large 1 tile,#        I suggest either using Region/TerrainTag or making walls large 2 tiles.##  P.S:  The Keyboard_Full_input module can easily be accessed from other #        scripts too, you are free to detach it from this script if you want.##  *Free to use anywhere#  *Credits: EatYourBeetS#  *If you find bugs or have an idea about how to improve this,#   please let me know!##  I overwrited update_jump, just for the game_player class, not the events,#  now you can set the jump speed##=============================================================================# module Eat_Jump    JUMP_BUTTON = :space #Refer to the list below, it should cover ALL of the                        #keyboard input buttons   JUMP_SE     = RPG::SE.new("Jump1", 60, 120) #("Sound.name", volume, pitch)    DELAY       = 25 #Delay between jumps(increase this if you use followers)    JUMP_HEIGHT = 10 #If you want your player to visit space set it higher!    JUMP_SPEED  = 1.0#Don't set it too high, unless you want to teleport    SPRITE      = 0  #If you want to change sprite while jumping change this                   #to the jumping sprite table, remember the "", otherwhise                    #leave it to 0                     TURN_ON_SPOT= :ctrl #the player will just turn on spot instead of moving if                      #this button is being pressed, set it to nil if you don't                      #want this feature (remember that if you set this to                      #ctrl while playtesting you won't be able to pass through                      #wall, unless you jump in the meantime)                     JUMP_SWITCH = 20 #If this switch is off you can't jump    IMPASSABLE  = 50 #You can never jump over tiles with this region id    PASSABLE    = 51 #Viceversa    ALLOWED     = 52 #These tiles can be jumped over even when jump switch is off    TERRAINTAG  = 7  #You can never jump over tiles with this terrain tag, very                   #useful for walls or trees    JUMP_DIST   = 2  #Not ready yet, leave it to 2endmodule Keyboard_Full_input    #Do not change these | | | |  #                    V V V V  CHECK = Win32API.new 'user32', 'GetAsyncKeyState', ['p'], 'i'   KEYS  = { :lmbutton => 0x01, :backspace => 0x08, :tab => 0x09, :enter => 0x0D, :shift => 0x10,            :ctrl => 0x11, :alt => 0x12, :pause => 0x13, :caps => 0x14,            :escape => 0x1B, :space => 0x20, :pageup => 0x21, :pagedown => 0x22,            :end => 0x23, :home => 0x24, :left => 0x25, :up => 0x26,            :right => 0x27, :down => 0x28, :print => 0x2C, :insert => 0x2D,            :delete => 0x2E,                       :N0 => 0x30, :N1 => 0x31, :N2 => 0x32, :N3 => 0x33, :N4 => 0x34,             :N5 => 0x35, :N6 => 0x36, :N7 => 0x37, :N8 => 0x38, :N9 => 0x39,                       :A => 0x41, :B => 0x42, :C => 0x43,  => 0x44, :E => 0x45, :F => 0x46,            :G => 0x47, :H => 0x48, :I => 0x49, :J => 0x4A, :K => 0x4B, :L => 0x4C,            :M => 0x4D, :N => 0x4E,  => 0x4F,  => 0x50, :Q => 0x51, :R => 0x52,            :S => 0x53, :T => 0x54, :U => 0x55, :V => 0x56, :W => 0x57, :X => 0x58,            :Y => 0x59, :Z => 0x5A,                       :F1 => 0x70, :F2 => 0x71, :F3 => 0x72, :F4 => 0x73, :F5 => 0x74,             :F6 => 0x75, :F7 => 0x76, :F8 => 0x77, :F9 => 0x78, :F10 => 0x79,             :F11 => 0x7A, :F12 => 0x7B,                       :num => 0x90, :scroll => 0x91, :lshift => 0xA0, :rshift => 0xA1,             :lctrl => 0xA2, :rctrl => 0xA3, :lalt => 0xA4, :ralt => 0xA5,             :colon => 0xBa, :plus => 0xBB, :comma => 0xBC, :minus => 0xBD,             :period => 0xBE, :slash => 0xBF, :tilde => 0xC0, :lbrace => 0xDB,             :backslash => 0xDC, :rbrace => 0xDD, :quote => 0xDE }             def self.press?(symbol)    return true unless CHECK.call(KEYS[symbol]) == 0  end  end #=============================================================================class Scene_Map < Scene_Base #Checks if conditions to jump are met#=============================================================================  @@eat_jump_delay = 0#--------------------------------------------------------------------------# * Jump update                                     [ALIAS METHOD]#--------------------------------------------------------------------------alias eaty_jump_update updatedef update  eaty_jump_updateif @@eat_jump_delay>0  @@eat_jump_delay-=1  elsif Keyboard_Full_input.press?(Eat_Jump::JUMP_BUTTON)  jump_call  @@eat_jump_delay=Eat_Jump::DELAY endend#--------------------------------------------------------------------------# * Jump call                                       [NEW METHOD]#--------------------------------------------------------------------------def jump_callreturn if !Keyboard_Full_input.press?(Eat_Jump::JUMP_BUTTON)$game_player.jumperino_checkend #=============================================================================end # Scene_Map class end#=============================================================================class Game_Player < Game_Character  #--------------------------------------------------------------------------# * Jump check                                      [NEW METHOD]#--------------------------------------------------------------------------def jumperino_check return if $game_message.busy? || $game_message.visiblen=Eat_Jump::JUMP_DISTd_up = self.directiond_do = 10-d_upd_le = eat_other_dir(d_up)d_ri = eat_other_dir(d_do)@jdx  = n*(eat_x_mov(d_up))@jdy  = n*(eat_y_mov(d_up))x_p2 = self.x + @jdx    y_p2 = self.y + @jdy    x_p1 = self.x + @jdx/n  y_p1 = self.y + @jdy/n  #-------------if $game_map.loop_horizontal?   #Check if looping map  x_p2=$game_map.round_x(x_p2)  x_p1=$game_map.round_x(x_p1)endif $game_map.loop_vertical?     #Check if looping map  y_p2=$game_map.round_y(y_p2)  y_p1=$game_map.round_y(y_p1)end  #-------------return if $game_switches[Eat_Jump::JUMP_SWITCH]==false &&          $game_map.region_id(x_p1, y_p1)!=Eat_Jump::ALLOWED#-------------v2 = total_pass(x_p2, y_p2, d_up, d_do, d_le, d_ri)#second tile aheadv1 = total_pass(x_p1, y_p1, d_up, d_do, d_le, d_ri)#first tile aheadif v1.include?(3) && !v2.include?(2) #v1 always jumpable?     self.eat_Jump_exec(@jdx,@jdy)#-----elsif   v1[1]==1 #v1 accessible from current direction?  if    v1[0]==1 #v1 accessible from opposite direction?  self.eat_Jump_exec(@jdx,@jdy)elsif v2[1]==0 || v2.include?(2) #v2 not access. from current dir?/Impassable?  @jdx /= n  @jdy /= n  self.eat_Jump_exec(@jdx,@jdy)    end #-----elsif v1[1]==0   #v1 unaccessible from current direction?  if   v1[0]==0 && v2.include?(1) #v1 accessible from opp. dir?/v2 accessible?  self.eat_Jump_exec(@jdx,@jdy)   end end  #-----end   #--------------------------------------------------------------------------# * Total passability check                              [NEW METHOD]#-------------------------------------------------------------------------def total_pass(x, y, d1,d2,d3,d4)#checks passability for each direction   pass = Array.new([0,0,0,0])  #-----  if $game_map.region_id(x, y) == Eat_Jump::IMPASSABLE ||    ($game_map.terrain_tag(x, y)==Eat_Jump::TERRAINTAG &&     $game_map.terrain_tag(self.x, self.y)!=Eat_Jump::TERRAINTAG)  pass=[2,2,2,2]   return pass  elsif $game_map.region_id(x, y) == Eat_Jump::PASSABLE  pass=[3,3,3,3]  return pass  end    #-----  return pass if $game_player.collide_with_events?(x, y)  pass[0]+=1  if $game_player.passable?(x, y, d1) #forward  pass[1]+=1  if $game_player.passable?(x, y, d2) #backward  pass[2]+=1  if $game_player.passable?(x, y, d3) #left  pass[3]+=1  if $game_player.passable?(x, y, d4) #right  return passend#--------------------------------------------------------------------------# * Other directions check                               [NEW METHOD]#------------------------------------------------------------------------- def eat_other_dir(d)#checks player current left and right return 4 if d==8return 6 if d==2return 8 if d==4return 2 if d==6end#--------------------------------------------------------------------------# * Determine x movement                                 [NEW METHOD]#-------------------------------------------------------------------------   def eat_x_mov(d)#define x movementreturn 1  if d==6return -1 if d==4return 0end#--------------------------------------------------------------------------# * Determine y movement                                 [NEW METHOD]#-------------------------------------------------------------------------  def eat_y_mov(d)#define y movementreturn 1  if d==2return -1 if d==8return 0  end#--------------------------------------------------------------------------# * Execute jump with sound                              [NEW METHOD]#------------------------------------------------------------------------- def eat_Jump_exec(x_plus,y_plus)#Execute jump and play sound    Eat_Jump::JUMP_SE.play    @followers.move    @x += x_plus    @y += y_plus    distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round    @jump_peak =  distance - @move_speed + Eat_Jump::JUMP_HEIGHT    @jump_count = @jump_peak * 2    @stop_count = 0    straightenend#--------------------------------------------------------------------------# * Update While Jumping                             [OVERWRITE METHOD]#--------------------------------------------------------------------------  def update_jump    @jump_count -= Eat_Jump::JUMP_SPEED      if Eat_Jump::SPRITE.is_a?(String)    @@sprite_name ||= self.character_name     self.set_graphic("#{Eat_Jump::SPRITE}", self.character_index)     if @jump_count <= 0    self.set_graphic("#{@@sprite_name}", self.character_index)    @@sprite_name=nil     end      end    @real_x = (@real_x * @jump_count + @x) / (@jump_count + 1.0)    @real_y = (@real_y * @jump_count + @y) / (@jump_count + 1.0)    update_bush_depth    if @jump_count <= 0      @jump_count=0      @followers.each { |f| f.jump(@x - f.x, @y - f.y) }      @real_x = @x = $game_map.round_x(@x)      @real_y = @y = $game_map.round_y(@y)    end  end#--------------------------------------------------------------------------# * move_by_input                                    [OVERWRITE METHOD]#--------------------------------------------------------------------------    def move_by_input    return if !movable? || $game_map.interpreter.running?    if Keyboard_Full_input.press?(Eat_Jump::TURN_ON_SPOT)    set_direction(Input.dir4)    return    end    move_straight(Input.dir4) if Input.dir4 > 0  end#================================================================== end   # Game_Player class  end#=============================================================================
    复制代码




     

    Added:

    -Jump Height

    -Jump Speed

    -Looping Map support

    -Sprite Change while jumping(optional)

    -Followers jump

    -On-spot Turn

     

    Todo:

    -Dashing modifier

    -Jump distance

     

    Credit: EatYourBeetS

     

    If you know how to improve this, have found any bugs, or have questions about the script, just comment below or send me a message, I want to get better at scripting   



    本贴来自国际rpgmaker官方论坛作者:EatYourBeetS处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/eatyourbeets-jump-script.39110/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-8 12:26 , Processed in 0.093743 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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