I am currently writing a weapon class and a projectile class, to use in a top-down game.
However, I can't seem to be able to load images in a class. It works in the main function, where I do it like this:
Image bulletImage =getImage(getCodeBase(),"bullet_machinegun.png");
However, this doesn't work inside the projectile class.
It can't find the getImage and the getCodeBase methods.
And passing an image object through constructors and such seems extremely tedious.
Is there a way of loading images inside classes?