$VIPArcherScript ||= {};$VIPArcherScript[:remind_balloon] = 20150125
module VIPArcher end
module VIPArcher::Remind
SPEED = 4
WAIT_TIME = 90
FILENAME = "Balloon"
end
class Sprite_Remind < Sprite_Character
include VIPArcher::Remind
def event
fx = $game_map.round_x_with_direction(character.x, character.direction)
fy = $game_map.round_y_with_direction(character.y, character.direction)
return $game_map.events_xy(fx, fy)[0]
end
def get_balloon_id(event)
return 0 if event.nil? || event.list.nil?
event.list.each do |command|
if command.code == 108 || command.code == 408
command.parameters.each do |line|
return $1.to_i if line =~ /<balloon\s*(\d+)>/i
end
end
end ; 0
end
def start_balloon
dispose_balloon
@balloon_duration = 8 * balloon_speed + balloon_wait
@balloon_sprite = ::Sprite.new(viewport)
@balloon_sprite.bitmap = Cache.system(FILENAME)
@balloon_sprite.ox = 16
@balloon_sprite.oy = 32
update_balloon
end
def balloon_speed ; SPEED end
def balloon_wait ; WAIT_TIME end
def end_balloon
dispose_balloon
@balloon_id = 0
end
def update_position
super
self.y = @character.screen_y - 32
end
def update
super
if @balloon_id != get_balloon_id(event)
@balloon_id = get_balloon_id(event)
start_balloon if @balloon_id > 0
end
end
def update_bitmap ; end ; def setup_new_effect ; end
def end_animation ; end ; def update_src_rect ; end
def update_other ; end ; def update_other ; end
end
class Spriteset_Map
alias balloon_remind_create_characters create_characters
def create_characters
balloon_remind_create_characters
@remind_sprite = Sprite_Remind.new(@viewport2,$game_player)
end
alias balloon_remind_update update
def update
balloon_remind_update ; @remind_sprite.update
end
alias balloon_remind_dispose dispose
def dispose
balloon_remind_dispose ; @remind_sprite.dispose
end
end