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.

Advanced 8-Directional Movement Script [by Draycos] - [EDIT]

I've downloaded this script some times ago... and now i'm trying to implement it into my project...
But there's a little problem... This script use the latest version of the SDK, and i'm using an old one (1.5) whit some of my scripts... so i really need to make it start whit the old version, and more... i need only the Axial Movement (Resident Evil Style) and the 8-Directional Graphic... i really don't need the rest... i want to take off the other options...
at least... i would like it to be activated by switch or call-script

The thing i'm trying to do is a vehicle sistem... When you jump into the veicle the movement system change like the one in Resident Evil... and the graphic of the vehicle become 8-directional... so, when you jump off the vehicle, all turn back to normal...

The link to the Advanced 8-D Movement is this:
viewtopic.php?f=11&t=15551&hilit=+directional

This script must work whit this:
Code:
#==============================================================================

# ** Advance Movement System

#------------------------------------------------------------------------------

# SephirothSpawn

# Version 1

# 2006-04-24

#------------------------------------------------------------------------------

# Script Concepts By: Homer, XK8 & Others

#------------------------------------------------------------------------------

# Walking, Sneaking, running, Jumping & Isometric System

#------------------------------------------------------------------------------

#==============================================================================

 

#------------------------------------------------------------------------------

# * SDK Log Script

#------------------------------------------------------------------------------

SDK.log('Advance Movement System', 'SephirothSpawn', 1, '2006-04-24')

 

#------------------------------------------------------------------------------

# * Begin SDK Enable Test

#------------------------------------------------------------------------------

if SDK.state('Advance Movement System') == true

#==============================================================================

# ** Game_Player

#==============================================================================

 

class Game_Player < Game_Character

  #--------------------------------------------------------------------------

  # * Buttons, Speed & Distance

  #-------------------------------------------------------------------------- 

  $x = 0

  Run_Button  = Input::B    # Input Button it run

  $Walk_Speed   = 4       # Walk Speed (4 is Normal Walking)

  Run_Speed   = 4.5         # run Speed (4 is Normal Walking)

  Run_Cost = 1              # Number of Seconds to Decrease run

  Run_Recover = 2           # Number of Seconds to Recover run

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_reader :current_run_level            # run Stamina Left

  attr_accessor :max_run_bonus              # run Bonus (To Max)

  attr_accessor :enable_running              # run Enabler       

  attr_accessor :enable_isometric            # Isometric Movement Enabler

  attr_accessor :enable_running_animation    # run Animation

  attr_accessor :enable_isometric_animation  # Isometric Animation

  #--------------------------------------------------------------------------

  # * Alias Listings

  #--------------------------------------------------------------------------

  

  alias seph_wsdanim_gameplayer_init initialize

  alias seph_wsdanim_gameplayer_refresh refresh

  alias seph_wsdanim_gameplayer_update update

  alias seph_wsdanim_gameplayer_um update_move

  alias seph_wsdanim_gameplayer_us update_stop

  alias seph_wsdanim_gameplayer_upm update_player_movement

  alias seph_wsdanim_gameplayer_md move_down

  alias seph_wsdanim_gameplayer_ml move_left

  alias seph_wsdanim_gameplayer_mr move_right

  alias seph_wsdanim_gameplayer_mu move_up

  alias seph_wsdanim_gameplayer_mll move_lower_left

  alias seph_wsdanim_gameplayer_mlr move_lower_right

  alias seph_wsdanim_gameplayer_mul move_upper_left

  alias seph_wsdanim_gameplayer_mur move_upper_right

  alias seph_wsdanim_gameplayer_mrand move_random

  alias seph_wsdanim_gameplayer_mf move_forward

  alias seph_wsdanim_gameplayer_mb move_backward

  alias seph_wsdanim_gameplayer_cett check_event_trigger_there

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize

    # Original Initialization

    seph_wsdanim_gameplayer_init

    # Enable Movement Features Test

    @next_dash = 0

    @dash_duration = 0

    $enable_running = true                    # Enable running Test

    @enable_isometric = true                  # Enable Isometric Test

    # Enable Movement Features Animation Test

    @enable_standing_animation = true         # Enable Stand Animation Test

    $enable_running_animation = true          # Enable running Animation Test

    $enable_isometric_animation = false       # Enable Isometric Animation Test

    # Sneak & Bonuses

    @max_run_bonus = 0

    # Sets Current Sneak & run Level

    @current_run_level = 5     # Starting run Level

    # Sneaking & running

    @running = false

    $dashing = false

    # Jump Direction

    # Isometric

    if $enable_isometric_animation

      @character_name += '_iso'

    end

    # Duplicate Character Name

    @dup_character_name = @character_name

    @jukebox = Window_JukeBox.new

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    # Original Refresh Method

    seph_wsdanim_gameplayer_refresh

    # Isometric

    if $enable_isometric_animation

      @character_name += '_iso'

    end

    # Duplicate Character Name

    @dup_character_name = @character_name

  end

  #--------------------------------------------------------------------------

  # * Player Movement Update

  #--------------------------------------------------------------------------

  def update

    

    

    

    def max_run_level

    return nil

  end

#==============================================================================

#----------# JUKEBOX #---------------------------------------------------------

#==============================================================================

 

    if $juke == true

      update_jukebox

    end

 

#==============================================================================

#----------# JUKEBOX #---------------------------------------------------------

#==============================================================================

 

    # If run Enabled

    if $enable_running && !@sneaking

      # Update run

      update_run 

      # Update run Level

      update_run_level unless max_run_level.nil?

    end

    # Update Walking

    update_walk

    # If Jumping Enabled

    

    seph_wsdanim_gameplayer_update

  end

  #--------------------------------------------------------------------------

  # * Update frame (move)

  #--------------------------------------------------------------------------

  def update_move

    # Original Update Move

    #seph_wsdanim_gameplayer_um

    # Sneak Animation

    if @sneaking && @enable_sneaking_animation

      unless @character_name.include?('_sneak')

        @character_name = @dup_character_name + '_sneak'

      end

    elsif @running && $enable_running_animation

      unless @character_name.include?('_run')

        @character_name = @dup_character_name + '_run'

      end

    elsif $dashing

      unless @character_name.include?('_dash')

        @character_name = @dup_character_name + '_dash'

      end

    else

      @character_name = @dup_character_name

    end

    

    # Isometric Animation

    @direction = @jump_direction if enable_isometric_animation

    seph_wsdanim_gameplayer_um

  end

  #--------------------------------------------------------------------------

  # * Frame Update (stop)

  #--------------------------------------------------------------------------

  def update_stop

    # Original Update Stop

    seph_wsdanim_gameplayer_us

    # Restore Character Name

    if @pattern == @original_pattern

      @character_name = @dup_character_name

    end

    # Standing Animations

    if @enable_standing_animation

      @step_anime = true

      unless @character_name.include?('_stand')

        @character_name = @dup_character_name + '_stand'

      end

    else

      @step_anime = false

      @character_name = @dup_character_name

    end

    # Isometric Animation

    @direction = @jump_direction if enable_isometric_animation

  end

  #--------------------------------------------------------------------------

  # * Player Movement Update

  #--------------------------------------------------------------------------

  def update_player_movement

    # If Isometic Enabled

    if @enable_isometric

      # Branch Point By Input

      case Input.dir8

      when 1 # Down-Left

        move_lower_left

        return

      when 3 # Down-Right

        move_lower_right

        return

      when 7 # Up-Left

        move_upper_left

        return

      when 9 # Up-Right

        move_upper_right

        return

      end

    end

    # Original Update Player Movement

    seph_wsdanim_gameplayer_upm

  end

  #--------------------------------------------------------------------------

  # * Move Down

  #--------------------------------------------------------------------------

  def move_down(turn_enabled = true)

    # Original Move Down

    seph_wsdanim_gameplayer_md(turn_enabled)

    # Adjust Jump Direction

    @jump_direction = @direction

  end

  #--------------------------------------------------------------------------

  # * Move Left

  #--------------------------------------------------------------------------

  def move_left(turn_enabled = true)

    # Original Move Left

    seph_wsdanim_gameplayer_ml(turn_enabled)

    # Adjust Jump Direction

    @jump_direction = @direction

  end

  #--------------------------------------------------------------------------

  # * Move Right

  #--------------------------------------------------------------------------

  def move_right(turn_enabled = true)

    # Original Move Right

    seph_wsdanim_gameplayer_mr(turn_enabled)

    # Adjust Jump Direction

    @jump_direction = @direction

  end

  #--------------------------------------------------------------------------

  # * Move up

  #--------------------------------------------------------------------------

  def move_up(turn_enabled = true)

    # Original Move Up

    seph_wsdanim_gameplayer_mu(turn_enabled)

    # Adjust Jump Direction

    @jump_direction = @direction

  end

  #--------------------------------------------------------------------------

  # * Move Lower Left

  #--------------------------------------------------------------------------

  def move_lower_left

    # Original Move Lower Left

    seph_wsdanim_gameplayer_mll

    # Isometric Animation

    @direction = 10 if enable_isometric_animation

    # Jump Direction

    @jump_direction = 10

  end

  #--------------------------------------------------------------------------

  # * Move Lower Right

  #--------------------------------------------------------------------------

  def move_lower_right

    # Original Move Lower Right

    seph_wsdanim_gameplayer_mlr

    # Isometric Animation

    @direction = 12 if enable_isometric_animation

    # Jump Direction

    @jump_direction = 12

  end

  #--------------------------------------------------------------------------

  # * Move Upper Left

  #--------------------------------------------------------------------------

  def move_upper_left

    # Original Move Upper Left

    seph_wsdanim_gameplayer_mul

    # Isometric Animation

    @direction = 14 if enable_isometric_animation

    # Jump Direction

    @jump_direction = 14

  end

  #--------------------------------------------------------------------------

  # * Move Upper Right

  #--------------------------------------------------------------------------

  def move_upper_right

    # Original Move Upper Right

    seph_wsdanim_gameplayer_mur

    # Isometric Animation

    @direction = 16 if enable_isometric_animation

    # Jump Direction

    @jump_direction = 16

  end

  #--------------------------------------------------------------------------

  # * Move at Random

  #--------------------------------------------------------------------------

  def move_random

    # Isometric Movement

    case rand(8)

    when 4 # Down-Left

      move_lower_left

    when 5 # Down-Right

      move_lower_right

    when 6 # Up-Left

      move_upper_left

    when 7 # up-Right

      move_upper_right

    else

      # Original Movement

      seph_wsdanim_gameplayer_mrand

    end

  end

  #--------------------------------------------------------------------------

  # * 1 Step Forward

  #--------------------------------------------------------------------------

  def move_forward

    # Isometric Movement

    case @jump_direction

    when 10

      move_lower_left

    when 12

      move_lower_right

    when 14

      move_upper_left

    when 16

      move_upper_right

    else

      # Original Movement

      seph_wsdanim_gameplayer_mf

    end

  end

  #--------------------------------------------------------------------------

  # * 1 Step Backward

  #--------------------------------------------------------------------------

  def move_backward

    # Remember direction fix situation

    last_direction_fix = @direction_fix

    # Force direction fix

    @direction_fix = true

    # Isometric Movement

    case @jump_direction

    when 10

      move_upper_right

    when 12

      move_upper_left

    when 14

      move_lower_right

    when 16

      move_lower_left

    else

      # Original Movement

      seph_wsdanim_gameplayer_mb

    end

    # Return direction fix situation back to normal

    @direction_fix = last_direction_fix

  end

  #--------------------------------------------------------------------------

  # * Max Sneak Level

  #  ~ Nil For Unlimited

  #--------------------------------------------------------------------------

  

