Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int x, xVelocity, y, yVelocity;
- void setup(){
- size(640,480);
- x = width/2;
- y = height/2;
- xVelocity = 0;
- yVelocity = 0;
- }
- void draw(){
- background(0);
- ellipse(x, y, 20, 20);
- if( millis() <= 2000 ) xVelocity = 2;
- else if( millis() <= 4000 ){
- xVelocity = 0;
- yVelocity = 2;
- }
- else if( millis() <= 6000 ){
- xVelocity = -2;
- yVelocity = 0;
- }
- else if( millis() <= 8000 ){
- xVelocity = 0;
- yVelocity = -2;
- }
- else noLoop();
- x += xVelocity;
- y += yVelocity;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement