let x;
let y;
let dino;
function preload() {
dino = loadImage('dino.png');
}
function setup() {
createCanvas(400, 400);
x = width/2;
y = height/2;
}
function draw() {
background(248);
line(0,height/2, width, height/2);
//circle(width/2, y, 10);
image(dino, width/2, y-30, 30,30);
strokeWeight(3);
line(x, height/2, x, height/2-20);
strokeWeight(1);
x--;
y++;
if(x<0) {
x = width;
}
if(y>=height/2) {
y = height/2;
}
if(x == width/2 && y == height/2) {
//background(255, 0, 0);
noLoop();
text('Game Over!', width/2-100, height/2-100);
}
}
function keyPressed() {
if(key == 'a' && y == height/2) {
y-=150;
}
}