RPG MAKER XP
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.

RPG MAKER XP

Vous êtes débutant du logiciel rpg maker xp et vous souhaitez en apprendre plus c'est ici qu'il faut chercher.Vous cherchez ressource, script, tutorial ou autre c'est ici aussi.Bonne visite à vous !
 
AccueilPortailRechercherDernières imagesS'enregistrerConnexion
-21%
Le deal à ne pas rater :
LEGO® Icons 10329 Les Plantes Miniatures, Collection Botanique
39.59 € 49.99 €
Voir le deal

 

 Sauter

Aller en bas 
AuteurMessage
Chasseur41
Admin
Admin
Chasseur41


Masculin
Nombre de messages : 49
Age : 31
Localisation : Vendôme (41) et Tours (37)
Loisirs : Création de jeu, musique, livre et sortit
Date d'inscription : 04/07/2007

Feuille de personnage
Prénom du Personnage: Brutus
Nom du Personnage: Macligan
Âge du Personnage: 28 ans

Sauter Empty
MessageSujet: Sauter   Sauter Icon_minitimeSam 6 Oct - 12:20

Voici un petit script pour sauter des obstacles.
Appellez le WallJump, puis inserez ceci:

Code:
#==============================================================================
# ■ WallJump Script
#------------------------------------------------------------------------------
#==============================================================================

#==============================================================================
# ● Customisation
#==============================================================================
JumpID  = 1 # The terrain ID of the tiles which can be jumped over
MaxJump  = 2 # The longest jump that can be made by the player
#==============================================================================
# ● Game_Player
#==============================================================================

class Game_Player < Game_Character
 
  # forces Game_Character's passable method to be used, so CTRL no longer makes
  # the hero able to walk through walls
  def passable?(x, y, d)
    super(x, y, d)
  end
 
  def leap
    # finds the increases to x & y for the current direction
    xdir = (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
    ydir = (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
   
    # Ow!
    unless $game_map.terrain_tag(@x + xdir, @y + ydir) == JumpID or
                    $game_map.passable?(@x + xdir, @y + ydir, @direction, self)
      # make the player jump
      route = RPG::MoveRoute.new
      route.list.clear
      route.list.push(RPG::MoveCommand.new(37))
      route.list.push(RPG::MoveCommand.new(14, [0, 0]))
      route.list.push(RPG::MoveCommand.new(38))
      route.list.push(RPG::MoveCommand.new(0))
      route.repeat = false
      $game_player.force_move_route(route)
     
      # shake the screen
      $game_screen.start_shake(7, 7, 5)
     
      # display an "Ouch!" message
      $game_temp.message_text = "Ouch!"
      return
    end
   
    # finds the jumpable distance
    dist = jumpable_distance
   
    # wall jump
    if dist.between?(1, MaxJump - 1) and
      !$game_map.passable?(@x + (dist + 1) * xdir, @y + (dist + 1) * ydir, @direction, self) and
      !($game_map.terrain_tag(@x + (dist + 1) * xdir, @y + (dist + 1) * ydir) == JumpID)
      # finds the reverse direction
      bounce_dir = @direction == 2 ? 8 : (@direction == 4 ? 6 : (@direction == 6 ? 4 : 2))
     
      # finds the wall-jump distance
      b_dist = jumpable_distance(bounce_dir, MaxJump + 2, @x + dist * xdir, @y + dist * ydir)
     
      # finds the additions to x and y made by the reverse direction
      b_xdir = (bounce_dir == 6 ? 1 : bounce_dir == 4 ? -1 : 0)
      b_ydir = (bounce_dir == 2 ? 1 : bounce_dir == 8 ? -1 : 0)
     
      # create the move_route
      route = RPG::MoveRoute.new
      route.list.clear
      route.list.push(RPG::MoveCommand.new(37))
      # add the normal jump
      route.list.push(RPG::MoveCommand.new(14, [xdir * dist, ydir * dist]))
      # add the wall jump
      route.list.push(RPG::MoveCommand.new(14, [b_xdir * b_dist, b_ydir * b_dist]))
      route.list.push(RPG::MoveCommand.new(38))
      route.list.push(RPG::MoveCommand.new(0))
      route.repeat = false
     
      $game_player.force_move_route(route)
     
      return
    end
   
    # creates a route for a normal jump and forces the player to follow it
    route = RPG::MoveRoute.new
    route.list.clear
    route.list.push(RPG::MoveCommand.new(37))
    route.list.push(RPG::MoveCommand.new(14, [xdir * dist, ydir * dist]))
    route.list.push(RPG::MoveCommand.new(38))
    route.list.push(RPG::MoveCommand.new(0))
    route.repeat = false
   
    $game_player.force_move_route(route)
  end
 
  alias update_primary update
  def update
    # calls the normal update method
    update_primary
   
    # locks the facing if CTRL is pressed, else unlocks it
    @direction_fix = Input.press?(Input::CTRL)
   
    # leaps if Input::A is triggered
    leap if Input.trigger?(Input::A) && !moving?
  end
 
  def jumpable_distance(dir = @direction, max_dist = MaxJump, x = @x, y = @y)
    xdir = (dir == 6 ? 1 : dir == 4 ? -1 : 0)
    ydir = (dir == 2 ? 1 : dir == 8 ? -1 : 0)
   
    jumpable_tiles = []
   
    for i in 0..max_dist
      check_x = x + i * xdir
      check_y = y + i * ydir
     
      e = $game_map.events[$game_map.check_event(check_x, check_y)]
      if e
        if e.list[0].parameters[0] =~ "\Tall"
          break
        end
        if not e.through
          next
        end
      end
     
      if $game_map.passable?(check_x, check_y, dir, self) or
                              $game_map.terrain_tag(check_x, check_y) == JumpID
        jumpable_tiles.push(i)
      end
    end
   
    jumpable_tiles.reverse.each do |i|
      check_x = x + i * xdir
      check_y = y + i * ydir
     
      return i if $game_map.passable?(check_x, check_y, dir, self)
    end
   
    return 0
  end
 
end

...................................................................................................

Vers le début du script, quelques petites choses seront à modifier :

JumpID = 1 # Le numéro de terrain au-dessus du quel on peut sauter
MaxJump = 2 # Le maximum de cases qu'on peut sauter

Maintenant Appuyez sur "Shift" pour sauter .

Voila j'espère que se script vous plaira.
Revenir en haut Aller en bas
https://legend-rpg-2d.1fr1.net
 
Sauter
Revenir en haut 
Page 1 sur 1

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
RPG MAKER XP :: Script :: Graphique Map-
Sauter vers:  
Ne ratez plus aucun deal !
Abonnez-vous pour recevoir par notification une sélection des meilleurs deals chaque jour.
IgnorerAutoriser