Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float x = 0;
- float d = 0.98;
- float move = 0;
- float y = 0;
- float ycons;
- float z = 0.98;
- void setup(){
- size(500, 500);
- ellipseMode(CENTER);
- }
- void draw() {
- background(0);
- rotat();
- bombdisp();
- bounce();
- }
- //if the y value changes, it makes stuff rotate in that form
- // put the rotat and y in one variable -- > then bounce!
- // pair rotat and display together, make the y
- void rotat() {
- translate(250,250);
- println(move);
- move += PI/200;
- rotate(PI + move);
- }
- void bounce() {
- y = y + d;
- d = d + z;
- // When it hits the ground, it "bounces" (changes trajectory)
- //println(d);
- if (y >= height) {
- d = -d;
- d = d + (2.857 * z);
- }
- }
- void bombdisp() {
- ycons = (int)constrain(y, 0.0, height);
- fill(0);
- ellipse(x, y, 30, 30);
- println(x);
- println(y);
- fill(100, 100, 5);
- stroke(255, 255, 0);
- strokeWeight(2);
- arc(x-10, y, 10, 10, 0.5, PI+0.5);
- arc(x+10, y, 10, 10 ,-0.5, PI-0.5);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement