Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Kain Nobel's Jump Script [Question Resolved]

This topic has been resolved, thank you everybody who helped. I will be re-posting the script in the Submitted Scripts forum within the next 48 hours but for now you can find it in my last post. Have fun and enjoy! :D
 
How about an 'else' statement in the Jump_Up (et.al.) methods?
Or a 'while' statement?

Code:
  def jump_up(n = 1)
    while n > 0
      if passable?(@x, @y + (n-1), @direction)
        jump(0, -n)
        break
      end
      n -= 1
    end
  end
 
In the MACL, I created this method:
Code:
  #-------------------------------------------------------------------------
  # * Name      : Can Jump?
  #   Info      : Returns if Can Jump
  #   Author    : SephirothSpawn
  #   Call Info : Integer Amounts, X & Y Plus
  #-------------------------------------------------------------------------
  def can_jump?(x_plus, y_plus)
    new_x = @x + x_plus
    new_y = @y + y_plus
    return (x_plus == 0 and y_plus == 0) || passable?(new_x, new_y, 0)
  end

So, your new method could be like this:
Code:
def jump_up(x_plus, y_plus)
  while !can_jump?(x_plus, y_plus)
    break if x_plus == 0 && y_plus == 0
    # subtract/add your x_plus and y_plus but also considering angles. if you need help, let me know.
  end
  jump(x_plus, y_plus)
end

All you have to do is alter your x_plus and y_plus in that loop when a jump cannot be made. If you need help, let me know.
 
If none of that helps, you might want to look here for some ideas (because it does the exact same thing :grin:) :
Code:
#==============================================================================
# ** Game_Player jump modifications
#------------------------------------------------------------------------------
# Blabla this script enables you to jump with the X controller button (def. A)
#==============================================================================

class Game_Player < Game_Character
  
  JUMPSWITCH = 1       # This switch indicates the possibility of jumping
  CATERPILLAR = false  # Set this true, if you're using the caterpillar script
  JUMPSOUND = "Audio\\SE\\Jump1"   # You can define a sound played when jumping
                               # Leave empty to play nothing
  BUTTON_BEHAVIOUR = 2 # 1 for countinous jump when pressed, 2 for jump once
                       # per button press
  
  @jumpbutton = false
                       
  alias_method :ducktor_jump_movable?, :movable?
  def movable?
    return false if jumping?
    ducktor_jump_movable?
  end
  
  alias_method :ducktor_jump_move_by_input, :move_by_input
  def move_by_input
    ducktor_jump_move_by_input
    if Input.press?(Input::X) and $game_switches[JUMPSWITCH] and movable? and (not in_vehicle?)
      return if @jumpbutton and (BUTTON_BEHAVIOUR == 2)
      case @direction
      when 2
        if passable?(@x,@y+2)
          unless collide_with_characters?(@x,@y+1)
            $game_party.update_move(5, 0, 2) if CATERPILLAR
            @y += 2
            distance = 2
            @jump_peak = 10 + distance - @move_speed
            @jump_count = @jump_peak * 2
            @stop_count = 0
            straighten
            Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
          else
            distance = 0
            @jump_peak = 10 + distance - @move_speed
            @jump_count = @jump_peak * 2
            @stop_count = 0
            straighten
            Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
          end
        elsif passable?(@x,@y+1)
          $game_party.update_move(5, 0, 1) if CATERPILLAR
          @y += 1
          distance = 1
          @jump_peak = 10 + distance - @move_speed
          @jump_count = @jump_peak * 2
          @stop_count = 0
          straighten
          Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
        else
          distance = 0
          @jump_peak = 10 + distance - @move_speed
          @jump_count = @jump_peak * 2
          @stop_count = 0
          straighten
          Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
        end
      when 4
        if passable?(@x-2,@y)
          unless collide_with_characters?(@x-1,@y)
            $game_party.update_move(5, -2, 0) if CATERPILLAR
            @x -= 2
            distance = 2
            @jump_peak = 10 + distance - @move_speed
            @jump_count = @jump_peak * 2
            @stop_count = 0
            straighten
            Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
          else
            distance = 0
            @jump_peak = 10 + distance - @move_speed
            @jump_count = @jump_peak * 2
            @stop_count = 0
            straighten
            Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
          end
        elsif passable?(@x-1,@y)
          $game_party.update_move(5, -1, 0) if CATERPILLAR
          @x -= 1
          distance = 1
          @jump_peak = 10 + distance - @move_speed
          @jump_count = @jump_peak * 2
          @stop_count = 0
          straighten
          Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
        else
          distance = 0
          @jump_peak = 10 + distance - @move_speed
          @jump_count = @jump_peak * 2
          @stop_count = 0
          straighten
          Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
        end
      when 6
        if passable?(@x+2,@y)
          unless collide_with_characters?(@x+1,@y)
            $game_party.update_move(5, 2, 0) if CATERPILLAR
            @x += 2
            distance = 2
            @jump_peak = 10 + distance - @move_speed
            @jump_count = @jump_peak * 2
            @stop_count = 0
            straighten
            Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
          else
            distance = 0
            @jump_peak = 10 + distance - @move_speed
            @jump_count = @jump_peak * 2
            @stop_count = 0
            straighten
            Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
          end
        elsif passable?(@x+1,@y)
          $game_party.update_move(5, 1, 0) if CATERPILLAR
          @x += 1
          distance = 1
          @jump_peak = 10 + distance - @move_speed
          @jump_count = @jump_peak * 2
          @stop_count = 0
          straighten
          Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
        else
          distance = 0
          @jump_peak = 10 + distance - @move_speed
          @jump_count = @jump_peak * 2
          @stop_count = 0
          straighten
          Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
        end
      when 8
        if passable?(@x,@y-2)
          unless collide_with_characters?(@x,@y-1)
            $game_party.update_move(5, 0, -2) if CATERPILLAR
            @y -= 2
            distance = 2
            @jump_peak = 10 + distance - @move_speed
            @jump_count = @jump_peak * 2
            @stop_count = 0
            straighten
            Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
          else
            distance = 0
            @jump_peak = 10 + distance - @move_speed
            @jump_count = @jump_peak * 2
            @stop_count = 0
            straighten
            Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
          end
        elsif passable?(@x,@y-1)
          $game_party.update_move(5, 0, -1) if CATERPILLAR
          @y -= 1
          distance = 1
          @jump_peak = 10 + distance - @move_speed
          @jump_count = @jump_peak * 2
          @stop_count = 0
          straighten
          Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
        else
          distance = 0
          @jump_peak = 10 + distance - @move_speed
          @jump_count = @jump_peak * 2
          @stop_count = 0
          straighten
          Audio.se_play(JUMPSOUND) if (JUMPSOUND.size != 0)
        end
      end
    end
    @jumpbutton = jumping? ? Input.press?(Input::X) : false
  end
end
All credit to Ducktor.
Unless ofcourse this is RGSS you're doing this in. If it is, this will likely be utterly useless.
 
I'm not sure how your method is supposed to be implemented into this script Seph, and does that determine the farthest possible distance (within range)? I haven't used the || stuff before, so I'm not sure how that would pull the range needed, but it doesn't look defined enough to do what I was trying to do. Either way, I wrote my own methods, which still work for making the player jump a designated distance, but it still isn't recognizing the farthest range like I was hoping it would.

Here's the new version of the methods, you still call jump_up, jump_down, etc but without the arguments now.

Code:
  #-----------------------------------------------------------------------------
  # * Jump Up
  #----------------------------------------------------------------------------- 
  def jump_up(n = 1)
    unless jump_dist.nil?
      jump_sound
      jump(0, jump_dist.last)#(-n, 0)
    end
  end

Now, the method that defines the value of 'jump_dist'.

