Dino Game

This commit is contained in:
Ben
2018-07-16 11:18:23 +01:00
parent 57e091c134
commit 593c1ff51b
14 changed files with 346 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
class Cacti {
constructor() {
this.y = world.ground + 10;
this.x = 900;
this.width = 15;
this.height = 30;
}
update() {
this.x -= player.velocityX;
}
draw() {
ctx.fillStyle="#FFFFFF";
ctx.fillRect(this.x - 2, this.y, this.width + 4, this.height);
ctx.fillStyle="#000000";
ctx.fillRect(this.x, this.y, this.width, this.height);
}
}
class ThiccCacti {
constructor() {
this.y = world.ground ;
this.x = 900;
this.width = 30;
this.height = 40;
}
update() {
this.x -= player.velocityX;
}
draw() {
ctx.fillStyle="#FFFFFF";
ctx.fillRect(this.x - 2, this.y, this.width + 4, this.height);
ctx.fillStyle="#000000";
ctx.fillRect(this.x, this.y, this.width, this.height);
}
}