Advanced Move System V1.1 [RPG Maker VX]
Publicado em 8 de maio de 2015.Advanced Move System v1.1 é um script desenvolvido pelo MiguelRPG (RubyKey) em outubro de 2009 para o RPG Maker VX que adiciona em seu jogo um sistema avançado de movimentos. Com isso, o jogo passa a ter a possibilidade do char correr, pular e andar na diagonal, com tudo podendo ser controlado se utilizando de uma barra com pontos de movimento. O script também insere diversas possibilidades para o jogo. Ema delas é que qualquer evento pode andar na diagonal automaticamente.
O Advanced Move System foi feito baseado no MOG_Advanced Move System V2.0, do Moghunter, que era compatível com o RPG Maker XP.
Características
- Movimento em 8 direções;
- Movimento anatômico quando parado, como respirar;
- Possibilidade de realizar saltos;
- Pode-se correr usando uma tecla pré definida;
- Animação diferente para cada fase de movimento;
- Configuração de imagens para cada movimento. Caso não as tenha, o jogo ignora automaticamente;
- Status personalizados para terem efeitos especiais no mapa;
- Permite uso automático de movimento em 8 direções para eventos;
- Compatível com scripts como Caterpillar;
- Ideal para sistema de batalha no mapa (ActionRPG);
- Medidor de dash que se esgota a medida que se corre ou pula;
- Compatível com sistema de Veículos do VX;
- Pode-se chamar o Game Over caso todos os personagens morram;
- Caso não queira trocar o sistema de movimento padrão do VX por este, basta configurar, deixando os recursos de correr e o medidor de dash inativos;
- Compatível com RubyKey Widescreen;
- Compatível com Módulo RubyKey v1.1 ou superior.
Utilização
Configure como quer que o sistema funcione e fique atento aos status que, de preferência, devem ser feitos apenas para o uso no mapa. Assim, o script, e não o VX, tem controle sobre eles.
Tenha imagens do seu char para cada movimento mas, lembrando que, se faltar alguma, o script irá ignorar e usar apenas a principal. Tem-se, ao todo, 6 imagens:
Actor_1(esta é a imagem andando padrão e também a única que não deve faltar)Actor_1_ani(esta é a imagem animada, para quando o jogador não esta jogando)Actor_1_jump(esta é a imagem do pulo)Actor_1_quarter(esta é a imagem andando padrão, mas com movimentos na diagonal)Actor_1_dash(esta é a imagem correndo)Actor_1_dash_quarter(esta é a imagem correndo, mas com movimentos na diagonal)
Convém baixar a demo que já vem com todas as imagens e outros scripts instalados, mostrando o total potencial do Advanced Move System V1.1 .
#======================================##======================================#
#=====================================####=====================================#
#====================================######====================================#
#===================================########===================================#
#==================================##########==================================#
#=================================# Ruby Key #=================================#
#==================================##########==================================#
#===================================########===================================#
#====================================######====================================#
#=====================================####=====================================#
#======================================##======================================#
# Advanced Move System
# Versão 1.1
# Autor: MiguelRPG (RubyKey)
# Data: 05 de Outubro de 2009
# Dificuldade: Difícil
# Rank: (Simples, Fácil, Moderada, Difícil, Desenvolvedores)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Agradecimentos e referências:
# Moghunter http://www.atelier-rgss.com
# Desenvolvedor original deste script para XP, sem este script este
# nunca existiria.
# Xiderowg (Desenvolvedor do movimento anatômico para XP)
# Blabla (Sistema de salto anatômico para VX)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Descrição:
# Script feito baseado na versão MOG_Advanced Move System V2.0 para XP.
# Este sistema adiciona em seu jogo um sistema avançado de movimentos e com
# isso o jogo passa a ter a possibilidade do character correr, pular, andar
# na diagonal e tudo pode ser controlado se utilizando de uma barra com pontos
# de movimento.
# O script também insere diversas possibilidade para o jogo e uma delas é que
# qualquer evento pode andar na diagonal automaticamente.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Características:
# Movimento em 8 direções.
# Movimento anatômico quando parado, como respirar.
# Possibilidade de realizar saltos.
# Pode-se correr usando uma tecla pré definida.
# Apresenta uma animação diferente para cada fase de movimento.
# Configure imagens para cada movimento e caso não as tenha o jogo auto ignora.
# Status personalizados para terem efeitos especiais no mapa.
# Permite uso automático de movimento em 8 direções para eventos.
# Compatibilidade com scripts como CATERPILLAR.
# Perfeito para sistema de batalha no mapa (ActionRPG).
# Medidor de dash que se esgota a medida que se corre ou pula.
# Não possui incompatibilidade com sistema de Veiculos do VX.
# Pode-se chamar o Game Over caso ocorra de todos os personagens morrerem
# Caso não queira trocar o sistema de movimento padrão do VX por este é só
# configurar que os recursos de correr e o medidor de dash ficam inativos.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Como usar:
# Configure como quer que o sistema funcione e fique atento aos status,
# que de preferência devem ser feitos apenas para o uso no mapa, para que o
# script e não o VX possa ter controle sobre eles.
# Tenha imagens do seu character para cada movimento, mas lembrando que se
# faltar alguma o script ira ignorar é usar apenas a principal, são ao todo
# 6 imagens:
# Actor_1 (esta é a imagem andando padrão e também a única que não deve faltar)
# Actor_1_ani (esta é a imagem animada, para quando o jogador não esta jogando)
# Actor_1_jump (esta é a imagem do pulo)
# Actor_1_quarter (esta é a imagem andando padrão, mas com movimentos na diagonal)
# Actor_1_dash (esta é a imagem correndo)
# Actor_1_dash_quarter (esta é a imagem correndo, mas com movimentos na diagonal)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Conpatibilidade:
# VX = sim
# XP = não
# RubyKey Widescreen = Sim
# Módulo RubyKey = vs 1.1 ou superior
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
module RUBY_MOVE
# CONFIGURAÇÕES---------------------------------------------------------------
# Usar sistema de dash
# Apenas desativa o dash e a barra, permitindo que corra usando o sistema padrão do XV.
# Mas alguns status podem não funcionar.
DASH_SYSTEM = true
# Caso use o caterpillar (sistema em que o personagem é seguido pelos outros membros do grupo)
# este sistema não esta incluso neste script
CATERPILLAR = false
# Usar animação do char quando parado? (mesmo que n tenha a imagem o char vai se mexer)
ANI_HERO = true
# Valor do medidor de DASH.
$max_dash = 300
# Valor gasto do medidor de DASH.
DASH_DOWN = 2
#Valor gasto do medidor de DASH quando pular.
DASH_JUMP = 40
# Valor do aumento do medidor de DASH.
DASH_UP = 1
# Velocidade para correr.
DASH_SPEED = 6
# Velocidade para caminhar.
NORMAL_SPEED = 4
# Tecla para o DASH.
BUTTON = Input::A
# Tecla responsável pelo salto.
JUMPBUTTON = Input::Y
# SKIN da Janela que deve estar na pasta system.
DASH_SKIN = ""
# Imagem da Barra que deve estar na pasta Menus.
DASH_BAR = "Dash_Bar(XAS)"
# Trasparência da janela do DASH.
DASH_OPACITY = 255
# Posição da janela na horizontal.
DASH_X = 0
# Posição da janela na vertical.
DASH_Y = 350
# Largura da janela.
DASH_WIDTH = 155
# Altura da janela.
DASH_HEIGHT = 60
# Som do medidor quando chegar a 100%
SE_PLAY = "Load"
# Som quando pular (deixe "" para não tocar nada)
JUMPSOUND = "Audio\\SE\\Jump2"
# Porcentagem para apresentação do Dash em nível baixo.
LOW = 20
# Nome do texto da janela do DASH.
DASH_NAME = "Dash"
#Texto do medidor de CT quando está em nível baixo.
LOW_NAME = "Low!"
# Swithe que desativa a janela do DASH
DASHSWIT = 101
# Swit que desativa o pulo
JUMPSWITCH = 102
# Auto ocultar quando mensagem visível?
MSG_SWIT = true
# Velocidade em que a janela de Move será atualizada.
ADVMOVREF = 10
# Nome da imagem do character
# Caso ocorra de não ter alguma destas imagens o script ira auto ignorá-la, evitando o erro.
# Exp.:
# Actor_1 (esta é a imagem andando padrão)
# Actor_1_ani (esta é a imagem animada, para quando o jogador não esta jogando)
# Actor_1_jump (esta é a imagem do pulo)
# Actor_1_quarter (esta é a imagem andando padrão, mas com movimentos na diagonal)
# Actor_1_dash (esta é a imagem correndo)
# Actor_1_dash_quarter (esta é a imagem correndo, mas com movimentos na diagonal)
ADD_ANI = "_ani"
ADD_QT = "_quarter"
ADD_DASH = "_dash"
ADD_DQT = "_dash_quarter"
ADD_JUMP = "_jump"
# SPECIAL STATUS--------------------------------------------------------------
# HASTE - Aumenta a Barra de Dash mais rápido.
# DELAY - Drena o medidor de Dash.
# FAST - Aumenta a velocidade do personagem.
# SLOW - Deixa o personagem lento.
# POISON - Causa dano consecutivo no personagem.
# REGEN - Recupera o HP do personagem.
# CRAZY - O personagem se movimenta sozinho aleatoriamente.
# CONFUSE - Inverte os comandos de direções.
# STOP - Para totalmente o character.
# POISON MP - Causa dano MP consecutivo no personagem.
# NOTA - Algumas condições anulam a outra(EX - Poison e Regen).
# Definição das ID de status que representarão as condições especiais de mapa.
HASTE = 18 # aumento a velocidade do medidor
DELAY = 19 # diminui a velocidade do medidor
FAST = 20 # aumento a velocidade do heroi
SLOW = 21 # diminui a velocidade do heroi
POISON = 22 # perde hp mesmo que parado
REGEN = 23 # recupera hp automaticamente
CRAZY = 24 # o heroi fica louco e se move de forma aleatória
CONFUSE = 25 # inverte os comandos
STOP_ID = 26 # Deixa o jogador paralisado
POISONMP_ID = 27 # causa dano MP consecutivo no personagem.
MANA_ID = 28 # recupera MP automaticamente
# Definição da duração de cada condição no mapa, estes valores serão miltiplicados por 40.
HASTE_TIME = 15
DELAY_TIME = 15
FAST_TIME = 15
SLOW_TIME = 15
POISON_TIME = 15
REGEN_TIME = 20
CRAZY_TIME = 15
CONFUSE_TIME = 100
STOP_TIME = 15
POISONMP_TIME = 15
MANA_TIME = 10
# A condição HASTE multiplicará a velocidade por.
HASTE_UP = 3
# Velocidade reduzida ao estar na condição SLOW.
SLOW_SPEED = 2
# % de dano ao estar na condição POISON.
POISON_DAMAGE = 5
# Permitir Game Over se hp de todos os personagens ficarem com 0 de HP.
POISON_OVER = false
# % de dano ao estar na condição POISON MP.
POISONMP_DAMAGE = 2
# % de HP recuperado ao estar na condição REGEN.
REGEN_RESTORE = 3
# % de MP recuperado ao estar na condição MANA FONT.
MANA_RESTORE = 2
# A condição FAST aumentará velocidade por.
FAST_SPEED = 1
# SISTEMA DE LEVEL------------------------------------------------------------
# Ativar sistema de velocidade por Level ou parâmetro.
LEVEL = true
# Velocidade maxima para o DASH (útil para evitar exageros na velocidade).
MAX_SPEED = 6
# Sistema de calculo será baseado no atributo.
# 0 = Level
# 1 = HP
# 2 = MP
# 3 = AGL
# 4 = INT
# 5 = Passos
# 6 = Variável
# 7 = Normal
LEVEL_SISTEMA = 0
# Definição da variável.
VARI = 100
# Calculo será baseado em :
# 0 = Personagem ID 1.
# 1 = Média do grupo.
ACTOR = 0
# Calculo de ganho ao aumentar os parâmetros.
# LEVEL_CALCULO = Diminua este valor para que o personagem fique mais rápido.
# LEVEL_CALCULO2 = Aumente este valor para que o medidor de DASH fique maior(em pontos)
# o que resulta em um gasto menor do medidor de Dash.
# LEVEL CALCULO3 = Diminua este valor para aumentar a velocidade do medidor.
# Velocidade de movimento.
# (Parâmetro é dividido pelo valor abaixo)
LEVEL_CALCULO = 99
# Valor maximo do medidor de DASH.
# (Parâmetro é mutiplicado pelo valor abaixo)
LEVEL_CALCULO2 = 1
# Velocidade do aumento do medidor.
# (Parâmetro é dividido pelo valor abaixo)
LEVEL_CALCULO3 = 10
end
$dash = 0
$valor0 = 0
$slow = 0
#==============================================================================
# Window_Base
#------------------------------------------------------------------------------
# Esta é a classe superior à todas as classes de janelas do jogo.
#==============================================================================
class Window_Base < Window
def dash(x,y)
val0 = $dash
val1 = $max_dash + $valor0
valor = 100 * val0 / val1
dash_back = Cache.menu(RUBY_MOVE::DASH_BAR)
cw = dash_back.width
ch = 17
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, dash_back, src_rect)
dash = Cache.menu(RUBY_MOVE::DASH_BAR)
cw = dash.width * $dash / val1
ch = 17
if valor <= RUBY_MOVE::LOW
src_rect = Rect.new(0, 17, cw, ch)
else
src_rect = Rect.new(0, 34, cw, ch)
end
self.contents.blt(x , y - ch, dash, src_rect)
self.contents.font.size = 13
self.contents.font.name = "Georgia"
self.contents.font.bold = true
self.contents.font.color = Color.new(50,250,50,255)
if RUBY_MOVE::LOW < valor
self.contents.draw_text_f(x , y - 35, 120, 32,RUBY_MOVE::DASH_NAME, 0, Color.new(0, 0, 0))
else
self.contents.draw_text_f(x , y - 35, 120, 32,RUBY_MOVE::LOW_NAME, 0, Color.new(0, 0, 0))
end
if valor >= 100
valor = 100
elsif valor < 0
valor = 0
end
if valor <= 0
r = rand(0) + 250
g = rand(200) + 50
b = rand(200) + 50
self.contents.font.color = Color.new(r,g,b,255)
elsif valor <= RUBY_MOVE::LOW
self.contents.font.color = Color.new(255,0,0,255)
elsif valor >= 100
r = rand(200) + 50
g = rand(200) + 50
b = rand(0) + 250
self.contents.font.color = Color.new(r,g,b,255)
else
self.contents.font.color = Color.new(50,250,250,255)
end
self.contents.draw_text_f(x - 21, y - 35, 120, 32,valor.to_s + "%", 2, Color.new(0, 0, 0))
end
end
#==============================================================================
# Window_Dash
#------------------------------------------------------------------------------
# Janela reponsável pela exibição do medidor de Dash (Dash Gauge)
#==============================================================================
class Window_Dash < Window_Base
def initialize
super(RUBY_MOVE::DASH_X, RUBY_MOVE::DASH_Y, RUBY_MOVE::DASH_WIDTH, RUBY_MOVE::DASH_HEIGHT)
self.opacity = RUBY_MOVE::DASH_OPACITY
self.windowskin = Cache.system(RUBY_MOVE::DASH_SKIN)
refresh
end
def refresh
self.contents.clear
dash(5, 30)
end
end
#==============================================================================
# Game_System
#------------------------------------------------------------------------------
# Esta classe controla os dados em torno do sistema de jogo. Ela controla os
# veículos, músicas, etc. Pode ser acessada utilizando $game_system.
#==============================================================================
class Game_System
include RUBY_MOVE
attr_accessor :states_haste
attr_accessor :states_slow
attr_accessor :states_confuse
attr_accessor :states_delay
attr_accessor :states_poison
attr_accessor :states_crazy
attr_accessor :states_regen
attr_accessor :states_fast
attr_accessor :states_stop
attr_accessor :states_poison_mp
attr_accessor :states_mana
alias ruby_advmove_initialize initialize
def initialize
ruby_advmove_initialize
@states_haste = 40 * HASTE_TIME
@states_slow = 40 * SLOW_TIME
@states_confuse = 40 * CONFUSE_TIME
@states_delay = 40 * DELAY_TIME
@states_poison = 40 * POISON_TIME
@states_poison_mp = 40 * POISONMP_TIME
@states_crazy = 40 * CRAZY_TIME
@states_regen = 40 * REGEN_TIME
@states_mana = 40 * MANA_TIME
@states_fast = 40 * FAST_TIME
@states_stop = 40 * STOP_TIME
end
end
#==============================================================================
# Scene_Map
#------------------------------------------------------------------------------
# Classe das operações nos mapas.
#==============================================================================
class Scene_Map < Scene_Base
include RUBY_MOVE
alias ruby_dash_start start
alias ruby_dash_terminate terminate
alias ruby_dash_update update
def start
@dash_win = Window_Dash.new
@dash_win.visible = false
@re = 0
@status_ref = 0
ruby_dash_start
end
def terminate
@dash_win.dispose if @dash_win != nil
ruby_dash_terminate
end
def update
if DASH_SYSTEM == true and $game_switches[DASHSWIT] == true
if MSG_SWIT and $game_message.visible
@dash_win.visible = false if @dash_win != nil
else
@dash_win.visible = true if @dash_win != nil
end
else
@dash_win.visible = false if @dash_win != nil
end
@re += 1
if @re >= ADVMOVREF
@re = 0
end
if @re == 0
@dash_win.refresh if DASH_SYSTEM == true and @dash_win != nil
end
ruby_dash_update
@status_ref += 1
if @status_ref >= 30
@status_ref = 0
end
for i in 0...$game_party.members.size
actor = $game_party.members[i]
for i in 1...$data_states.size
state = $data_states[i]
if actor.state?(i) == true
if actor.state?(HASTE)
$game_system.states_haste -= 1
end
if actor.state?(SLOW)
$game_system.states_slow -= 1
end
if actor.state?(CONFUSE)
$game_system.states_confuse -= 1
end
if actor.state?(DELAY)
$game_system.states_delay -= 1
end
if actor.state?(POISON)
$game_system.states_poison -= 1
end
if actor.state?(POISONMP_ID)
$game_system.states_poison_mp -= 1
end
if actor.state?(CRAZY)
$game_system.states_crazy -= 1
end
if actor.state?(REGEN)
$game_system.states_regen -= 1
end
if actor.state?(MANA_ID)
$game_system.states_mana -= 1
end
if actor.state?(FAST)
$game_system.states_fast -= 1
end
if actor.state?(STOP_ID)
$game_system.states_stop -= 1
end
# Regen
if actor.state?(REGEN) == true and @status_ref == 0
damage = -(actor.maxhp * REGEN_RESTORE / 100)
actor.hp -= damage
# Mana Font
elsif actor.state?(MANA_ID) == true and @status_ref == 0
damage = -(actor.maxmp * MANA_RESTORE / 100)
actor.mp -= damage
# MP Poison
elsif actor.state?(POISONMP_ID) == true and @status_ref == 0
damage = actor.maxmp * POISONMP_DAMAGE / 100
actor.mp -= damage
$game_map.screen.start_flash(Color.new(0, 255,0,64), 4)
# HP Poison
elsif actor.state?(POISON) == true and @status_ref == 0
damage = actor.maxhp * POISON_DAMAGE / 100
if RUBY_MOVE::POISON_OVER == true
actor.hp -= damage
else
actor.hp -= damage if actor.hp > damage # Dano de veneno
end
$game_map.screen.start_flash(Color.new(255,0,0,64), 4)
if actor.hp == 0
Sound.play_actor_collapse
end
end
end
if $game_system.states_haste <= 0
actor.remove_state(HASTE)
$game_system.states_haste = 40 * HASTE_TIME
end
if $game_system.states_slow <= 0
actor.remove_state(SLOW)
$game_system.states_slow = 40 * SLOW_TIME
end
if $game_system.states_confuse <= 0
actor.remove_state(CONFUSE)
$game_system.states_confuse = 40 * CONFUSE_TIME
end
if $game_system.states_delay <= 0
actor.remove_state(DELAY)
$game_system.states_delay = 40 * DELAY_TIME
end
if $game_system.states_poison <= 0
actor.remove_state(POISON)
$game_system.states_poison = 40 * POISON_TIME
end
if $game_system.states_crazy <= 0
actor.remove_state(CRAZY)
$game_system.states_crazy = 40 * CRAZY_TIME
end
if $game_system.states_regen <= 0
actor.remove_state(REGEN)
$game_system.states_regen = 40 * REGEN_TIME
end
if $game_system.states_fast <= 0
actor.remove_state(FAST)
$game_system.states_fast = 40 * FAST_TIME
end
if $game_system.states_stop <= 0
actor.remove_state(STOP_ID)
$game_system.states_fast = 40 * STOP_TIME
end
end
end
end
end
#==============================================================================
# Game_Party
#------------------------------------------------------------------------------
# Classe que trata do Grupo. Inclui informações sobre dinheiro, itens, etc.
# Pode ser acessada utilizando $game_party.
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# Processo do momento do passo
#--------------------------------------------------------------------------
def on_player_walk
for actor in members
if actor.slip_damage?
if RUBY_MOVE::POISON_OVER == true
actor.hp -= 1 # Dano de veneno
else
actor.hp -= 1 if actor.hp > 1 # Dano de veneno
end
$game_map.screen.start_flash(Color.new(255,0,0,64), 4)
if actor.hp == 0
Sound.play_actor_collapse
end
end
if actor.auto_hp_recover and actor.hp > 0
actor.hp += 1 # Recuperação automática de HP
end
end
$game_temp.next_scene = "gameover" if $game_party.all_dead?
end
end
#==============================================================================
# Game_Character
#------------------------------------------------------------------------------
# Esta classe controla o personagem. Esta classe é uma superclasse de
# Game_Player e Game_Event.
#==============================================================================
class Game_Character
def move_random
case rand(8)
when 0
move_down(false)
when 1
move_left(false)
when 2
move_right(false)
when 3
move_up(false)
when 4
move_lower_left
when 5
move_lower_right
when 6
move_upper_left
when 7
move_upper_right
end
end
#seguir o heroi
def move_toward_player
sx = @x - $game_player.x
sy = @y - $game_player.y
if sx == 0 and sy == 0
return
end
abs_sx = sx.abs
abs_sy = sy.abs
if abs_sx == abs_sy
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
if abs_sx
if sx < 0 and sy > 0
move_upper_right
elsif sx > 0 and sy > 0
move_upper_left
elsif sx > 0 and sy < 0
move_lower_left
elsif sx < 0 and sy < 0
move_lower_right
elsif sx < 0
move_right
elsif sx > 0
move_left
elsif sy > 0
move_up
elsif sy < 0
move_down
end
end
end
#fugir do heroi
def move_away_from_player
sx = @x - $game_player.x
sy = @y - $game_player.y
if sx == 0 and sy == 0
return
end
abs_sx = sx.abs
abs_sy = sy.abs
if abs_sx == abs_sy
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
if abs_sx
if sx < 0 and sy > 0
move_lower_left
elsif sx > 0 and sy > 0
move_lower_right
elsif sx > 0 and sy < 0
move_upper_right
elsif sx < 0 and sy < 0
move_upper_left
elsif sx < 0
move_left
elsif sx > 0
move_right
elsif sy > 0
move_down
elsif sy < 0
move_up
end
end
end
def update_move
distance = 2 ** @move_speed # Relacionamos velocidade e distância
# impede que corra usando o padrão do VX
distance *= 2 if dash? and RUBY_MOVE::DASH_SYSTEM == false
@real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
@real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
@real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
@real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
update_bush_depth unless moving?
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
end
end
#==============================================================================
# Game_Player
#------------------------------------------------------------------------------
# Esta classe controla as informações do jogador. Entre elas: os veículos,
# os eventos (quando iniciá-los), o loop do mapa... etc.
# Pode ser acessada utilizando $game_player.
#==============================================================================
class Game_Player < Game_Character
@@poin = 0
WCOUNT = 10
include RUBY_MOVE
def move_by_input
return unless movable?
return if $game_map.interpreter.running?
for i in 0...$game_party.members.size
actor = $game_party.members[i]
end
# status confusão
if actor.state?(CONFUSE)
unless moving? or $game_map.interpreter.running? or @move_route_forcing or $game_message.visible
case Input.dir8
when 1; move_right; move_up
when 2; move_up
when 3; move_up; move_left
when 4; move_right
when 6; move_left
when 7; move_down; move_right
when 8; move_down
when 9; move_left; move_down
end
end
# status crazy
elsif actor.state?(CRAZY)
unless moving? or $game_map.interpreter.running? or @move_route_forcing or $game_message.visible
case rand(8)
when 1; move_right; move_up
when 2; move_up; turn_up
when 3; move_up; move_left
when 4; move_right; turn_right
when 5; move_left; turn_left
when 6; move_down; move_right
when 7; move_down; turn_down
when 8; move_left; move_down
end
end
# status Stop
elsif actor.state?(STOP_ID)
unless moving? or $game_map.interpreter.running? or @move_route_forcing or $game_message.visible
case Input.dir8
when 1
when 2; turn_down
when 3
when 4; turn_left
when 6; turn_right
when 7
when 8; turn_up
when 9
end
end
else
unless moving? or $game_map.interpreter.running? or @move_route_forcing or $game_message.visible
case Input.dir8
when 2; move_down
when 4; move_left
when 6; move_right
when 8; move_up
when 1# Mover esquerda-abaixo
move_left; move_down
when 3# Mover direita-abaixo
move_down; move_right
when 7# Mover esquerda-acima
move_up; move_left
when 9 # Mover direita-acima
move_right; move_up
end
end
end
end
def update
last_moving = moving?
move_by_input
last_real_x = @real_x
last_real_y = @real_y
super
update_scroll(last_real_x, last_real_y)
update_vehicle
update_nonmoving(last_moving)
if ACTOR == 0
actor = $game_party.members[0]
else
for i in 0...$game_party.members.size
actor = $game_party.members[i]
end
end
# controle dos movimentos e imagens
actor_extra_move(actor)
# controle dos saltos
actor_jump(actor)
# controle dos movimentos e calculos
if DASH_SYSTEM == true
actor_dash(actor)
end
end
def actor_dash(actor)
if LEVEL_SISTEMA == 0
tipo = actor.level
elsif LEVEL_SISTEMA == 1
tipo = actor.maxhp
elsif LEVEL_SISTEMA == 2
tipo = actor.maxmp
elsif LEVEL_SISTEMA == 3
tipo = actor.agi
elsif LEVEL_SISTEMA == 4
tipo = actor.int
elsif LEVEL_SISTEMA == 5
tipo = $game_party.steps
elsif LEVEL_SISTEMA == 6
tipo = $game_variables[VARI]
else
tipo = 0
end
if LEVEL == true
calculo = tipo * LEVEL_CALCULO2
$valor0 = calculo
else
$valor0 = 0
end
if $dash >= $max_dash + $valor0
$dash = $max_dash + $valor0
elsif $dash <= 0
$dash = 0
end
if LEVEL == true
valor1 = tipo / LEVEL_CALCULO
else
valor1 = 0
end
unless $game_map.interpreter.running? or $game_message.visible
# usar botão para correr se não estiver em veiculo
if Input.press?(BUTTON) and !in_vehicle? and !$game_map.disable_dash?
@@poin = 0
if $dash >= 10
valor5 = DASH_SPEED + $valor0
if valor5 > MAX_SPEED
# status Slow
if actor.state?(SLOW)
@move_speed = MAX_SPEED - SLOW_SPEED - $slow
# status Fast
elsif actor.state?(FAST)
@move_speed = NORMAL_SPEED + FAST_SPEED - $slow
else
@move_speed = MAX_SPEED - $slow
end
else
if actor.state?(SLOW)
@move_speed = DASH_SPEED + valor1 - SLOW_SPEED - $slow
elsif actor.state?(FAST)
@move_speed = NORMAL_SPEED + FAST_SPEED - $slow
else
@move_speed = DASH_SPEED - $slow
end
end
$dash -= DASH_DOWN
else
$dash -= DASH_DOWN
for i in 0...$game_party.members.size
actor = $game_party.members[i]
for i in 1...$data_states.size
state = $data_states[i]
if actor.state?(SLOW)
@move_speed = NORMAL_SPEED - SLOW_SPEED - $slow
elsif actor.state?(FAST)
@move_speed = NORMAL_SPEED + FAST_SPEED - $slow
else
@move_speed = NORMAL_SPEED - $slow
end
end
end
end
else
if LEVEL == true
valor3 = tipo / LEVEL_CALCULO3
else
valor3 = 0
end
# status Delay
if actor.state?(DELAY)
$dash -= DASH_UP + valor3
@move_speed = NORMAL_SPEED - $slow
else
speed1 = DASH_UP + valor3
speed2 = (DASH_UP + valor3) * HASTE_UP
# status Haste
if actor.state?(HASTE)
$dash += speed2
else
$dash += speed1
end
@move_speed = NORMAL_SPEED - $slow
if actor.state?(SLOW)
@move_speed = NORMAL_SPEED - SLOW_SPEED - $slow
elsif actor.state?(FAST)
@move_speed = NORMAL_SPEED + FAST_SPEED - $slow
elsif in_vehicle?
vehicle = $game_map.vehicles[@vehicle_type]
@move_speed = vehicle.speed
else
@move_speed = NORMAL_SPEED - $slow
end
end
end
end
end
def actor_jump(actor)
if Input.press?(JUMPBUTTON) and (not in_vehicle?) and $game_switches[JUMPSWITCH]==false and movable? and (not in_vehicle?)
if DASH_SYSTEM == true
return if $dash - DASH_JUMP <= 0
$dash -= DASH_JUMP
end
case @direction
when 2
if img_jump_exist?(actor)
@character_name = actor.character_name + ADD_JUMP
end
# impede pulo na diagonal
return if Input.dir8 == 1 or Input.dir8 == 3 or Input.dir8 == 5 or Input.dir8 == 7 or Input.dir8 == 9
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 img_jump_exist?(actor)
@character_name = actor.character_name + ADD_JUMP
end
return if Input.dir8 == 1 or Input.dir8 == 3 or Input.dir8 == 5 or Input.dir8 == 7 or Input.dir8 == 9
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 img_jump_exist?(actor)
@character_name = actor.character_name + ADD_JUMP
end
return if Input.dir8 == 1 or Input.dir8 == 3 or Input.dir8 == 5 or Input.dir8 == 7 or Input.dir8 == 9
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 img_jump_exist?(actor)
@character_name = actor.character_name + ADD_JUMP
end
return if Input.dir8 == 1 or Input.dir8 == 3 or Input.dir8 == 5 or Input.dir8 == 7 or Input.dir8 == 9
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
end
alias_method :jump_movable?, :movable?
def movable?
return false if jumping?
jump_movable?
end
def actor_extra_move(actor)
return if ANI_HERO == false
if controllable?
if @breakact_count.to_i > 0
@breakact_count -= 1
else
self.breakact = true
end
else
@breakact_count = WCOUNT
self.breakact = false
end
# movimento ani
if @breakacting
if img_pause_exist?(actor)
@character_name = actor.character_name + ADD_ANI
end
end
se_01 = $dash
se_02 = $max_dash + $valor0
se_03 = 100 * se_01 / se_02
if se_03 >= 100
se_03 = 100
@@poin += 1
end
if @@poin == 1 and $game_switches[DASHSWIT] == true
Audio.se_play("Audio/SE/" + SE_PLAY, 100, 100) rescue nil
end
if Input.press?(BUTTON) and se_03 > 0
case Input.dir8
when 1
if img_dia_dash_exist?(actor)
@character_name = actor.character_name + ADD_DQT
end
when 2
if img_exist?(actor)
@character_name = actor.character_name + ADD_DASH
end
when 3
if img_dia_dash_exist?(actor)
@character_name = actor.character_name + ADD_DQT
end
when 4
if img_exist?(actor)
@character_name = actor.character_name + ADD_DASH
end
when 6
if img_exist?(actor)
@character_name = actor.character_name + ADD_DASH
end
when 7
if img_dia_dash_exist?(actor)
@character_name = actor.character_name + ADD_DQT
end
when 8
if img_exist?(actor)
@character_name = actor.character_name + ADD_DASH
end
when 9
if img_dia_dash_exist?(actor)
@character_name = actor.character_name + ADD_DQT
end
end
else
case Input.dir8
when 1
if img_dia_exist?(actor)
@character_name = actor.character_name + ADD_QT
end
when 2; @character_name = actor.character_name
when 3
if img_dia_exist?(actor)
@character_name = actor.character_name + ADD_QT
end
when 4; @character_name = actor.character_name
when 6; @character_name = actor.character_name
when 7
if img_dia_exist?(actor)
@character_name = actor.character_name + ADD_QT
end
when 8; @character_name = actor.character_name
when 9
if img_dia_exist?(actor)
@character_name = actor.character_name + ADD_QT
end
end
end
end
def breakact=(b)
@breakacting = b
@step_anime = b
end
def controllable?
movable?
return !(moving? or $game_map.interpreter.running? or
@move_route_forcing or $game_message.visible or
Input.trigger?(Input::C) or Input.press?(Input::C) or
Input.trigger?(Input::Y) or Input.press?(Input::Y) or
Input.trigger?(Input::Z) or Input.press?(Input::Z) or
Input.trigger?(Input::A) or Input.press?(Input::A) or
Input.trigger?(Input::X) or Input.press?(Input::X) or
Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT) or
Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) or
Input.press?(Input::LEFT) or Input.press?(Input::RIGHT) or
Input.press?(Input::UP) or Input.press?(Input::DOWN))
end
def img_dia_exist?(actor)
begin
Cache.character(actor.character_name.to_s + ADD_QT)
rescue
return false
end
return true
end
def img_dia_dash_exist?(actor)
begin
Cache.character(actor.character_name.to_s + ADD_DQT)
rescue
return false
end
return true
end
def img_jump_exist?(actor)
begin
Cache.character(actor.character_name.to_s + ADD_JUMP)
rescue
return false
end
return true
end
def img_exist?(actor)
begin
Cache.character(actor.character_name.to_s + ADD_DASH)
rescue
return false
end
return true
end
def img_pause_exist?(actor)
begin
Cache.character(actor.character_name.to_s + "_ani")
rescue
return false
end
return true
end
endDownload e ficha técnica
- Download (clique com o botão esquerdo do mouse ou toque no link)
- Desenvolvedor, publisher e/ou distribuidor: RubyKey
- Sistema(s): Windows 2000/XP/Vista/7
- Tamanho: 1,186MB (pacote de instalação e/ou espaço em disco)
- Licença: Grátis
- Categoria: Programação VX
- Tag: RPG Maker VX
- Adicionado por: LichKing
- Acessos: 466
Observação: se você gostou deste post ou ele lhe foi útil de alguma forma, por favor considere apoiar financeiramente a Gaming Room. Fico feliz só de ajudar, mas a contribuição do visitante é muito importante para que este site continua existindo e para que eu possa continuar provendo este tipo de conteúdo e melhorar cada vez mais. Acesse aqui e saiba como. Obrigado!
