Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portal 2 #35

Open
The-Space-Core opened this issue Feb 3, 2016 · 7 comments
Open

Portal 2 #35

The-Space-Core opened this issue Feb 3, 2016 · 7 comments

Comments

@The-Space-Core
Copy link

The fan club.

@The-Space-Core
Copy link
Author

Mover ball;
PVector wind = new PVector(0.02,0);
PVector gravity = new PVector(0,0,10);
void setup(){
size(400,400);
ball = new Mover();
}

void draw(){
background(0);
ball.update();
ball.display();
ball.checkEdges();
ball.applyForce(gravity);

if(mousePressed){
ball.applyForce(wind);
}
}

@The-Space-Core
Copy link
Author

class Mover{
PVector location;
PVector velocity;
PVector acceleration;

Mover(){
location = new PVector(random(width),random(height));
velocity = new PVector(random(-2,2),random(-2,2));
acceleration = new PVector(0.001,-0.001);
c = color(random(50,100),random(150,250),random(150,250));
}

void display(){
stroke(0);
fill(150);
ellipse(location.x,location.y,20,20);
}

void update(){
velocity.add(acceleration);
location.add(velocity);
acceleration.mult(0);
}
void applyForce(PVector force){
acceleration.add(force);
}
void checkEdges(){
if(location.x > width){
location.x = 0;
} else if(location.x < 0){
location.x = width;
}

if(location.y > height){
  location.y = 0;
} else if(location.y < 0){
  location.y = height;
}

}
}

@Brandonsugar
Copy link

PVector wind = new PVector(0.02,0);
PVector gravity = new PVector(0,0.1);
void setup(){
  size(1000,800);
  ball = new Mover();
}

void draw(){
  background(0);
  ball.update();
  ball.display();
  ball.borders();
  ball.applyForce(gravity);

  if(mousePressed){
    ball.applyForce(wind);
  }
}```

@Brandonsugar
Copy link

  PVector location;
  PVector velocity;
  PVector acceleration;
  color c;

  Mover(){
    location = new PVector(random(width),random(height));
    velocity = new PVector(0,0);
    acceleration = new PVector(0,0);
  }

  void display(){
    strokeWeight(2);
    stroke(255);
    fill(c);
    ellipse(location.x,location.y,20,20);
  }
  void update(){
    velocity.add(acceleration);
    location.add(velocity);
    acceleration.mult(0);
  }

  void applyForce(PVector force){
    acceleration.add(force);
  }
  void borders(){
    if(location.x > width-10){
      velocity.x = velocity.x \* -0.98;
    } else if(location.x < 10){
      velocity.x = velocity.x \* -0.98;
    }
    if(location.y > height-10){
      velocity.y = velocity.y \* -0.98;
    } 
  }
}```

@The-Space-Core
Copy link
Author

Mr Chase please put class information on the internet so we can see it in case we forget and so that those who could not come to class on Wednesday. So they can catch up on what the missed.

@The-Space-Core
Copy link
Author

Were we supposed to make the wind change directions?

@chasestarr
Copy link
Member

Sorry for the wait @The-Space-Core , HW is posted here 💫

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants