We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have started to have a play with the Frames library, to work with spritesheets. I have got my sprites working within the library example, but when I try to strip the code back to purely the code that I need, it doesn't run.
The error I am getting is 'null pointer exception' with the currentAnimation.advance(); line.
Pretty new to Processing, probably doing something stupid.
import java.util.List;
import org.dishevelled.processing.frames.Animation;
import org.dishevelled.processing.frames.Frames;
Frames frames;
Animation box;
Animation currentAnimation;
int px = width / 2;
int py = height / 2;
boolean right = true;
void setup()
{
size(500,500);
frameRate(25);
background(20);
frames = new Frames(this);
List<PImage> boxFrames = frames.createFrameList("box.png", 0, 0, 200, 200, 10);
}
void draw()
{
currentAnimation.advance();
image(currentAnimation.getCurrentFrame(), px, py);
}
Answers
http://www.openprocessing.org/sketch/210240
link to the original code before I started stripping it
"probably doing something stupid"
I fear so... :-P Well, just usual beginner's mistakes, nothing to be ashamed of.
I recommend taking a look at some of the first articles of http://forum.processing.org/two/categories/common-questions which tries to address some of these common mistakes.
Among them:
Can't comment more as I don't know the library.