Difficulty finding NullPointerException
in
Programming Questions
•
5 months ago
Hey, I'm trying to write a simple processing game that involves several PShapes. I keep getting a NullPointerException, but can't seem to identify where it is. The full error I'm getting is:
- Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
- at processing.core.PApplet.runSketch(PApplet.java:9869)
- at processing.core.PApplet.main(PApplet.java:9678)
- Caused by: java.lang.NullPointerException
- at processing.core.PApplet.loadShape(PApplet.java:10788)
- at MakeYourOwnShake.<init>(MakeYourOwnShake.java:33)
- at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
- at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
- at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
- at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
- at java.lang.Class.newInstance0(Class.java:355)
- at java.lang.Class.newInstance(Class.java:308)
- at processing.core.PApplet.runSketch(PApplet.java:9867)
- ... 1 more
- boolean startPage = true,
- chooseChars = false,
- chooseScene = false,
- chooseNumber = false,
- reviewPage = false,
- danceyTime1 = false,
- danceyTime2 = false,
- pose1 = true;
- int selectedChars = 1,
- selectedScene = 1,
- selectedNumber = 1,
- dance1cycles = 0,
- dance2cycles = 0;
- //////////////////////////////////////////////////////////////////////////
- /****setup screens****/
- //main pieces
- PShape backgroundGradient = loadShape("backgroundGradient.svg");//
- PShape hostCat = loadShape("hostCat.svg");//
- PShape startScreenMessage = loadShape("startScreenMessage.svg");//
- PShape chooseCharsMessage = loadShape("chooseCharsMessage.svg");//
- PShape chooseSceneMessage = loadShape("chooseSceneMessage.svg");//
- PShape chooseNumberMessage = loadShape("chooseNumberMessage.svg");//
- PShape reviewMessage = loadShape("reviewMessage.svg");//
- //individual words
- PShape wordThree = loadShape("wordThree.svg");//
- PShape wordFive = loadShape("wordFive.svg");//
- PShape wordSix = loadShape("wordSix.svg");//
- PShape wordEight = loadShape("wordEight.svg");//
- PShape wordTen = loadShape("wordTen.svg");//
- PShape wordFifteen = loadShape("wordFifteen.svg");//
- PShape wordLitterBox = loadShape("wordLitterBox.svg");//
- PShape wordRoof = loadShape("wordRoof.svg");//
- PShape wordCardboardBox = loadShape("wordCardboardBox.svg");//
- PShape wordCatBed = loadShape("wordCatBed.svg");//
- PShape wordByFood = loadShape("wordByFood.svg");//
- PShape wordCouch = loadShape("wordCouch.svg");//
- PShape wordCats = loadShape("wordCats.svg");//
- PShape wordBlackCats = loadShape("wordBlackCats.svg");//
- PShape wordHumans = loadShape("wordHumans.svg");//
- PShape wordMice = loadShape("wordMice.svg");//
- PShape wordKittens = loadShape("wordKittens.svg");//
- PShape wordBrownBags = loadShape("wordBrownBags.svg");//
- /****background scenes****/
- PShape litterBoxScene = loadShape("litterBoxScene.svg");//
- PShape roofScene = loadShape("roofScene.svg");//
- PShape cardboardBoxScene = loadShape("cardboardBoxScene.svg");//
- PShape catBedScene = loadShape("catBedScene.svg");//
- PShape byFoodScene = loadShape("byFoodScene.svg");//
- PShape couchScene = loadShape("couchScene.svg");//
- /**** character shapes ****/
- //bags
- PShape bag1pose1 = loadShape("bag1pose1.svg");//
- PShape bag1pose2 = loadShape("bag1pose2.svg");//
- PShape bag1pose3 = loadShape("bag1pose3.svg");//
- PShape bag1pose4 = loadShape("bag1pose4.svg");//
- PShape bag1pose5 = loadShape("bag1pose5.svg");//
- PShape bag1pose6 = loadShape("bag1pose6.svg");//
- PShape bag2pose1 = loadShape("bag2pose1.svg");//
- PShape bag2pose2 = loadShape("bag2pose2.svg");//
- PShape bag2pose3 = loadShape("bag2pose3.svg");//
- PShape bag2pose4 = loadShape("bag2pose4.svg");//
- PShape bag2pose5 = loadShape("bag2pose5.svg");//
- PShape bag2pose6 = loadShape("bag2pose6.svg");//
- //humans
- PShape human1pose1 = loadShape("human1pose1.svg");//
- PShape human1pose2 = loadShape("human1pose2.svg");//
- PShape human2pose1 = loadShape("human2pose1.svg");//
- PShape human2pose2 = loadShape("human2pose2.svg");//
- PShape human3pose1 = loadShape("human3pose1.svg");//
- PShape human3pose2 = loadShape("human3pose2.svg");//
- PShape human4pose1 = loadShape("human4pose1.svg");//
- PShape human4pose2 = loadShape("human4pose2.svg");//
- PShape human5pose1 = loadShape("human5pose1.svg");//
- PShape human5pose2 = loadShape("human5pose2.svg");//
- PShape human6pose1 = loadShape("human6pose1.svg");//
- PShape human6pose2 = loadShape("human6pose2.svg");//
- //mice
- PShape mouse1pose1 = loadShape("mouse1pose1.svg");//
- PShape mouse1pose2 = loadShape("mouse1pose2.svg");//
- PShape mouse2pose1 = loadShape("mouse2pose1.svg");//
- PShape mouse2pose2 = loadShape("mouse2pose2.svg");//
- PShape mouse3pose1 = loadShape("mouse3pose1.svg");//
- PShape mouse3pose2 = loadShape("mouse3pose2.svg");//
- PShape mouse4pose1 = loadShape("mouse4pose1.svg");//
- PShape mouse4pose2 = loadShape("mouse4pose2.svg");//
- PShape mouse5pose1 = loadShape("mouse5pose1.svg");//
- PShape mouse5pose2 = loadShape("mouse5pose2.svg");//
- //plain cats
- PShape cat1pose1 = loadShape("cat1pose1.svg");//
- PShape cat1pose2 = loadShape("cat1pose2.svg");//
- PShape cat2pose1 = loadShape("cat2pose1.svg");//
- PShape cat2pose2 = loadShape("cat2pose2.svg");//
- PShape cat3pose1 = loadShape("cat3pose1.svg");//
- PShape cat3pose2 = loadShape("cat3pose2.svg");//
- PShape cat4pose1 = loadShape("cat4pose1.svg");//
- PShape cat4pose2 = loadShape("cat4pose2.svg");//
- PShape cat5pose1 = loadShape("cat5pose1.svg");//
- PShape cat5pose2 = loadShape("cat5pose2.svg");//
- PShape cat6pose1 = loadShape("cat6pose1.svg");//
- PShape cat6pose2 = loadShape("cat6pose2.svg");//
- PShape cat7pose1 = loadShape("cat7pose1.svg");//
- PShape cat7pose2 = loadShape("cat7pose2.svg");//
- PShape cat8pose1 = loadShape("cat8pose1.svg");//
- PShape cat8pose2 = loadShape("cat8pose2.svg");//
- PShape cat9pose1 = loadShape("cat9pose1.svg");//
- PShape cat9pose2 = loadShape("cat9pose2.svg");//
- PShape cat10pose1 = loadShape("cat10pose1.svg");//
- PShape cat10pose2 = loadShape("cat10pose2.svg");//
- //black cats
- PShape bcat1pose1 = loadShape("bcat1pose1.svg");//
- PShape bcat1pose2 = loadShape("bcat1pose2.svg");//
- PShape bcat2pose1 = loadShape("bcat2pose1.svg");//
- PShape bcat2pose2 = loadShape("bcat2pose2.svg");//
- PShape bcat3pose1 = loadShape("bcat3pose1.svg");//
- PShape bcat3pose2 = loadShape("bcat3pose2.svg");//
- PShape bcat4pose1 = loadShape("bcat4pose1.svg");//
- PShape bcat4pose2 = loadShape("bcat4pose2.svg");//
- PShape bcat5pose1 = loadShape("bcat5pose1.svg");//
- PShape bcat5pose2 = loadShape("bcat5pose2.svg");//
- PShape bcat6pose1 = loadShape("bcat6pose1.svg");//
- PShape bcat6pose2 = loadShape("bcat6pose2.svg");//
- PShape bcat7pose1 = loadShape("bcat7pose1.svg");//
- PShape bcat7pose2 = loadShape("bcat7pose2.svg");//
- PShape bcat8pose1 = loadShape("bcat8pose1.svg");//
- PShape bcat8pose2 = loadShape("bcat8pose2.svg");//
- PShape bcat9pose1 = loadShape("bcat9pose1.svg");//
- PShape bcat9pose2 = loadShape("bcat9pose2.svg");//
- PShape bcat10pose1 = loadShape("bcat10pose1.svg");//
- PShape bcat10pose2 = loadShape("bcat10pose2.svg");//
- //kittens
- PShape kit1pose1 = loadShape("kit1pose1.svg");//
- PShape kit1pose2 = loadShape("kit1pose2.svg");//
- PShape kit2pose1 = loadShape("kit2pose1.svg");//
- PShape kit2pose2 = loadShape("kit2pose2.svg");//
- PShape kit3pose1 = loadShape("kit3pose1.svg");//
- PShape kit3pose2 = loadShape("kit3pose2.svg");//
- PShape kit4pose1 = loadShape("kit4pose1.svg");//
- PShape kit4pose2 = loadShape("kit4pose2.svg");//
- PShape kit5pose1 = loadShape("kit5pose1.svg");//
- PShape kit5pose2 = loadShape("kit5pose2.svg");//
- PShape kit6pose1 = loadShape("kit6pose1.svg");//
- PShape kit6pose2 = loadShape("kit6pose2.svg");//
- //////////////////////////////////////////////////////////////////////////
- void setup() {
- size(800,600);
- background(255);
- smooth();
- }
- void draw(){
- while(startPage){
- //draw backgroundGradient from (0,0), full width, full height
- //shape(backgroundGradient,0,0,width,height);
- //draw hostCat
- //draw startScreenMessage
- if(mousePressed){
- startPage = false;
- chooseChars = true;
- }
- }//end startPage
- }//end draw()
1