Kakashi heroe's
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.

Kakashi heroe's

Forum du projet Kakashi heroe's
 
AccueilRechercherDernières imagesS'enregistrerConnexion
Le Deal du moment : -14%
Apple MacBook Air (2020) 13,3″ Puce Apple M1 ...
Voir le deal
799 €

 

 [combat]Combat de coté version 1.5

Aller en bas 
AuteurMessage
Uchiha sasuke
Admin
Uchiha sasuke


Nombre de messages : 63
Date d'inscription : 21/06/2007

[combat]Combat de coté version 1.5 Empty
MessageSujet: [combat]Combat de coté version 1.5   [combat]Combat de coté version 1.5 Icon_minitimeSam 23 Juin - 20:12

J'ai pris le scripte Combat vue sur le coté, et j'ai pas trouvé cool que les ennemies soit tout gros et moche au milieu de l'écran.
Il suffit de créer un nouveau scripte au dessus de main et l'apeller Combat_Coté (ou Lapin, pour ce que ça joue...)
IMPORTANT!! il faut aussi avoir dans game\characters des sprites du même nom que les battlers des monstres. de même, les battlers peuvent êtres vides. seul le nom est important
Code:
#==============================================================================
#Script combat de coté
#version 2 par Skylight
#==============================================================================
module SDVA

  X_LINE = 100 # positionnement horizontal
  Y_LINE = 200 # positionnement vertical
  X_SPACE = 15 # écartement horizontal
  Y_SPACE = 40 # écartement vertical
  X_POSITION = 25 #
  Y_POSITION = 0 #

 # mouvement en attaquant?( true / false )
  ATTACK_MOVE = true # alliés
  ATTACK_MOVE_E = true # ennemis
 
  # mouvement en lançant une tech?( true / false )
  SKILL_MOVE = false # alliés
  SKILL_MOVE_E = false # ennemis
 
  # mouvement en uttilisant un objet?( true / false )
  ITEM_MOVE = false # alliés
 
  # nombre de pas
  MOVE_STEP = 5 # alliés
  MOVE_STEP_E = 5 # ennemis
 
  # pixel par pas
  MOVE_PIXEL = 10 #alliés
  MOVE_PIXEL_E = 10 # ennemis

  PARTY_POS = 1 # 1:alliés à droite / 2:alliés à gauche

  WINDOWPOS_CHANGE = true

end
#==============================================================================
#  Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# gère le positionnement horizontal des heros
#--------------------------------------------------------------------------
  def screen_x
    if self.index != nil
      # Positionde la classe, si uttilisée dans le jeux
      pos = $data_classes[self.class_id].position
      x_pos = pos *( SDVA::X_POSITION)
      if SDVA::PARTY_POS ==1
        line=500-SDVA::X_LINE
      elsif SDVA::PARTY_POS ==2
        line=SDVA::X_LINE
      end
      scr_x = self.index * SDVA::X_SPACE + line + x_pos
      if self.current_action.move_action == true
        scr_x += @shift_x
      end
      return scr_x
    else
      return 0
    end
  end
#--------------------------------------------------------------------------
# gère le positionnement vertical des heros
#--------------------------------------------------------------------------
  def screen_y
    if self.index != nil
      # Position de la classe, si uttilisée dans le jeux
      pos = $data_classes[self.class_id].position
      y_pos = pos * SDVA::Y_POSITION
      scr_y = self.index * SDVA::Y_SPACE + SDVA::Y_LINE + y_pos
      # ??????????
      if self.current_action.move_action == true
        # ????
        scr_y += @shift_y
      end
      return scr_y
    else
      return 0
    end
  end
#--------------------------------------------------------------------------
# gère le calque des heros
#--------------------------------------------------------------------------
  def screen_z
    if self.index != nil
      return self.index
    else
      return 0
    end
  end
end

#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ? ????? X ?????
#--------------------------------------------------------------------------
  def screen_x
    if self.index != nil
      base_screen_x=$data_troops[@troop_id].members[@member_index].x
      scr_x = SDVA::PARTY_POS ==1 ? base_screen_x : 500- base_screen_x
# ??????????
      if self.current_action.move_action == true
# ????
        scr_x += @shift_x
      end
      return scr_x
    else
      return 0
    end
  end
end
#==============================================================================
# ? Game_Battler (???? 1)
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
  attr_reader :pattern # ??????
  attr_reader :trans_x # X???????
  attr_reader :moving # ??????
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
  alias initialize_sdv initialize
  def initialize
    initialize_sdv
    move_reset
  end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
  def move
    @moving = 1
    if @step < SDVA::MOVE_STEP
      # ??????????
      @pattern = (@pattern + 1) % 4
      @step += 1
      move_step
    else
      # ????
      @pattern = 1
      @moving = 2
    end
  end
 
  def move_e
    @moving = 1
    if @step < SDVA::MOVE_STEP_E
      # ??????????
      @pattern = (@pattern + 1) % 4
      @step += 1
      move_step_e
    else
      # ????
      @pattern = 1
      @moving = 2
    end
  end 
 
#--------------------------------------------------------------------------
# ? ????
#--------------------------------------------------------------------------
  def move_step
  # ???????????????????
    case SDVA::PARTY_POS
      when 1
        @shift_x = -(@step * SDVA::MOVE_PIXEL)
      when 2
        @shift_x = @step * SDVA::MOVE_PIXEL
    end
  end

  def move_step_e
  # ???????????????????
    case SDVA::PARTY_POS
      when 1
        @shift_x = @step * SDVA::MOVE_PIXEL_E
      when 2
        @shift_x = -(@step * SDVA::MOVE_PIXEL_E)
    end
  end

#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
  def move_reset
    @moving = 0
    @pattern = 0
    @step = 0
    @shift_x = 0
    @shift_y = 0
  end
end

#==============================================================================
# ? Game_BattleAction
#==============================================================================

class Game_BattleAction
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_accessor :move_action # ??????????
#--------------------------------------------------------------------------
# ? ???
#--------------------------------------------------------------------------
  alias clear_sdv clear
  def clear
    clear_sdv
    @move_action = false
  end
 
end

#==============================================================================
#  Sprite_Battler
# transforme les battlers en petits spritesqui peuvent bouger et ainsi de suite
#==============================================================================

class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
  alias update_sdv update
  def update
  # ????????????????
    if @battler.is_a?(Game_Actor)
    # ????????????????????
    # ??????
      if @battler.battler_name != @battler_name or
        @battler.battler_hue != @battler_hue or
        @battler.current_action.basic == 0 or
        @battler.current_action.kind != 3
        # ????????????
        @character_name = @battler.character_name#+"_c"
        @character_hue = @battler.character_hue
        # gère le sprite. TRES IMPORTANT
        self.bitmap = RPG::Cache.character(@character_name, @character_hue)
        cw = self.bitmap.width / 4
        ch = self.bitmap.height / 4
        @width = cw
        @height = ch
        if @battler.current_action.move_action == true
          # ????
          @battler.move
        else
          @battler.move_reset
        end
        # ?????????
        sx = @battler.pattern * cw
        sy = SDVA::PARTY_POS * ch
        self.src_rect.set(sx, sy, cw, ch)
        self.ox = @width / 2
        self.oy = @height
        # ??????????? 0 ???
        if @battler.hidden
          self.opacity = 0
        end
      end
    end
     
    if @battler.is_a?(Game_Enemy)
      # ????????????????????
      # ??????
      if @battler.battler_name != @battler_name or
        @battler.battler_hue != @battler_hue or
        @battler.current_action.basic == 0 or
        @battler.current_action.kind != 3
        # ????????????
        @character_name = $data_enemies[@battler.id].battler_name
        @character_hue = $data_enemies[@battler.id].battler_hue
        # ???????????
        self.bitmap = RPG::Cache.character(@character_name, @character_hue)
        cw = self.bitmap.width / 4
        ch = self.bitmap.height / 4
        @width = cw
        @height = ch
        if @battler.current_action.move_action == true
        # ????
          @battler.move_e
        else
          @battler.move_reset
        end
        # ?????????
        sx = @battler.pattern * cw
        sy = (3-SDVA::PARTY_POS) * ch
        self.src_rect.set(sx, sy, cw, ch)
        self.ox = @width / 2
        self.oy = @height
        # ??????????? 0 ???
        if @battler.hidden
          self.opacity = 0
        end
      end
    end
    update_sdv
  end