Code:
  #-----------------------------------------------------------------------------
  # * Jump Dist Modifier
  #-----------------------------------------------------------------------------
  def jump_dist
    @spaces = []
    case @direction
    when 2 # Down
      for i in 0...(-Jump::Distance)
        if passable?(self.x, self.y - i, 2)
          @spaces.push(i)
          return @spaces
        end
      end
    when 4 # Left
      for i in 0...(-Jump::Distance)
        if passable?(self.x + i, self.y, 4)
          @spaces.push(i)
          return @spaces
        end
      end
    when 6 # Right
      for i in 0...(-Jump::Distance)
        if passable?(self.x - i, self.y, 6)
          @spaces.push(i)
          return @spaces
        end
      end
    when 8 # Up
      for i in 0...(-Jump::Distance)
        if passable?(self.x, self.y + i, 8)
          @spaces.push(i)
          return @spaces
        end
      end
    end
  end
end

Basically, if you can't see the gist of what I'm trying to accomplish, I want it to pull the farthest available 'space' possible to jump to, then jump to it... so if he is allowed 3 spaces but can only jump 2, then I want to pull the '2' out of the range and only jump 2 instead of not jumping at all (or not jumping and still playing the Sound Effect x_X)

Here's the actual full script too if you need the updated version. It works for the *basic* of what I origionally accomplished, I think I just need to make a couple little changes to get it to work perfect.

Code:
#===============================================================================
# ** Jump
#-------------------------------------------------------------------------------
#   Determines jump speed and wether or not player is allowed to 'jump' on map.
#===============================================================================
module Jump
  Enabled     = true
  Debug       = false
  XcludeMaps  = [3]
  Distance    = 3
  SE          = "015-Jump01"#, 80,  90]
  LandSE      = ["016-Jump02", 80, 100]
  Button      = Input::ALT
end
################################################################################
#===============================================================================
# ** Game_Map
#-------------------------------------------------------------------------------
#  Added a method which will determine if jump is disabled on this map.
#===============================================================================
class Game_Map
  #-----------------------------------------------------------------------------
  # * Disable Dash?
  #-----------------------------------------------------------------------------
  def disable_jump?
    return Jump::XcludeMaps.include?(@map_id)
  end
