[Résolu] Problème Jump
Ven 1 Aoû 2014 - 22:23
Bonjour,
J'aimerais faire un test de jeu de platforme sous RPG Maker VX Ace
J'ai trouver ce script pour jump, mais je ne comprend pas comment on s'en sert.
Quelqu'un pourrais m'aider s\'il vous plaît ?
J'aimerais faire un test de jeu de platforme sous RPG Maker VX Ace
J'ai trouver ce script pour jump, mais je ne comprend pas comment on s'en sert.
Quelqu'un pourrais m'aider s\'il vous plaît ?
- Script:
- #==============================================================================
#
# Jump Input
#
#==============================================================================
# Author: SuperOverlord
#==============================================================================
# Features:
#------------------------------------------------------------------------------
# o Set an input for jumping on map.
# o Jump further if dashing.
#==============================================================================
# Instructions:
#------------------------------------------------------------------------------
# o Place below materials, above main.
# o Change values as desired in configuration below.
# o To disallow jumping any of the following can be done:
# - Have the switch from config set to 'off'.
# - Include '[NOJUMP]' in a map name for no jumping on that map.
# - Include 'NOJUMP' in an event name for no jumping through that event.
#==============================================================================
# Script Calls
#------------------------------------------------------------------------------
# o To change the distance a jump takes the player.
#
# $game_player.jump_distance = n
# ~ n is the new jump distance
#==============================================================================
# Compatibility
#------------------------------------------------------------------------------
# Put below any scripts that redefine move_by_input.
# Should be compatible with 8 direction scripts, though untested.
#==============================================================================
module SOV
module JumpInput
#--------------------------------------------------------------------------
# Configuration
#--------------------------------------------------------------------------
# Input used for jumping.
INPUT = Input::X
# Id of switch required on to allow jumping by input.
SWITCH_ID = 101
# Jump distance (Can be changed in game with a script call)
INT_JUMP_DIS = 0
# How far extra a jump takes the player if they're dashing.
DASH_JUMP_DIS = 3
# Sound effect played when the player jumps. [filename, volume, pitch]
SE = ["Blow2",25,150]
# Should the player jump on the spot if no further is possible
JUMP_ON_SPOT = true
# Time in frames to block the player from jumping
JUMP_COOLDOWN = 30
# An array of tile ids the player can't jump through.
NO_JUMP_TILES = []
#--------------------------------------------------------------------------
# End Configuration ~Fall rate: -9.8m/sec~
#--------------------------------------------------------------------------
end
end
#==============================================================================
# Import
#------------------------------------------------------------------------------
$imported = {} if $imported == nil
$imported['JumpInput'] = true
#==============================================================================
#==============================================================================
# ** Sound
#==============================================================================
module Sound
#------------------------------------------------------------------------
# * Play SE
#------------------------------------------------------------------------
def self.play_jump
a,b,c = *SOV::JumpInput::SE
Audio.se_play("Audio/SE/#{a}", b, c)
end
end
#==============================================================================
# ** Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Get the map name
#--------------------------------------------------------------------------
def name
if @name == nil
data = load_data("Data/MapInfos.rvdata")
@name = data[@map_id].name
end
return @name
end
#--------------------------------------------------------------------------
# * Can the player jump in this map. (Doesn't effect jumping via events)
#--------------------------------------------------------------------------
def no_jump_by_input?
if @no_jump == nil
@no_jump = name.upcase.include?('[N0JUMP]')
end
return @no_jump
end
#--------------------------------------------------------------------------
# * Can the tile at x,y be jumped over?
#--------------------------------------------------------------------------
def jump_passable?(x,y)
# Check valid tile id
for i in 0..2
return false if SOV::JumpInput::NO_JUMP_TILES.include?( data[x,y,i] )
end
# Check valid events
for event in events_xy(x,y)
return false if event.name.upcase.include?('NOJUMP')
end
return true
end
end
#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event
#--------------------------------------------------------------------------
# * Get events name
#--------------------------------------------------------------------------
def name
@event.name
end
end
#==============================================================================
# ** Game_Player
#==============================================================================
class Game_Player
#--------------------------------------------------------------------------
# Alias List
#--------------------------------------------------------------------------
alias sov_ji_move_by_input move_by_input
alias sov_ji_initialize initialize
alias sov_ji_update update
#--------------------------------------------------------------------------
# Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :jump_distance
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize
sov_ji_initialize
@jump_distance = SOV::JumpInput::INT_JUMP_DIS
@jump_cooldown = 0
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
@jump_cooldown -= 1 if @jump_cooldown > 0 and not jumping?
sov_ji_update
end
#--------------------------------------------------------------------------
# * Move by input
#--------------------------------------------------------------------------
def move_by_input
sov_ji_move_by_input
jump_by_input
end
#--------------------------------------------------------------------------
# * Determine how far a jump would would move the player
#--------------------------------------------------------------------------
def calc_jump_xy
# Find dx and dy depending on direction
case @direction%3
when 0 # 3,6,9
dy = @direction == 3 ? -1 : ( @direction == 9 ? 1 : 0 )
dx = 1
when 1 # 1,4,7
dy = @direction == 1 ? -1 : ( @direction == 7 ? 1 : 0 )
dx = -1
when 2 # 2,8
dy = @direction == 8 ? -1 : ( @direction == 2 ? 1 : 0 )
dx = 0
end
# Add one to distance if dashing
dis = @jump_distance
dis += SOV::JumpInput::DASH_JUMP_DIS if dash? and moving?
# Find furthest jump can be
max_x = dx * dis + @x
max_y = dy * dis + @y
# Find furthest passable tile
while not passable?(max_x, max_y)
max_x -= dx unless max_x == @x
max_y -= dy unless max_y == @y
return 0, 0 if max_x == @x and max_y == @y
end
# Find how far jump can make it to furthest passable tile
count_x = last_pass_x = @x
count_y = last_pass_y = @y
while count_x != max_x or count_y != max_y
# Next tile can be jumped into
if $game_map.jump_passable?(count_x+dx, count_y+dy)
# Increase counters
count_x += dx unless count_x == max_x
count_y += dy unless count_y == max_y
else
# Return last passable tile
return last_pass_x-@x, last_pass_y-@y
end
# Current tile is passable
if passable?(count_x, count_y)
last_pass_x,last_pass_y = count_x, count_y
end
end
return count_x-@x, count_y-@y
end
#--------------------------------------------------------------------------
# * Jump by input
#--------------------------------------------------------------------------
def jump_by_input
if Input.trigger?(SOV::JumpInput::INPUT) and not $game_player.in_vehicle?
return unless $game_switches[SOV::JumpInput::SWITCH_ID]
return if $game_map.no_jump_by_input?
return if @jump_cooldown > 0
x_plus, y_plus = calc_jump_xy
return if not SOV::JumpInput::JUMP_ON_SPOT and x_plus == 0 and y_plus == 0
Sound.play_jump
@jump_cooldown = SOV::JumpInput::JUMP_COOLDOWN
jump(x_plus, y_plus)
end
end
end
- SpytjeAdministrateur
- Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008
Re: [Résolu] Problème Jump
Ven 1 Aoû 2014 - 22:32
Qu'est ce que tu ne comprend pas exactement c'est pourtant clair dans le script ?
Re: [Résolu] Problème Jump
Ven 1 Aoû 2014 - 22:34
Je l'ajoute mais je ne sais pas comment le réglé, quel appel de script faire etc..
- SpytjeAdministrateur
- Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008
Re: [Résolu] Problème Jump
Ven 1 Aoû 2014 - 22:43
Dans le script tu as ça :
- Code:
# Input used for jumping./Touche pour sauter
INPUT = Input::X
# Id of switch required on to allow jumping by input.
# Id de l'interrpteur pour activer les sauts
SWITCH_ID = 101
# Jump distance (Can be changed in game with a script call)
# Distance de saut
INT_JUMP_DIS = 0
- SpytjeAdministrateur
- Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008
Re: [Résolu] Problème Jump
Sam 2 Aoû 2014 - 0:08
Il faut activer l'interrupteur 101 pour pouvoir sauter avec la touche "X" (touche B du clavier).
Est ce que tu sais activer un interrupteur ? Parce que si tu ne sais pas faire ça faut vraiment que tu lises des tutoriels et apprennes à utiliser RPG Maker avant de te lancer dans quoi que ce soit.
Est ce que tu sais activer un interrupteur ? Parce que si tu ne sais pas faire ça faut vraiment que tu lises des tutoriels et apprennes à utiliser RPG Maker avant de te lancer dans quoi que ce soit.
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|