Animated coin

This commit is contained in:
Thomas Forgione
2018-08-26 21:55:38 +02:00
parent c842f07b95
commit 03c9a31d17
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ class Collectable {
this.collected = false;
this.frameNumber = 0;
this.maxFrame = 0;
this.maxFrame = 14;
}
update(time = 0.02) {
+2 -2
View File
@@ -236,7 +236,7 @@ class Scene extends Screen {
this.context.drawImage(
Collectable.texture,
0, 64 * object.frameNumber, 64, 64,
0, 32 * object.frameNumber, 32, 32,
(object.x - object.size / 2) * this.width(),
(1 - object.y) * this.height() - size / 2,
size, size
@@ -306,7 +306,7 @@ class Scene extends Screen {
// Draw coin number
this.context.drawImage(Collectable.texture,
0, 0, 64, 64,
0, 0, 32, 32,
0, fontSize + 5, 0.05 * this.width(), 0.05 * this.width());
this.context.fillText(this.collectableNumber, 0.05 * this.width() + 5, 2 * fontSize)