#==============================================================================

#----------# JUKEBOX #---------------------------------------------------------

#==============================================================================

 

    def update_jukebox

      # If JukeBox Button is Pressed

      if Input.repeat?(Input::X)

        # If è in esecuzione l'ultimo brano

        if $x == $numero_brani

          # Torna a suonare il primo

          $x = 0

        else

          # Altrimenti Parti con il secondo brano

          $x += 1

        end

        $jukebox.search($x)

        @jukebox.refresh

      end

    end

 

#==============================================================================

#----------# JUKEBOX #---------------------------------------------------------

#==============================================================================

 

  #--------------------------------------------------------------------------

  # * Frame Update : run

  #--------------------------------------------------------------------------

  def update_run

    # If run Button is Pressed

    if Input.press?(Run_Button)

      # If run Level is Greater than 0 (Or Max is nil)

      if @current_run_level > 0 || max_run_level.nil?

        # Turn run On

        @running = true

        # Adjust Move Speed

        @move_speed = Run_Speed

        return

      end

    end

    # Turn run Off

    @running = false

  end

  #--------------------------------------------------------------------------

  # * Frame Update : run Level

  #--------------------------------------------------------------------------

  def update_run_level

    # If running

    if @running

      # Lose 1 Every run Cost

      if Graphics.frame_count % (Graphics.frame_rate * run_Cost) == 0

        # Decrease run

        @current_run_level -= 1

      end

    # Recover run

    else

      # Gain 1 Every run Recover

      if Graphics.frame_count % (Graphics.frame_rate * run_Recover) == 0

        # Increase run Level

        @current_run_level += 1 if @current_run_level < max_run_level

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Frame Update : Walk

  #--------------------------------------------------------------------------

  def update_walk

    # Reset Move Speed (Walking)

    unless @sneaking || @running || $dashing

      @move_speed = $Walk_Speed

    end

  end

  #--------------------------------------------------------------------------

  # * Front Event Starting Determinant (Isometric)

  #--------------------------------------------------------------------------

  def check_event_trigger_there_iso(triggers)

    result = false

    # Calculate front event coordinates

    case @jump_direction

    when 10

      new_x, new_y = @x - 1, @y + 1

    when 12

      new_x, new_y = @x + 1, @y + 1

    when 14

      new_x, new_y = @x - 1, @y - 1

    when 16

      new_x, new_y = @x + 1, @y - 1

    end

    # All event loops

    for event in $game_map.events.values

      # If event coordinates and triggers are consistent

      if event.x == new_x and event.y == new_y and

         triggers.include?(event.trigger)

        # If starting determinant is front event (other than jumping)

        if not event.jumping? and not event.over_trigger?

          event.start

          result = true

        end

      end

    end

    # If fitting event is not found

    if result == false

      # If front tile is a counter

      if $game_map.counter?(new_x, new_y)

        # Calculate 1 tile inside coordinates

        new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)

        new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)

        # All event loops

        for event in $game_map.events.values

          # If event coordinates and triggers are consistent

          if event.x == new_x and event.y == new_y and

             triggers.include?(event.trigger)

            # If starting determinant is front event (other than jumping)

            if not event.jumping? and not event.over_trigger?

              event.start

              result = true

            end

          end

        end

      end

    end

    return result

  end

