Pick Up and Trow v1.0

Ver o tópico anterior Ver o tópico seguinte Ir em baixo

Pick Up and Trow v1.0

Mensagem por Convidad em Dom 20 Fev - 10:06

Pick Up and Trow

Por MogSlayer
Fonte

Siga os direitos de uso e disponibilização

Descrição:
Sistema de carregar e arremessar eventos, útil para criar puzzles.

Instruções

Para definir quais os eventos serão arremessáveis basta nomear o evento da seguinte forma.



X é a distância que o evento pode ser arremessado.

Exemplo





Sprite do personagem carregando objeto. (Opcional)

Basta ter uma imagem do personagem em posição de carreagar objeto e nomea-lo da sequinte forma.

Character_Name + _Pickup

Exemplo

Actor1_Pickup.png

Sample Image


Screenshots




Download


DOWNLOAD

Spoiler for Script:
Código: [Selecionar]
#==============================================================================
# +++ MOG VX - Pick-up and Throw v1.1 +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Sistema de carregar e arremessar eventos, útil para criar puzzles.
#==============================================================================
# Para definir quais os eventos serão arremessáveis basta nomear o evento
# da seguinte forma.
#
#
#
# X é a distância que o evento pode ser arremessado.
#
# Exemplo
#
# Event01
#
#==============================================================================
# Sprite do personagem carregando o Objeto (Opcional)
#==============================================================================
# Basta ter uma imagem do personagem em posição de carreagar objeto e nomea-lo
# da sequinte forma.
#
# Character_Name + _Pickup
#
# Exemplo
#
# Actor1_Pickup.png
#
#==============================================================================
module MOG_PICK_THROW
#Altura do sprite do objeto carregado.
SPRITE_POSITION = 18
#ID da Animação quando o objeto é arremessado.
THROW_ANIMATIOM_ID = 82
#ID da Animação quando o objeto é carregado.
PICK_UP_ANIMATIOM_ID = 81
#ID do balão quando o objeto é arremessado.
THROW_BALLOON_ID = 5
#ID do balão quando o objeto é carregado.
PICK_UP_BALLOON_ID = 6
end

#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp

attr_accessor :pickup_lock
attr_accessor :pickup_lock_time
attr_accessor :character_pre_name
attr_accessor :can_throw

#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
alias mog_pick_initialize initialize
def initialize
@pickup_lock = false
@pickup_lock_time = 0
@character_pre_name = ""
@can_throw = true
mog_pick_initialize
end
end

#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event < Game_Character

attr_accessor :throw_active
attr_accessor :throw
attr_accessor :x
attr_accessor :y
attr_accessor :move_speed
attr_accessor :pre_move_speed

#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
alias mog_pickup_initialize initialize
def initialize(map_id, event)
@throw_active = false
if event.name =~ //i
@throw = $1.to_i
else
@throw = 0
end
mog_pickup_initialize(map_id, event)
end
end

#==============================================================================
# ■ Game_Character
#==============================================================================
class Game_Character
attr_accessor :pre_move_speed

#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_throw_initialize initialize
def initialize
mog_throw_initialize
@pre_move_speed = @move_speed
end

#--------------------------------------------------------------------------
# ● Throw Action
#--------------------------------------------------------------------------
def throw_action(range)
jump_range = range
@x = $game_player.x
@y = $game_player.y
range.times do
unless jumping?
case $game_player.direction
when 6
jump(jump_range,0) if throw_range?(jump_range,0,jump_range)
when 4
jump(-jump_range,0) if throw_range?(-jump_range,0,jump_range)
when 2
jump(0,jump_range) if throw_range?(0,jump_range,jump_range)
when 8
jump(0,-jump_range) if throw_range?(0,-jump_range,jump_range)
end
jump(0,0) if jump_range == 1
if @x == $game_player.x and @y == $game_player.y and jump_range == 1
$game_temp.can_throw = false
end
jump_range -= 1
end
end
end

#--------------------------------------------------------------------------
# ● Throw Range?
#--------------------------------------------------------------------------
def throw_range?(x, y,range )
x = $game_player.x
y = $game_player.y
case $game_player.direction
when 2
y += range
when 6
x += range
when 4
x -= range
when 8
y -= range
end
return false if collide_with_characters?(x, y)
return false unless map_passable?(x, y)
return true
end
end

#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
include MOG_PICK_THROW

#--------------------------------------------------------------------------
# ● Img Pickup Exist?
#--------------------------------------------------------------------------
def img_pickup_exist?
Cache.character(@character_name + "_Pickup") rescue return false
end

#--------------------------------------------------------------------------
# ● Check Action Event
#--------------------------------------------------------------------------
alias mog_pickup_check_action_event check_action_event
def check_action_event
throw_event
check_event_pickup([0,1,2])
mog_pickup_check_action_event
end

#--------------------------------------------------------------------------
# ● Reserve Transfer
#--------------------------------------------------------------------------
alias mog_pickup_reserve_transfer reserve_transfer
def reserve_transfer(map_id, x, y, direction)
if $game_temp.pickup_lock == true
$game_temp.pickup_lock = false
$game_temp.pickup_lock_time = 0
@character_name = $game_temp.character_pre_name
end
mog_pickup_reserve_transfer(map_id, x, y, direction)
end

#--------------------------------------------------------------------------
# ● Move By Input
#--------------------------------------------------------------------------
alias mog_pickup_move_by_input move_by_input
def move_by_input
return if $game_temp.pickup_lock_time > 0
mog_pickup_move_by_input
end

#--------------------------------------------------------------------------
# ● Throw Event
#--------------------------------------------------------------------------
def throw_event
return if $game_temp.pickup_lock == false
return if $game_temp.pickup_lock_time > 0
return if $game_map.interpreter.running?
for event in $game_map.events.values
if event.throw_active == true and not jumping?
$game_temp.can_throw = true
event.throw_action(event.throw)
$game_temp.pickup_lock_time = 120
return if $game_temp.can_throw == false
event.throw_active = false
$game_temp.pickup_lock = false
event.move_speed = event.pre_move_speed
event.animation_id = THROW_ANIMATIOM_ID
$game_player.balloon_id = THROW_BALLOON_ID
@character_name = $game_temp.character_pre_name
end
end
end

#--------------------------------------------------------------------------
# ● Check Event Pickup
#--------------------------------------------------------------------------
def check_event_pickup(triggers)
return if $game_temp.pickup_lock == true
return if $game_temp.pickup_lock_time > 0
return if $game_map.interpreter.running?
front_x = $game_map.x_with_direction(@x, @direction)
front_y = $game_map.y_with_direction(@y, @direction)
for event in $game_map.events_xy(front_x, front_y)
if event.throw > 0 and not jumping?
$game_temp.pickup_lock_time = 120
event.throw_active = true
$game_temp.pickup_lock = true
event.jump(0,0)
event.x = @x
event.y = @y
event.pre_move_speed = event.move_speed
event.move_speed = 5
$game_player.balloon_id = PICK_UP_BALLOON_ID
event.animation_id = PICK_UP_ANIMATIOM_ID
$game_temp.character_pre_name = @character_name
if img_pickup_exist?
@character_name = @character_name + "_Pickup"
end
end
end
end
end

#==============================================================================
# ■ Sprite_Character
#==============================================================================
class Sprite_Character < Sprite_Base
include MOG_PICK_THROW

#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_pickup_update update
def update
mog_pickup_update
update_pickup_position
end

#--------------------------------------------------------------------------
# ● Update Pickup Position
#--------------------------------------------------------------------------
def update_pickup_position
$game_temp.pickup_lock_time -= 1 if $game_temp.pickup_lock_time > 0
if @character.is_a?(Game_Event)
if @character.throw_active == true and not @character.jumping?
@character.x = $game_player.x
@character.y = $game_player.y
self.x = $game_player.screen_x
self.y = $game_player.screen_y - SPRITE_POSITION
self.z = $game_player.screen_z + 1
end
end
end
end

#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base

#--------------------------------------------------------------------------
# ● Call Menu
#--------------------------------------------------------------------------
alias mog_pickup_call_menu call_menu
def call_menu
$game_temp.next_scene = nil if $game_temp.pickup_lock == true
return if $game_temp.pickup_lock == true
mog_pickup_call_menu
end

#--------------------------------------------------------------------------
# ● Call Save
#--------------------------------------------------------------------------
alias mog_pickup_call_save call_save
def call_save
$game_temp.next_scene = nil if $game_temp.pickup_lock == true
return if $game_temp.pickup_lock == true
mog_pickup_call_save
end
end

$mog_rgssvx_pickup_throw = true

Convidad
Convidado


Voltar ao Topo Ir em baixo

Ver o tópico anterior Ver o tópico seguinte Voltar ao Topo


 
Permissão deste fórum:
Você não pode responder aos tópicos neste fórum