Issue in processing

After pressing run, it loads up all of the console prinln methods but, it never loads the run window of the sketch. any help would be greatly appreciated. I have a large project due tuesday so i need to fix this fast!

Answers

  • Maybe some code would help. Do you get an error message?

  • PImage map, title;
    int gamemode=0;
    int dotType=0;
    int totalDots;
    int dotsEaten=0;
    int i=0;
    
    map loadmap=new map();
    newGame game=new newGame(0, 0);
    write wr=new write(0);
    ArrayList<Pacdot> pacdots;
    
    void setup() {
      size(displayWidth, displayHeight);
      gamemode=1; //gamemode is started
      pacdots=new ArrayList<Pacdot>();
      for (float y=height/15.42857142857143; y<height/1.053658536585366; y+=25) {
        float x=width/24;
        pacdots.add(new Pacdot(x, y));
        println(x);
      }
      for (float x=width/24; x<width/6.4; x+=25) {
        float y=height/15.42857142857143;
        pacdots.add(new Pacdot(x, y));
      }
      for (float x=width/24; x<width/6.4; x+=25) {
        float y=height/1.058823529411765;
        pacdots.add(new Pacdot(x, y));
      }
      for (float y=height/1.317073170731707; y<height/1.064039408866995; y-=25) {
        float x=width/6.857142857142857;
        pacdots.add(new Pacdot(x, y));
        println(height/1.309090909090909);
      }
    }
    
    void draw() {
      game.display();
      loadmap.loadMap();
      gamemode();
      for (int i=0; i<pacdots.size (); i++)
        pacdots.get(i).display();
      if (mousePressed==true) {
        println(mouseX+","+mouseY);
        //println(width+","+height);
      }
    }
    
    void keyPressed() {
      if (key==' '&&gamemode==1) {
        gamemode=2;//gamemode map is started
        println(gamemode);
      }
      if (key=='a'&&gamemode==2) {
        gamemode=3;
        println(gamemode);
      }
    }
    this is a little bit, it is a pacman game
    
  • it is also using a lot of my cpu...

  • What exactly happens when you try to run the sketch? Do you get a window at all? Is there a point where the console messages stop (that you can see in your sketch)? What is the last message you get? Is anything displayed? Do any of your constructors of your classes use Processing variables like width and height?

  • can you download a file from the internet? I will screenshare it with obs and upload to a file sharing website and share the link.

  • size(400,400); rect(0,0,200,200); runs but my sketch does not

  • I will upload all of my code down below and you can run it.

  • edited June 2015
    PImage map, title;
    int gamemode=0;
    int dotType=0;
    int totalDots;
    int dotsEaten=0;
    int i=0;
    
    map loadmap=new map();
    newGame game=new newGame(0, 0);
    write wr=new write(0);
    ArrayList<Pacdot> pacdots;
    
    void setup() {
      size(displayWidth, displayHeight);
      gamemode=1; //gamemode is started
      pacdots=new ArrayList<Pacdot>();
      for (float y=height/15.42857142857143; y<height/1.053658536585366; y+=25) {
        float x=width/24;
        pacdots.add(new Pacdot(x, y));
        println(x);
      }
      for (float x=width/24; x<width/6.4; x+=25) {
        float y=height/15.42857142857143;
        pacdots.add(new Pacdot(x, y));
      }
      for (float x=width/24; x<width/6.4; x+=25) {
        float y=height/1.058823529411765;
        pacdots.add(new Pacdot(x, y));
      }
      for (float y=height/1.317073170731707; y<height/1.064039408866995; y-=25) {
        float x=width/6.857142857142857;
        pacdots.add(new Pacdot(x, y));
        println(height/1.309090909090909);
      }
    }
    
    void draw() {
      game.display();
      loadmap.loadMap();
      gamemode();
      for (int i=0; i<pacdots.size (); i++)
        pacdots.get(i).display();
      if (mousePressed==true) {
        println(mouseX+","+mouseY);
        //println(width+","+height);
      }
    }
    
    void keyPressed() {
      if (key==' '&&gamemode==1) {
        gamemode=2;//gamemode map is started
        println(gamemode);
      }
      if (key=='a'&&gamemode==2) {
        gamemode=3;
        println(gamemode);
      }
    }
    

    main file

  • edited June 2015

    i looked and it is something wrong with this for loop ![]( for (float y=height/1.317073170731707; y<height/1.064039408866995; y-=25) { float x=width/6.857142857142857; pacdots.add(new Pacdot(x, y)); println(height/1.309090909090909); }) can you tell me what it is? thanks

  • Not without the pacdot class code.

  • edited June 2015

    here it is

    public class Pacdot {
      float x, y;
      public Pacdot(float xpos, float ypos) {
        x=xpos;
        y=ypos;
      }
      void display() {
        if (gamemode==3) {
          fill(255);
          ellipseMode(CENTER);
          ellipse(x, y, 15, 15);
        }
      }
    }
    
  • There doesn't appear to be anything wrong with it. Does it do something different from what you expected?

  • no, it does the error that i talked about

  • What error? Does it cause the sketch not running?

  • edited June 2015 Answer ✓

    Line 30 is decreasing y. It might be that it never satisfies the condition. Add a line that prints out y

  • thanks I fixed it

Sign In or Register to comment.