end

 

#==============================================================================

# ** Sprite_Character

#==============================================================================

 

class Sprite_Character < RPG::Sprite

  #--------------------------------------------------------------------------

  # * Alias Listings

  #--------------------------------------------------------------------------

  alias seph_wsdanim_sprchara_update update

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    super

    # If Game Player

    if @character.is_a?(Game_Player)

      if @character.enable_isometric_animation

        # If tile ID, file name, or hue are different from current ones

        if @tile_id != @character.tile_id or

           @character_name != @character.character_name or

           @character_hue != @character.character_hue

          # Remember tile ID, file name, and hue

          @tile_id = @character.tile_id

          @character_name = @character.character_name

          @character_hue = @character.character_hue

          # If tile ID value is valid

          if @tile_id >= 384

            self.bitmap = RPG::Cache.tile($game_map.tileset_name,

              @tile_id, @character.character_hue)

            self.src_rect.set(0, 0, 32, 32)

            self.ox = 16

            self.oy = 32

          # If tile ID value is invalid

          else

            self.bitmap = RPG::Cache.character(@character.character_name,

              @character.character_hue)

            @cw = bitmap.width / 4

            @ch = bitmap.height / 8

            self.ox = @cw / 2

            self.oy = @ch

          end

        end

        # Set visible situation

        self.visible = (not @character.transparent)

        # If graphic is character

        if @tile_id == 0

          # Set rectangular transfer

          sx = @character.pattern * @cw

          sy = (@character.direction - 2) / 2 * @ch

          self.src_rect.set(sx, sy, @cw, @ch)

        end

        # Set sprite coordinates

        self.x = @character.screen_x

        self.y = @character.screen_y

        self.z = @character.screen_z(@ch)

        # Set opacity level, blend method, and bush depth

        self.opacity = @character.opacity

        self.blend_type = @character.blend_type

        self.bush_depth = @character.bush_depth

        # Animation

        if @character.animation_id != 0

          animation = $data_animations[@character.animation_id]

          animation(animation, true)

          @character.animation_id = 0

        end

        return

      end

    end

    # Original Update

    seph_wsdanim_sprchara_update

  end

end

 

#------------------------------------------------------------------------------

# * End SDK Enable Test

#------------------------------------------------------------------------------

end
 
Hello.

I've only recently come back to rmxp.org and already have plans for a few new scripts. in the meantime, I will be happy to take care of this for you as I am the author of the script you mentioned.

Let me make sure I have this right, you want the axial movement with 8 directions from my script to be compatible with Seph's script you posted. Is that correct?

--Draycos Goldaryn

PS: do you want 8-directional sprites only when using axial movement, or throughout the game?
PPS: Are you using the isometric function of seph's script?
 

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