Animated coin
This commit is contained in:
parent
c842f07b95
commit
03c9a31d17
|
@ -6,7 +6,7 @@ class Collectable {
|
|||
this.collected = false;
|
||||
|
||||
this.frameNumber = 0;
|
||||
this.maxFrame = 0;
|
||||
this.maxFrame = 14;
|
||||
}
|
||||
|
||||
update(time = 0.02) {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue