Last active
August 5, 2020 11:48
-
-
Save mackdroid/d2f4f6c865329bc808b26b44a7dad617 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() { | |
createCanvas(400, 400); | |
speedx = random(0,10); | |
speedy = random(0,10); | |
g = 0.5; | |
xpos = 200;ypos= 200; | |
pos = createVector(xpos,ypos); | |
damping_factor = 0.75; | |
terminalvel = 30; | |
background(42); | |
} | |
function draw() { | |
background(42,42,42,50); | |
pos.x += speedx; | |
pos.y += speedy; | |
speedy += g; | |
stroke(0); | |
ellipse(pos.x,pos.y,25); | |
if(pos.y >= 400-25/2 || pos.y <= 0+25/2){ | |
speedy*= -1; | |
} | |
if(pos.x >= 400-25/2 || pos.x <= 0+25/2){ | |
speedx*= -1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment