BlueGit

blue-star speeltuin

Files

speeltuin / src / minigame / frog / floorTileDestroyer.js

floorTileDestroyer.js

floorTileDestroyer.js 548 B Download Raw
1class FloorTileDestroyer extends GameObject{
2
3 timeOfDestroy = 0;
4 timer = 0;
5
6 constructor(x,y,sprite,layer, animationLength, destroyAfter)
7 {
8 super(x,y,sprite,layer);
9
10 this.renderer.setAnimation("destroy",0 , animationLength);
11
12 this.timeOfDestroy = this.renderer.cycle.cycleArray.length * animationLength;
13 }
14
15 update(deltaTime)
16 {
17 super.update(deltaTime);
18
19 this.timer += deltaTime;
20 if(this.timer > this.timeOfDestroy)
21 {
22 this.destroy();
23 }
24 }
25}