Ok, this is really bugging me: Java wont create a copy of a class
What i have is a HashMap of all of my template objects - bullets, ships, asteroids, planets, images, sounds, etc. Now, using Slick2D Images i can use the duplicate method tog et a copy of my stored template.
How can i write a similar duplicate() method for my other classes?
I’ve been working on this all day with no luck:
Simply implementing Clonable and writing a public clone() override fails.
Creating a duplicate() class that creates a new object and then sets all its feilds and properties = to the original class fails.
Constructors that use an object to initialize a new object fails.
Seriously, what do i have to do to copy a class?
(I may be being a tard amd making a prtoblem where there is none, please put me streight if so!)
Chears,
Matt