Closed jbox144 closed 6 years ago
As the title suggests, PImages can't be stored in class objects. If you're using the following code:
def __init__(self, n, f): self.img = loadImage(f) self.name = n def draw(self, x, y): image(self.img, x * 64, y * 64)
You will get a null pointer exception. Either this is a bug, or I'm missing something horribly obvious. Please help me!
Edit: I am an idiot. You have to run the loadImage function in setup, not outside of it.
As the title suggests, PImages can't be stored in class objects. If you're using the following code:
You will get a null pointer exception. Either this is a bug, or I'm missing something horribly obvious. Please help me!
Edit: I am an idiot. You have to run the loadImage function in setup, not outside of it.