I have a class called "Laser". It's basically just a laser shot that
moves across the screen. What I want to do is while the user is
holding down the fire button to have it keep creating instances of the
Laser class like a rapid fire and then when they hit the edge of the
screen have them be disappear/destroyed so they are no longer taking
up memory. My problem is I have no idea how to have it keep creating
instances of a class without explicitly naming them like:

laser1 = new Laser(getContext(), R.drawable.laser);
laser2 = new Laser(getContext(), R.drawable.laser);
laser3 = new Laser(getContext(), R.drawable.laser);
laser4 = new Laser(getContext(), R.drawable.laser);
laser5 = new Laser(getContext(), R.drawable.laser);

Also I don't know how to destroy an instance of a class as well. Any
ideas?

Thanks,

Matt

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to