Loading...
Logo
Processing Forum
pegleg100's Profile
3 Posts
7 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
    Hi,

    I have loaded a table, and table updates with a new top score when I play the game, but it wont save.

    Below is my for the top score code:

    Table scoretable;
    void setup() {

     scoretable = loadTable("topscore2.csv", "header");

    }

    void draw() {

    if(gamescore>scoretable.getInt(0,"score")){
          scoretable.setInt(0, "score", gamescore);}
     saveTable(scoretable, "topscore2.csv");
    }

    Any ideas how I get the table to save so that when I close the app and re-open it, the top score is saved?

    I'm using android app

    Thanks

    Hi,

    I'm doing a beginner course on processing at the moment, and I cant for the life of me get the for loop to do what I want it to do!

    I'm building a simple game where boxes drop from the top the screen, and when they hit objects at the bottom, a sound is played.. sounds simple.. but I'm start at step 1

    I can get the boxed to drop using an Array, but I'm having to write a line of code to specify each array, every time I try a for loop, it doesn't work

    Can anyone show me how to convert the repetitive code into a loop correctly?

    When a box reaches 70 px, then next box is draw... I just want them to fall continuously (a bit like Tetris)

    Thanks!

    here is my code that work so far:



    PImage bg;
    int [] rectY;



    void setup() {
      size(720, 1280);

      // The background image must be the same size as the parameters
      // into the size() method. In this program, the size of the image
      // is 720 x 1280 pixels.
      bg = loadImage("LED2.jpg");
      
     rectY = new int [20];

    }

    void draw() {
      background(bg);
      
        rect(30, rectY[0],55, 55);
        rectY[0]++;
       
           if(rectY[0]>70){
          rect(30, rectY[1],55, 55);
           rectY[1]++;
          
          
        }
        
             if(rectY[1]>70){
          rect(30, rectY[2],55, 55);
           rectY[2]++;
          
          
        }
        
              if(rectY[2]>70){
          rect(30, rectY[3],55, 55);
           rectY[3]++;
          
          
        }
          

      
        }