end

#==============================================================================
# ? Scene_Battle
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# ? ????????????????????
#--------------------------------------------------------------------------
  alias phase3_setup_command_window_sdv phase3_setup_command_window
  def phase3_setup_command_window
    phase3_setup_command_window_sdv

    if SDVA::WINDOWPOS_CHANGE
      # ???????????????????
      case SDVA::PARTY_POS
        when 0
          x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
          y_pos = @active_battler.screen_y
        when 1
          x_pos = @active_battler.screen_x - @actor_command_window.width - 16
          y_pos = @active_battler.screen_y - @actor_command_window.height
        when 2
          x_pos = @active_battler.screen_x + 16
          y_pos = @active_battler.screen_y - @actor_command_window.height
        when 3
          x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
          y_pos = @active_battler.screen_y - @actor_command_window.height - 48
      end
      @actor_command_window.x = x_pos >= 0 ? x_pos : 0
      @actor_command_window.x = x_pos+@actor_command_window.width <= 640 ? x_pos : 640-@actor_command_window.width
      @actor_command_window.y = y_pos >= 0 ? y_pos : 0
      @actor_command_window.y = y_pos+@actor_command_window.height <= 480 ? y_pos : 480-@actor_command_window.height
      # ??????????????????
      @actor_command_window.z = 9999
    end
  end
#--------------------------------------------------------------------------
# ? ?????? (??????? ???? 3 : ??????????)
#--------------------------------------------------------------------------
  alias update_phase4_step3_sdv update_phase4_step3
  def update_phase4_step3
   
    if @active_battler.is_a?(Game_Actor)
      if SDVA::ATTACK_MOVE
        if @active_battler.current_action.basic == 0
          @active_battler.current_action.move_action = true
        end
      end
      if SDVA::SKILL_MOVE
        if @active_battler.current_action.kind == 1
          @active_battler.current_action.move_action = true
        end
      end
      if SDVA::ITEM_MOVE
        if @active_battler.current_action.kind == 2
          @active_battler.current_action.move_action = true
        end
      end
    elsif @active_battler.is_a?(Game_Enemy)
      if SDVA::ATTACK_MOVE_E
        if @active_battler.current_action.basic == 0
          @active_battler.current_action.move_action = true
        end
      end
      if SDVA::SKILL_MOVE_E
        if @active_battler.current_action.kind == 1
          @active_battler.current_action.move_action = true
        end
      end
    end 
    # ??????????????????????
    if @active_battler.current_action.move_action
      # ?????
      if @active_battler.moving == 2
        update_phase4_step3_sdv
      end
    elsif @active_battler.moving == 0
      update_phase4_step3_sdv
    end
  end
#--------------------------------------------------------------------------
# ? ?????? (??????? ???? 6 : ??????)
#--------------------------------------------------------------------------
  alias update_phase4_step6_sdv update_phase4_step6
  def update_phase4_step6
    @active_battler.current_action.move_action = false
    @active_battler.move_reset
    update_phase4_step6_sdv
  end 
end

#==============================================================================
# ? Spriteset_Battle
#==============================================================================

class Spriteset_Battle
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
  alias initialize_sdv initialize
  def initialize
    initialize_sdv
    @viewport2.z = 1
  end
end

#==============================================================================
# ? Arrow_Actor
#==============================================================================

class Arrow_Actor < Arrow_Base
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
  alias update_sdv update
  def update
    update_sdv
    # ?????
    if Input.repeat?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      @index += 1
      @index %= $game_party.actors.size
    end
    # ?????
    if Input.repeat?(Input::UP)
      $game_system.se_play($data_system.cursor_se)
      @index += $game_party.actors.size - 1
      @index %= $game_party.actors.size
    end
  end
end

#==============================================================================
# ? Arrow_Enemy
#==============================================================================

