JS_Projects/dinosaurrGame/sketch.js
Dawid Pietrykowski 25a12f221e Initial commit
2022-11-09 23:34:49 +01:00

32 lines
518 B
JavaScript
Executable File

let player;
let vk = '0';
function setup() {
createCanvas(1920, 880);
textSize(width / 6);
textAlign(CENTER, CENTER);
fill(220);
background(51);
player = new Dinosaur(250, 350, 50, 50);
}
function draw() {
clear();
background(51);
checkClick();
if (player.lost == false)
player.update(vk);
else
text('LOST',width/2,height/4);
player.show();
}
function checkClick() {
vk = null;
if (keyIsDown(UP_ARROW)) {
vk = '1';
} else if (keyIsDown(DOWN_ARROW)) {
vk = '0';
}
}