xxxxxxxxxx
//Global Variable Space
var angle;
var angle2;
var angle3;
var carbody;
var carwindow;
var backwheel;
var frontwheel;
function setup() {
createCanvas(400, 400);
//MODE
angleMode(DEGREES);
//Variables
angle=200;
angle2=2;
angle3=4
carbody=120
carwindow=190
backwheel=140
frontwheel=225
}
function draw() {
background(120,70,100);
if (keyIsPressed) {
carbody+=3;
carwindow+=3;
backwheel+=3;
frontwheel+=3;
}
// sun
push();
translate(220,220);
rotate(angle);
angle+=.8
fill(255,204,0);
ellipse(90,80,149,149)
pop();
//road and road color
fill(35);
rect(0,300,400,300);
//for the yellow lines, lowkey this is where i snapped
fill(255,204,0);
rect(1,350,40,4);
rect(75,350,40,4);
rect(150,350,40,4);
rect(225,350,40,4);
rect(300,350,40,4);
rect(375,350,40,4);
//car body
fill('magenta');
rect(carbody,360,120,-70);
fill(45);
//car wheels
ellipse(frontwheel,370,30,30);
ellipse(backwheel,370,30,30);
//car window
rect(carwindow,300,50,30);
fill(100,51,0);
if(carbody>400){
carbody=20;
}
if(carwindow>400){
carwindow=20
}
if(frontwheel>400){
frontwheel=20
}
if(backwheel>400){
backwheel=20
}
//the tree
rect(301,200,-30,100);
fill(61);
//the lil thing in the tree
ellipse(285,255,25,25);
fill(0,255,0);
//girl idk how to make a palm tree
beginShape(TRIANGLES);
vertex(330,240);
vertex(300,200);
vertex(260,200);
endShape();
//Text
textSize(30);
fill(0);
text('L.A. Hallucinations',90,20);
// // star One square 1
// push();
// fill(0)
// rectMode(CENTER);
// translate(200,200);
// rotate(angle);
// angle++
// rect(0,0,7,7);
// pop();
// //star Two square 2
// push();
// fill(0);
// rectMode(CENTER);
// translate(200,200);
// rotate(angle);
// angle-
// rect(0,0,7,7)
// pop();
}