Wednesday, July 10, 2013

Day 10

Another example using arrays and the start of object-oriented programming. The video:

7-10-2013 11-09-25 from Albert Schueller on Vimeo.

2 comments:

  1. Hi, is it a big mistake if I move all global variables and initialize them first, above the setup function? Like this:

    int numStars =100;
    float maxRadius = 2;
    int k = 0;

    float[] StarfieldX = new float[numStars];
    float[] StarfieldY = new float[numStars];
    float[] StarfieldR = new float[numStars];

    ReplyDelete
    Replies
    1. It's fine. I would only add that it's good practice to try to limit the scope of all variables when programming. In other words, don't make a variable global unless it's used in several different functions e.g. setup and draw.

      Delete