please help me, im new with processing
i have been trying to create a grid with ball class but i don't know why it not working,
i think i got it right..
i think what i did wrong was not calling it out correctly, please help
moreover how can i connect the balls to form a grid?
and how do i prepare the ball class in to 3d realm? because i dont know how..
please help me thank you very much!!
here is my code
- import peasy.*;
- PeasyCam cam;
- // decade class ball is myBall
- Ball[] balls;
- int spacing = 10;
- void setup (){
- size(600,600,P3D);
- // noStroke ();
- // this is for the camera settings
- cam = new PeasyCam(this,450);
- cam.rotateX(PI*0.3);
- cam.rotateZ(PI*0.3);
- for (int i = spacing; i <height; i+= spacing){
- balls[i] = new Ball();
- }
- }
- void draw (){
- background (0);
- for (int i = spacing; i <height; i+= spacing){
- for (int j = spacing; j <width; j+= spacing){
- balls[i].display();
- }
- }
- }
- class Ball {
- float x;
- float y;
- float z;
- // float speed;
- void start (float xpos, float ypos) {
- x = xpos;
- y = ypos;
- // zpos = tempZpos;
- }
- void display() {
- ellipse(x, y, 10, 10);
- //// drawing the circles up each time the script runs
- }
- }
1