Luigi Maker
Mensagens : 25 Fama : 39 Data de inscrição : 30/05/2010 Idade : 26 Localização : Na Minha Casa '-'
Estatisticas Galeria de Premios:
| Assunto: Script de 8 Direções , Com Sprites do Char na Diagonal ! Dom maio 30, 2010 9:13 am | |
| Introdução:Este Script Permite Andar em 8 Direções com os Movimentos do Personagem na Diagonal . Instruções1° - Vá em Graphics / Characters e importe o char em ANEXO ( SEM MUDAR O NOME DELE ! ) Depois vá no EDITOR DE SCRIPTS , clique com o Botão direito do Mouse em Main ( ÚLTIMO SCRIPT DA LISTA ) e clique em INSERIR , depois irá criar um novo script , ponha um nome nele ( NÃO É OBRIGATÓRIO ) depois Cole o Script , se quiser pôr outros chars com este movimento , veja nas Instruções do SCRIPT , e Teste seu Projeto. - Spoiler:
- Código:
-
#====================================================================== # 8-Direções Characterset versão. 1.01 # Traduzido por Lucas ( Dark ) #Script Feito por ParaDog #http://2d6.parasite.jp/ #------------------------------------------------------------------------------ # Adcional movimento "Diagonal" que agora é possivel , empurrando as combinhações do # controle vertical e horizontal (acima , à esquerda ,etc) simultaneamente. # # Charsets Adcionais para o movimento em 8 Direções devem ser armazenados dentro # da pasta "Graphics/Characters" , assim como o characterset regular. # # Nome do novo movimento diagonal charactersets o mesmo que os regulares, # mas como um novo '_quarter' extensão. Como tal , você teria o nome Primeiro # characterset: 001-Fighter01_quarter. #------------------------------------------------------------------------------ # Notas adicionais: # Este sistema pode ser utilizado com o sistema "Dash Characterset Editor", mas por favor # Coloque este script "abaixo" o primeiro plano mencionado Dash script para que ele funcione. # # Como você pode combinar os dois scripts (e Dash 8-direcional), você também pode usar # charactersets que mostram ação correndo na diagonal, também são armazenados no mesmo # "Graphics / Characters" a pasta. # # Nomeação dos novos elementos gráficos que exigem a inclusão de ambos "_dash e os #extensões # '_quarter "como mostrado aqui: 001 Fighter01_dash_quarter. #==============================================================================
#============================================================================== # ** Game_Player #------------------------------------------------- ----------------------------- # Esta classe lida com o jogador. Suas funções incluem evento a partir # determinantes e deslocação no mapa. Consulte "$ game_player" para o # Instância dessa classe. #================================================= =============================
class Game_Player < Game_Character #-------------------------------------------------------------------------- # * Atualização Frame #-------------------------------------------------------------------------- alias update_para_quarter update def update update_para_quarter unless moving? or $game_system.map_interpreter.running? or @move_route_forcing or $game_temp.message_window_showing # If the direction button is pushed, move the player in that direction case Input.dir8 when 1 # Move Lower Left move_lower_left when 3 # Move Lower Right move_lower_right when 7 # Move Upper Left move_upper_left when 9 # Move Upper Right move_upper_right end end end end
#============================================================================== # ** Sprite_Character #------------------------------------------------------------------------------ # Este sprite é usado para exibir o character.It observa os Game_Character # muda de classe e automaticamente sprite condições. #==============================================================================
class Sprite_Character < RPG::Sprite #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- alias update_para_quarter update def update update_para_quarter if @tile_id == 0 if (@character.direction - 2) % 2 == 1 # Checking the presence of the diagonal charset if quarter_graphic_exist?(@character) # Set the diagonal charset if character.dash_on and dash_quarter_graphic_exist?(@character) @character_name = @character.character_name + "_dash_quarter" else @character_name = @character.character_name + "_quarter" end self.bitmap = RPG::Cache.character(@character_name, @character.character_hue) # Acquire direction case @character.direction when 1 n = 0 when 3 n = 2 when 7 n = 1 when 9 n = 3 end else @character.direction = @character.sub_direction # When the diagonal charset does not exist, direction n = (@character.direction - 2) / 2 end # Set original transfer rectangle sx = @character.pattern * @cw sy = n * @ch self.src_rect.set(sx, sy, @cw, @ch) else self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue) # Set original transfer rectangle sx = @character.pattern * @cw sy = (@character.direction - 2) / 2 * @ch self.src_rect.set(sx, sy, @cw, @ch) end end end #-------------------------------------------------------------------------- # *Charset Diagonal? #-------------------------------------------------------------------------- def quarter_graphic_exist?(character) # Reading check begin RPG::Cache.character(character.character_name.to_s + "_quarter", character.character_hue) rescue return false end return true end #-------------------------------------------------------------------------- # * Dashing Charset Diagonal? #-------------------------------------------------------------------------- def dash_quarter_graphic_exist?(character) # Reading check begin RPG::Cache.character(character.character_name.to_s + "_dash_quarter", character.character_hue) rescue return false end return true end end
#============================================================================== # ** Game_Character #------------------------------------------------------------------------------ # Esta classe lida com os personagens. É utilizado como uma superclasse para a # Game_Player e classes Game_Event. #==============================================================================
class Game_Character #-------------------------------------------------------------------------- # * Instância Variáveis Públicas #-------------------------------------------------------------------------- attr_accessor :direction # direction attr_accessor :sub_direction # sub_direction #-------------------------------------------------------------------------- # * Move Inferior Esquerdo #-------------------------------------------------------------------------- def move_lower_left # If no direction fix unless @direction_fix @sub_direction = @direction @direction = 1 # Face left if facing right, and face down if facing up @sub_direction = (@sub_direction == 6 ? 4 : @sub_direction == 8 ? 2 : @sub_direction) end # When a down to left or a left to down course is passable if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2)) # Update coordinates @x -= 1 @y += 1 # Increase steps increase_steps end end #-------------------------------------------------------------------------- # * Move Inferior Direito #-------------------------------------------------------------------------- def move_lower_right # If no direction fix unless @direction_fix @sub_direction = @direction @direction = 3 # Face right if facing left, and face down if facing up @sub_direction = (@sub_direction == 4 ? 6 : @sub_direction == 8 ? 2 : @sub_direction) end # When a down to right or a right to down course is passable if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2)) # Update coordinates @x += 1 @y += 1 # Increase steps increase_steps end end #-------------------------------------------------------------------------- # * Move Superior Esquerdo #-------------------------------------------------------------------------- def move_upper_left # If no direction fix unless @direction_fix @sub_direction = @direction @direction = 7 # Face left if facing right, and face up if facing down @sub_direction = (@sub_direction == 6 ? 4 : @sub_direction == 2 ? 8 : @sub_direction) end # When an up to left or a left to up course is passable if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8)) # Update coordinates @x -= 1 @y -= 1 # Increase steps increase_steps end end #-------------------------------------------------------------------------- # * Mover para a Direita superior #-------------------------------------------------------------------------- def move_upper_right # If no direction fix unless @direction_fix @sub_direction = @direction @direction = 9 # Face right if facing left, and face up if facing down @sub_direction = (@sub_direction == 4 ? 6 : @sub_direction == 2 ? 8 : @sub_direction) end # When an up to right or a right to up course is passable if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8)) # Update coordinates @x += 1 @y -= 1 # Increase steps increase_steps end end #-------------------------------------------------------------------------- # * Dash #-------------------------------------------------------------------------- def dash_on if @dash_on != nil return @dash_on else return false end end end P: Necessita da IMG do char na Diagonal ? R: Sim , veja Abaixo . 001-Fighter01_quarterScreenshotsCréditos : A mim Por Traduzir e a ParaDog por Criar o SCRIPT . Link do Tópico do Script Original.Atenciosamente , Luigi
Última edição por Luigi em Dom maio 30, 2010 1:04 pm, editado 1 vez(es) | |
|
M_Fumetsu Administrador
Mensagens : 182 Fama : 626 Data de inscrição : 14/02/2010 Idade : 27 Localização : Uruguaiana-RS
Estatisticas Galeria de Premios:
| Assunto: Re: Script de 8 Direções , Com Sprites do Char na Diagonal ! Dom maio 30, 2010 1:01 pm | |
| Um Script muito bom!,gostei dele. | |
|