class Arrow_Enemy < Arrow_Base
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
  alias update_sdv update
  def update
    update_sdv
    # ?????
    if Input.repeat?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      $game_troop.enemies.size.times do
      @index += 1
      @index %= $game_troop.enemies.size
      break if self.enemy.exist?
      end
    end
  # ?????
    if Input.repeat?(Input::UP)
      $game_system.se_play($data_system.cursor_se)
      $game_troop.enemies.size.times do
      @index += $game_troop.enemies.size - 1
      @index %= $game_troop.enemies.size
      break if self.enemy.exist?
      end
    end
  end
end
Edit: le script a été un petit peu modifié, il permet maintenant de choisir la position des ennemis
Revenir en haut Aller en bas
https://kakashiheroes.forums-actifs.net
Uchiha sasuke
Admin
Uchiha sasuke


Nombre de messages : 63
Date d'inscription : 21/06/2007

[combat]Combat de coté version 1.5 Empty
MessageSujet: Re: [combat]Combat de coté version 1.5   [combat]Combat de coté version 1.5 Icon_minitimeSam 23 Juin - 20:13

Code:
#==============================================================================
# ? Game_BattleAction
#==============================================================================

class Game_BattleAction
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_accessor :move_action # ??????????
#--------------------------------------------------------------------------
# ? ???
#--------------------------------------------------------------------------
  alias clear_sdv clear
  def clear
    clear_sdv
    @move_action = false
  end
 
end

#==============================================================================
#  Sprite_Battler
# transforme les battlers en petits spritesqui peuvent bouger et ainsi de suite
#==============================================================================

class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
  alias update_sdv update
  def update
  # ????????????????
    if @battler.is_a?(Game_Actor)
    # ????????????????????
    # ??????
      if @battler.battler_name != @battler_name or
        @battler.battler_hue != @battler_hue or
        @battler.current_action.basic == 0 or
        @battler.current_action.kind != 3
        # ????????????
        @character_name = @battler.character_name
        @character_hue = @battler.character_hue
        # gère le sprite. TRES IMPORTANT
        self.bitmap = RPG::Cache.character(@character_name, @character_hue)
        cw = self.bitmap.width / 4
        ch = self.bitmap.height / 4
        @width = cw
        @height = ch
        if @battler.current_action.move_action == true
          # ????
          @battler.move
        else
          @battler.move_reset
        end
        # ?????????
        sx = @battler.pattern * cw
        sy = SDVA::PARTY_POS * ch
        self.src_rect.set(sx, sy, cw, ch)
        self.ox = @width / 2
        self.oy = @height
        # ??????????? 0 ???
        if @battler.hidden
          self.opacity = 0
        end
      end
    end
     
    if @battler.is_a?(Game_Enemy)
      # ????????????????????
      # ??????
      if @battler.battler_name != @battler_name or
        @battler.battler_hue != @battler_hue or
        @battler.current_action.basic == 0 or
        @battler.current_action.kind != 3
        # ????????????
        @character_name = $data_enemies[@battler.id].battler_name
        @character_hue = $data_enemies[@battler.id].battler_hue
        # ???????????
        self.bitmap = RPG::Cache.character(@character_name, @character_hue)
        cw = self.bitmap.width / 4
        ch = self.bitmap.height / 4
        @width = cw
        @height = ch
        if @battler.current_action.move_action == true
        # ????
          @battler.move_e
        else
          @battler.move_reset
        end
        # ?????????
        sx = @battler.pattern * cw
        sy = SDVE::PARTY_POS * ch
        self.src_rect.set(sx, sy, cw, ch)
        self.ox = @width / 2
        self.oy = @height
        # ??????????? 0 ???
        if @battler.hidden
          self.opacity = 0
        end
      end
    end
    update_sdv
  end
end