end
################################################################################
#===============================================================================
# ** Game_Character
#-------------------------------------------------------------------------------
#   This class has been appended with easy jump commands.
#===============================================================================
class Game_Character
  #-----------------------------------------------------------------------------
  # * Alias Methods
  #-----------------------------------------------------------------------------
  alias_method :kn_jumpscript_game_character_initialize,  :initialize
  alias_method :kn_jumpscript_game_character_jump,        :jump
  #-----------------------------------------------------------------------------
  # * Initialize (*Aliased*)
  #-----------------------------------------------------------------------------
  def initialize
    kn_jumpscript_game_character_initialize
    @spaces  = []
    @jump_se = Jump::SE
    @land_se = Jump::LandSE
  end
  #-----------------------------------------------------------------------------
  # * Jump (*Aliased*)
  #-----------------------------------------------------------------------------
  def jump(x_plus, y_plus)
    jump_x, jump_y = self.x + x_plus, self.y + y_plus
    kn_jumpscript_game_character_jump(x_plus, y_plus)
    if self.x == jump_x && self.y == jump_y && !@land_se.nil?
      land_sound
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Up
  #----------------------------------------------------------------------------- 
  def jump_up
    unless jump_dist.nil?
      jump_sound
      jump(0, jump_dist.last)#(-n, 0)
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Down
  #-----------------------------------------------------------------------------
  def jump_down
    unless jump_dist.nil?
      jump_sound
      jump(0, -jump_dist.last)
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Left
  #-----------------------------------------------------------------------------
  def jump_left
    unless jump_dist.nil?
      jump_sound
      jump(jump_dist.last, 0)#(-n, 0)
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Right
  #-----------------------------------------------------------------------------
  def jump_right
    unless jump_dist.nil?
      jump_sound
      jump(-jump_dist.last, 0)#(n, 0)
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Sound
  #-----------------------------------------------------------------------------
  def jump_sound
    unless @jump_se.nil?
      if @jump_se.is_a?(Array)
        return Audio.se_play("Audio/SE/"+@jump_se[0],@jump_se[1],@jump_se[2])
      elsif @jump_se.is_a?(String)
        return Audio.se_play("Audio/SE/" + @jump_se, 100, 100)
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Sound
  #-----------------------------------------------------------------------------
  def land_sound
    unless @jump_se.nil?
      if @land_se.is_a?(Array)
        return Audio.se_play("Audio/SE/"+@land_se[0],@land_se[1],@land_se[2])
      elsif @land_se.is_a?(String)
        return Audio.se_play("Audio/SE/" + @land_se, 100, 100)
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Args
  #-----------------------------------------------------------------------------
  def jump_args
    case @direction
    when 2 # Facing Down
      return self.y > $game_map.height - Jump::Distance
    when 4 # Facing Left
      return self.x < Jump::Distance
    when 6
      return self.x > $game_map.width  - Jump::Distance
    when 8 # Facing Up
      return self.y < Jump::Distance
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Dist Modifier
  #-----------------------------------------------------------------------------
  def jump_dist
    @spaces = []
    case @direction
    when 2 # Down
      for i in 0...(-Jump::Distance)
        if passable?(self.x, self.y - i, 2)
          @spaces.push(i)
          return @spaces
        end
      end
    when 4 # Left
      for i in 0...(-Jump::Distance)
        if passable?(self.x + i, self.y, 4)
          @spaces.push(i)
          return @spaces
        end
      end
    when 6 # Right
      for i in 0...(-Jump::Distance)
        if passable?(self.x - i, self.y, 6)
          @spaces.push(i)
          return @spaces
        end
      end
    when 8 # Up
      for i in 0...(-Jump::Distance)
        if passable?(self.x, self.y + i, 8)
          @spaces.push(i)
          return @spaces
        end
      end
    end
  end
end
#===============================================================================
# ** Scene_Map
#-------------------------------------------------------------------------------
#   This scene has been enhanced to allow the player to jump when a certain
# button is pressed.
#===============================================================================
class Scene_Map
  #-----------------------------------------------------------------------------
  # * Alias Listing
  #-----------------------------------------------------------------------------
  alias_method :kn_jumpscript_scene_map_update,        :update
  #-----------------------------------------------------------------------------
  # * Update Method (*Aliased*)
  #-----------------------------------------------------------------------------
  def update
    kn_jumpscript_scene_map_update
    if Jump::Enabled
      jump_command
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Command
  #-----------------------------------------------------------------------------
  def jump_command
    if Input.press?(Jump::Button)
      unless $game_player.jumping? or $game_player.move_route_forcing or
      $game_player.jump_args or $game_temp.message_window_showing or
      $game_system.map_interpreter.running?
        case $game_player.direction
        when 2 ; $game_player.jump_down
        when 4 ; $game_player.jump_left
        when 6 ; $game_player.jump_right
        when 8 ; $game_player.jump_up
        end
      end
    end
  end
end
################################################################################
 
I've played with both of the methods, Ductor's is too 'conditional' for the freedom of jump range I'm trying to emphasis, and Seph's method caused my script to hang for some unseen reason, so it's not like I've totally ignored them, I thank you both for your help and I did at one time have one of both of those methods implemented for a minute.

Anyways, I'm focusing on my method at the moment, I appologize for having the odassity to write my own, it's purely just the pride of being able to write my own. Onto bussiness now...

Note how I pull the 'passible' spaces out like so, by using a 'for i' statement with passability then placing them into an array for each tile that is in fact 'passible'... However, it seems like the array is still returning the entire range of tiles and not just the 'passible' ones...

Code:
  def jump_dist
    @spaces = []
    case @direction
    when 2 # Down
      for i in 0...(-Jump::Distance)
        if passable?(self.x, self.y - i, 2)
          @spaces.push(i)
          return @spaces
        end
      end
    #...

Then I turn around and use them in the jump_up, jump_down, etc methods...

Code:
jump(0, jump_dist.last) # Would be a jump_down, -jump_dist.last would be up

Why isn't it returning the 'last' tile like it should? It does the 'first' one and makes him jump 1 space when I use '.first' (when I test it), but it doesn't do the 'last' one based off the passible information I sent to '@spaces'.

Basically, why is jump_dist.last returning '3' when it should be returning '1'? All of the tiles are placed into the array, even when they're not supposed to be there.
 
Code:
 def jump_dist
    @spaces = []
    case @direction
    when 2 # Down
      for i in 0...(-Jump::Distance)
        if passable?(self.x, self.y - i, 2)
          @spaces.push(i)
          return @spaces
        end
      end

What is that "return @spaces" doing inside the FOR... Should'nt it go outside?
What happens there is that once it finds a passable tile it will add "i" to @spaces and will return @spaces with a single value (ALWAYS)... so change that and see what happens.

Later
 
Kain, "audacity" is good here. As long as you understood & considered everyone's input, you are more than free to choose to use your own method. This board is about 'learning to script', not just blindly accepting or expecting someone else to do it for  you. (that's what 'Script Requests' is for)  :scruff:
 
This has been resolved @ http://www.ruby-forum.com/topic/159776

However, thank you everybody who had helped me here, my script works great now! Sorry if I seemed rash for a sec, I've really been stressed waiting for my baby girl to be born! Anyways...

Here's the finished script, somebody re-wrote my jump_dist method for me but I've learned something new from it so I'm happy! (And my baby girl was born yesterday morning at 6:32 am, so I'm really happy now!)

But like I said, here is the finished script with the new jump_dist method. Thanks to everybody who helped, enjoy! (I'll repost it in submitted tomorrow night, after work.)

Code:
#===============================================================================
# ** Jump
#-------------------------------------------------------------------------------
# Written by  : Kain Nobel
# Version     : 0.5
# Last Update : 07/15/2008
# Created On  : 07/14/2008
#-------------------------------------------------------------------------------
# * Special thanks to David A Black @ ruby-forum.com for simplifying jump_dist.
################################################################################
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
# ~**                 CUSTOMIZABLE CONSTANTS - BEGIN                       **~ #
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
################################################################################
module Jump
  Enabled     = true
  Debug       = false
  XcludeMaps  = [3]
  Distance    = 4
  SE          = "015-Jump01"#, 80,  90]
  LandSE      = ["016-Jump02", 80, 100]
  Button      = Input::ALT
end
################################################################################
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
# ~**                  CUSTOMIZABLE CONSTANTS - END                        **~ #
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
################################################################################
#===============================================================================
# ** Game_Map
#-------------------------------------------------------------------------------
#  Added a method which will determine if jump is disabled on this map.
#===============================================================================
class Game_Map
  #-----------------------------------------------------------------------------
  # * Disable Dash?
  #-----------------------------------------------------------------------------
  def disable_jump?
    return Jump::XcludeMaps.include?(@map_id)
  end
end
################################################################################
#===============================================================================
# ** Game_Character
#-------------------------------------------------------------------------------
#   This class has been appended with easy jump commands.
#===============================================================================
class Game_Character
  attr_reader :spaces
  #-----------------------------------------------------------------------------
  # * Alias Methods
  #-----------------------------------------------------------------------------
  alias_method :kn_jumpscript_game_character_initialize,  :initialize
  alias_method :kn_jumpscript_game_character_jump,        :jump
  #-----------------------------------------------------------------------------
  # * Initialize (*Aliased*)
  #-----------------------------------------------------------------------------
  def initialize
    kn_jumpscript_game_character_initialize
    @spaces  = []
    @jump_se = Jump::SE
    @land_se = Jump::LandSE
  end
  #-----------------------------------------------------------------------------
  # * Jump (*Aliased*)
  #-----------------------------------------------------------------------------
  def jump(x_plus, y_plus)
    jump_x, jump_y = self.x + x_plus, self.y + y_plus
    kn_jumpscript_game_character_jump(x_plus, y_plus)
    if self.x == jump_x && self.y == jump_y && !@land_se.nil?
      land_sound
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Up
  #----------------------------------------------------------------------------- 
  def jump_up
    unless jump_dist[-1].nil? or jump_dist[-1] == 0
      jump_sound
      jump(0, -jump_dist.last)
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Down
  #-----------------------------------------------------------------------------
  def jump_down
    unless jump_dist[-1].nil? or jump_dist[-1] == 0
      jump_sound
      jump(0, jump_dist.last)
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Left
  #-----------------------------------------------------------------------------
  def jump_left
    unless jump_dist[-1].nil? or jump_dist[-1] == 0
      jump_sound
      jump(-jump_dist.last, 0)
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Right
  #-----------------------------------------------------------------------------
  def jump_right
    unless jump_dist[-1].nil? or jump_dist[-1] == 0
      jump_sound
      jump(jump_dist.last, 0)
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Sound
  #-----------------------------------------------------------------------------
  def jump_sound
    unless @jump_se.nil?
      if @jump_se.is_a?(Array)
        return Audio.se_play("Audio/SE/"+@jump_se[0],@jump_se[1],@jump_se[2])
      elsif @jump_se.is_a?(String)
        return Audio.se_play("Audio/SE/" + @jump_se, 100, 100)
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Sound
  #-----------------------------------------------------------------------------
  def land_sound
    unless @jump_se.nil?
      if @land_se.is_a?(Array)
        return Audio.se_play("Audio/SE/"+@land_se[0],@land_se[1],@land_se[2])
      elsif @land_se.is_a?(String)
        return Audio.se_play("Audio/SE/" + @land_se, 100, 100)
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Args
  #-----------------------------------------------------------------------------
  def jump_args
    case @direction
    when 2 # Facing Down
      return self.y > $game_map.height - Jump::Distance
    when 4 # Facing Left
      return self.x < Jump::Distance
    when 6
      return self.x > $game_map.width  - Jump::Distance
    when 8 # Facing Up
      return self.y < Jump::Distance
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Dist Modifier
  #-----------------------------------------------------------------------------
  def jump_dist
    spaces = []
    0.upto(Jump::Distance-1) do |i|
      pass = case @direction
      when 2  then passable?(self.x, self.y + i, 2)
      when 4  then passable?(self.x - i, self.y, 4)
      when 6  then passable?(self.x + i, self.y, 6)
      when 8  then passable?(self.x, self.y - i, 8)
      end
      if pass
        spaces[i] = (i+1)
      end
    end
    return spaces
  end
end
#===============================================================================
# ** Scene_Map
#-------------------------------------------------------------------------------
#   This scene has been enhanced to allow the player to jump when a certain
# button is pressed.
#===============================================================================
class Scene_Map
  #-----------------------------------------------------------------------------
  # * Alias Listing
  #-----------------------------------------------------------------------------
  alias_method :kn_jumpscript_scene_map_update,        :update
  #-----------------------------------------------------------------------------
  # * Update Method (*Aliased*)
  #-----------------------------------------------------------------------------
  def update
    kn_jumpscript_scene_map_update
    if Jump::Enabled
      jump_command
    end
  end
  #-----------------------------------------------------------------------------
  # * Jump Command
  #-----------------------------------------------------------------------------
  def jump_command
    if Input.press?(Jump::Button)
      unless $game_player.jumping? or $game_player.move_route_forcing or
      $game_player.jump_args or $game_temp.message_window_showing or
      $game_system.map_interpreter.running?
        case $game_player.direction
        when 2 ; $game_player.jump_down
        when 4 ; $game_player.jump_left
        when 6 ; $game_player.jump_right
        when 8 ; $game_player.jump_up
        end
      end
    end
  end
end
################################################################################
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top