NEO_GABMiér Mayo 22, 2013 1:44 am
Usuario Nv7
Bueno, que hay de nuevo...
he aqui mi nuevo hijo jajaja...
es un sript simple que permite a tener a dos jugadores en el mapa
a un es la primera version por lo que es un poco simple
Plataforma: RPGMAKER VX ACE
Dificultad: Medio
Version : 1.0
Imagenes
Codigo
Espero que les sirva...
...ah y comenten, un comentario puede salvar muchas vidas
he aqui mi nuevo hijo jajaja...
es un sript simple que permite a tener a dos jugadores en el mapa
a un es la primera version por lo que es un poco simple
Plataforma: RPGMAKER VX ACE
Dificultad: Medio
Version : 1.0
Imagenes
- Spoiler:
- No creo que sean necesarias...
Codigo
- Código:
#==============================================================================#
# NEO_GAB - Simple Multiplayer.
#==============================================================================#
# Plataforma: RPGMAKER VX ACE
# Dificultad: Medio
# Version : 1.0
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# 14-04-2013 - Version 1.0
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Permite crear a un segundo jugador.
#==============================================================================#
module NeoGab
module DirPlayer2
#==============================================================================#
# Configuraciones.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
DOWN = Input::Y # S en el teclado.
LEFT = Input::X # A en el teclado.
RIGHT = Input::Z # D en el teclado.
UP = Input::R # W en el teclado.
ENTER = Input::L # Q en el teclado.
RUN = Input::A # Shift en el teclado.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
# Fin de las configuraciones.
#==============================================================================#
end
end
#==============================================================================
# ■ Module Input.
#==============================================================================
module Input
def self.dir4_player2
return 2 if self.press?(NeoGab::DirPlayer2::DOWN)
return 4 if self.press?(NeoGab::DirPlayer2::LEFT)
return 6 if self.press?(NeoGab::DirPlayer2::RIGHT)
return 8 if self.press?(NeoGab::DirPlayer2::UP)
return 0
end
def self.dir8_player2
if self.press?(NeoGab::DirPlayer2::UP)
return 9 if self.press?(NeoGab::DirPlayer2::RIGHT)
return 7 if self.press?(NeoGab::DirPlayer2::LEFT)
return 8
end
if self.press?(NeoGab::DirPlayer2::DOWN)
return 3 if self.press?(NeoGab::DirPlayer2::RIGHT)
return 1 if self.press?(NeoGab::DirPlayer2::LEFT)
return 2
end
return 6 if self.press?(NeoGab::DirPlayer2::RIGHT)
return 4 if self.press?(NeoGab::DirPlayer2::LEFT)
return 0
end
end
#==============================================================================
# ■ Game Multiplayer
#==============================================================================
class Game_Multiplayer < Game_Player
def actor
$game_party.battle_members[1]
end
def perform_transfer
if transfer?
set_direction(@new_direction)
$game_player.sync_with($game_player2)
if @new_map_id != $game_map.map_id
$game_map.setup(@new_map_id)
$game_map.autoplay
end
moveto(@new_x, @new_y)
$game_player.moveto(@new_x, @new_y)
clear_transfer_info
end
end
def dash?
return false if @move_route_forcing
return false if $game_map.disable_dash?
return Input.press?(NeoGab::DirPlayer2::RUN)
end
def move_by_input
return unless movable?
return if $game_map.interpreter.running?
move_straight(Input.dir4_player2) if Input.dir4_player2 > 0
end
def update_nonmoving(last_moving)
return if $game_map.interpreter.running?
if last_moving
$game_party.on_player_walk
return if check_touch_event
end
if movable? && Input.trigger?(NeoGab::DirPlayer2::ENTER)
return if check_action_event
end
update_encounter if last_moving
end
def update_scroll(last_real_x, last_real_y)
end
end
#==============================================================================
# ■ Game Player
#==============================================================================
class Game_Player < Game_Character
def update_vehicle_get_on
if !@followers.gathering? && !moving?
@direction = vehicle.direction
@move_speed = vehicle.speed
@vehicle_getting_on = false
@transparent = true
$game_player2.transparent = true
@through = true if in_airship?
vehicle.get_on
end
end
def update_vehicle_get_off
if !@followers.gathering? && vehicle.altitude == 0
@vehicle_getting_off = false
@vehicle_type = :walk
@transparent = false
$game_player2.transparent = false
end
end
def get_on_vehicle
front_x = $game_map.round_x_with_direction(@x, @direction)
front_y = $game_map.round_y_with_direction(@y, @direction)
@vehicle_type = :boat if $game_map.boat.pos?(front_x, front_y)
@vehicle_type = :ship if $game_map.ship.pos?(front_x, front_y)
@vehicle_type = :airship if $game_map.airship.pos?(@x, @y)
if vehicle
@vehicle_getting_on = true
force_move_forward unless in_airship?
@followers.gather
$game_player2.sync_with($game_player)
end
@vehicle_getting_on
end
def get_off_vehicle
if vehicle.land_ok?(@x, @y, @direction)
set_direction(2) if in_airship?
@followers.synchronize(@x, @y, @direction)
vehicle.get_off
unless in_airship?
force_move_forward
@transparent = false
end
@vehicle_getting_off = true
@move_speed = 4
@through = false
make_encounter_count
@followers.gather
$game_player2.sync_with($game_player)
end
@vehicle_getting_off
end
def perform_transfer
if transfer?
set_direction(@new_direction)
$game_player2.sync_with($game_player)
if @new_map_id != $game_map.map_id
$game_map.setup(@new_map_id)
$game_map.autoplay
end
moveto(@new_x, @new_y)
$game_player2.moveto(@new_x, @new_y)
clear_transfer_info
end
end
end
#==============================================================================
# ■ Game Player
#==============================================================================
class Game_Character
def sync_with(target)
@x = target.x
@y = target.y
@real_x = target.real_x
@real_y = target.real_y
@direction = target.direction
update_bush_depth
end
end
#==============================================================================
# ■ Game_Followers
#==============================================================================
class Game_Followers
def initialize(leader)
@visible = $data_system.opt_followers
@gathering = false
@data = []
@data.push(Game_Follower.new(2, leader))
(3...$game_party.max_battle_members).each do |index|
@data.push(Game_Follower.new(index, @data[-1]))
end
end
end
#==============================================================================
# ■ Spriteset Map.
#==============================================================================
class Spriteset_Map
alias :multiplayer_create_characters :create_characters
def create_characters
multiplayer_create_characters
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player2))
end
end
#==============================================================================
# ■ Scene Map.
#==============================================================================
class Scene_Map < Scene_Base
alias :multiplayer_map_update :update
def update
multiplayer_map_update
$game_player2.update if $game_player2
end
end
#==============================================================================
# ■ DataManager.
#==============================================================================
module DataManager
class << self
alias :multiplayer_create_game_objects :create_game_objects
alias :multiplayer_make_save_contents :make_save_contents
alias :multiplayer_extract_save_contents :extract_save_contents
end
def self.create_game_objects
multiplayer_create_game_objects
$game_player2 = Game_Multiplayer.new
end
def self.make_save_contents
contents = multiplayer_make_save_contents
contents[:player2] = $game_player2
contents
end
def self.extract_save_contents(contents)
multiplayer_extract_save_contents(contents)
$game_player2 = contents[:player2]
end
def self.setup_new_game
create_game_objects
$game_party.setup_starting_members
$game_map.setup($data_system.start_map_id)
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$game_player2.moveto($data_system.start_x, $data_system.start_y)
$game_player2.refresh
Graphics.frame_count = 0
end
end
#==============================================================================
# ■ Game Party.
#==============================================================================
class Game_Party
alias :multiplayer_add_actor :add_actor
alias :multiplayer_remove_actor :remove_actor
def add_actor(actor_id)
multiplayer_add_actor(actor_id)
$game_player2.refresh if $game_player2
end
def remove_actor(actor_id)
multiplayer_remove_actor(actor_id)
$game_player2.refresh if $game_player2
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
alias :multiplayer_on_formation_ok :on_formation_ok
def on_formation_ok
multiplayer_on_formation_ok
$game_player2.refresh if $game_player2
end
end
Espero que les sirva...
...ah y comenten, un comentario puede salvar muchas vidas