#==============================================================================
# ? Scene_Battle
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# ? ????????????????????
#--------------------------------------------------------------------------
  alias phase3_setup_command_window_sdv phase3_setup_command_window
  def phase3_setup_command_window
    phase3_setup_command_window_sdv

    if SDVA::WINDOWPOS_CHANGE
      # ???????????????????
      case SDVA::PARTY_POS
        when 0
          x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
          y_pos = @active_battler.screen_y
        when 1
          x_pos = @active_battler.screen_x - @actor_command_window.width - 16
          y_pos = @active_battler.screen_y - @actor_command_window.height
        when 2
          x_pos = @active_battler.screen_x + 16
          y_pos = @active_battler.screen_y - @actor_command_window.height
        when 3
          x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
          y_pos = @active_battler.screen_y - @actor_command_window.height - 48
      end
      @actor_command_window.x = x_pos >= 0 ? x_pos : 0
      @actor_command_window.x = x_pos+@actor_command_window.width <= 640 ? x_pos : 640-@actor_command_window.width
      @actor_command_window.y = y_pos >= 0 ? y_pos : 0
      @actor_command_window.y = y_pos+@actor_command_window.height <= 480 ? y_pos : 480-@actor_command_window.height
      # ??????????????????
      @actor_command_window.z = 9999
    end
  end
#--------------------------------------------------------------------------
# ? ?????? (??????? ???? 3 : ??????????)
#--------------------------------------------------------------------------
  alias update_phase4_step3_sdv update_phase4_step3
  def update_phase4_step3
   
  if @active_battler.is_a?(Game_Actor)
    if SDVA::ATTACK_MOVE
      if @active_battler.current_action.basic == 0
        @active_battler.current_action.move_action = true
      end
    end
    if SDVA::SKILL_MOVE
      if @active_battler.current_action.kind == 1
        @active_battler.current_action.move_action = true
      end
    end
    if SDVA::ITEM_MOVE
      if @active_battler.current_action.kind == 2
        @active_battler.current_action.move_action = true
      end
    end
  elsif @active_battler.is_a?(Game_Enemy)
    if SDVE::ATTACK_MOVE
      if @active_battler.current_action.basic == 0
        @active_battler.current_action.move_action = true
      end
    end
    if SDVE::SKILL_MOVE
      if @active_battler.current_action.kind == 1
        @active_battler.current_action.move_action = true
      end
    end
  end
    # ??????????????????????
    if @active_battler.current_action.move_action
      # ?????
      if @active_battler.moving == 2
        update_phase4_step3_sdv
      end
    elsif @active_battler.moving == 0
      update_phase4_step3_sdv
    end
  end
#--------------------------------------------------------------------------
# ? ?????? (??????? ???? 6 : ??????)
#--------------------------------------------------------------------------
  alias update_phase4_step6_sdv update_phase4_step6
  def update_phase4_step6
    @active_battler.current_action.move_action = false
    @active_battler.move_reset
    update_phase4_step6_sdv
  end
 
end

#==============================================================================
# ? Spriteset_Battle
#==============================================================================

class Spriteset_Battle
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
  alias initialize_sdv initialize
  def initialize
    initialize_sdv
    @viewport2.z = 1
  end
end

#==============================================================================
# ? Arrow_Actor
#==============================================================================

class Arrow_Actor < Arrow_Base
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
  alias update_sdv update
  def update
    update_sdv
    # ?????
    if Input.repeat?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      @index += 1
      @index %= $game_party.actors.size
    end
    # ?????
    if Input.repeat?(Input::UP)
      $game_system.se_play($data_system.cursor_se)
      @index += $game_party.actors.size - 1
      @index %= $game_party.actors.size
    end
  end
end

#==============================================================================
# ? Arrow_Enemy
#==============================================================================

class Arrow_Enemy < Arrow_Base
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
  alias update_sdv update
  def update
    update_sdv
    # ?????
    if Input.repeat?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      $game_troop.enemies.size.times do
      @index += 1
      @index %= $game_troop.enemies.size
      break if self.enemy.exist?
      end
    end
  # ?????
    if Input.repeat?(Input::UP)
      $game_system.se_play($data_system.cursor_se)
      $game_troop.enemies.size.times do
      @index += $game_troop.enemies.size - 1
      @index %= $game_troop.enemies.size
      break if self.enemy.exist?
      end
    end
  end
end
Revenir en haut Aller en bas
https://kakashiheroes.forums-actifs.net
 
[combat]Combat de coté version 1.5
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» [Combat]CBS Vue sur le Côté v2.5
» Combat A-RPG version 3
» Combat A-RPG
» Objet aléatoire en fin de combat.
» MAP comme fond de Combat

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Kakashi heroe's :: Partie RPG :: Scripts-
Sauter vers: