Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int recX = 270;
- int recY= 480;
- int eliX=0;
- int eliDir=0;
- int recDir = 0;
- void setup(){
- size(270*4,480*4);
- }
- void draw(){
- if(eliDir==0){
- eliX+=3*4;
- }else{
- eliX-=3*4;}
- if(eliX>270*4){
- eliDir=1;
- }
- if(eliX<0){
- eliDir=0;}
- background(0);
- fill(50);
- rect(recX,recY,50*4,50*4);
- fill(255);
- ellipse(eliX,240,50*4,50*4);
- if(recDir==0){
- recX-=3*4;
- recY-=5*4;
- }else{
- recX+=3*4;
- recY+=5*4;
- }
- if(recX<0){
- recDir=1;
- }
- if(recX>270*4){
- recDir=0;}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement