xxxxxxxxxx
93
var rot = 0;
var x = 250;
var y = 300;
var changeX = 1;
var changeY = 0;
let r = 520;
let a = 400;
function setup() {
createCanvas(600, 500);
background(0);
fill(255);
stroke (255);
}
function draw() {
textSize(15);
text ("HOLD UP, LEFT, OR RIGHT ARROWS",150,30);
background(0,0,0,10);
if (keyIsDown(LEFT_ARROW)) {
x -= 5;
if (x < 0){
x = 580;
}
}
if (keyIsDown(RIGHT_ARROW)) {
x += 5;
if (x > 580){
x = 0;
}
}
if (keyIsDown(UP_ARROW)) {
x = x + changeX;
y = y + changeY;
changeY = changeY + 0.4;
if (y < 200){
fill ("green");
stroke ("green");
if (y < 100){
fill ("blue");
stroke ("blue");
if (y < 25){
fill ("black");
stroke ("darkBlue");
}
}
}
if (y > 200){
fill ("white");
stroke ("white");
}
if (y > 300){
fill ("red");
stroke ("red");
}
if (y > 400){
fill ("black");
stroke ("darkRed");
}
if (keyIsDown(LEFT_ARROW)) {
changeX = -1;
}
if (keyIsDown(RIGHT_ARROW)) {
changeX = 1;
}
}
rect(x, y, 30, 30);
rect(r,height-150,80,15);
//ellipse(x-100, y-100, 30, 30);
//ellipse(x+100, y-100, 30, 30);
//ellipse (x-100, y+100,30,30);
//ellipse (x+100, y+100,30,30);
if (x > 580){
changeX = -1;
}
if (x < 0){
changeX = 1;
}
if(y > 480){
changeY = -changeY;
}
if(y < 0){
changeY = 1;
}
}