Northern49
Member
I tried to make a script that fades an event but I failed. Could someone tell me what I'm doing wrong?
Code:
class Spriteset_Map
def fade_event(char, duration)
# sprite_character equal to:
sprite = @character_sprites.detect {|s| s.character == char }
# Character opacity duration
sprite.opacity(duration)
end
end
class Scene_Map
attr_reader :spriteset
end
class Interpreter
# flash_event(index[, color[, duration]])
#
# Index: The event that is to fade
# Duration: The time it takes for sprite to disappear completely
def fade_event(index, duration=20)
if $scene.instance_of?(Scene_Map)
if index != 0
event = $game_map.events[index]
if event.nil?
raise IndexError, "fade_event: Index error"
end
else
event = $game_player
end
$scene.spriteset.fade_event(event, duration*2)
end
end
end