I have a script which define a custom class, simply :
class Poser
def update
#run specific animation
end
end
This Poser class will draw a picture, then animate it. In order to be animated, its update must be placed on scene_menu's update :
class Scene_Map
def main
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
Graphics.transition
loop do
[b]if $test != nil then $test.animate end[/b]
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@message_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
end
As you can see, the instance of Poser class is $test, which was created upon triggering an event on the map, so far no problem.
Now, I need to make 2,3 instance of Poser, maybe name it as $test2, $test3, so on. which means, in Scene Map's loop, I have to add
[b]if $test != nil then $test.animate end[/b]
[b]if $test2 != nil then $test2.animate end[/b]
[b]if $test3 != nil then $test3.animate end[/b]
Okay that was stupid, more instances means more lines. my question is, is it possible to :
[b]if [poser_instance] > 0 then [every_poser_instances].animate end[/b]
The point is, I don't have to explicitly mention instance's name to call its method. Because the instance might be more than 10 later.
Thanks in advance