My logic is baffled

just out of curiousity howcome i get a nullpointerexception…


Animation animation;
		
animation = new Animation(true);//runR
animation.addFrame(2, 140);
animation.addFrame(4, 140);
System.out.println(animation);
animations.addAnimation(animation);

… at the last line?

Where do you create animations variable?

create it here? then bring it into the AnimationManager which copies it into its array of Animations.

what do you mean by ‘where’?

The only possible way a NPE could be thrown at that line is that the variable “animations” is null. What aazimon was asking: where do you assign the “animations” variable?

I thought

animation = new Animation(true);//runR

is ‘assigning’ the ‘variable’?

animations

This is why it is not a good idea to have two variables so closely spelled :wink:

O_O
loool i’m blind ><

Hehehe…so was “animations” null?

yes >>

i just plain forgot… that it needed to be initiated.

yeah call it animationList or allAnimations or something =P

Teehee :slight_smile: