export class TowerAnims {

    constructor(scene) {
        this.scene = scene;

        this.createAnims();
    }

    createAnims() {
        this.scene.anims.create({
            key: 'gunfire',
            frames: this.scene.anims.generateFrameNumbers('ammo', {
                start:0,
                end:2
            }),
            framerate: 15,
            repeat: -1
        });
        this.scene.anims.create({
            key: 'gun-level1-fire',
            frames: this.scene.anims.generateFrameNumbers('towers', { 
                start: 1, 
                end: 0, 
            }),
            frameRate: 15,
            repeat: -1,
        });
        this.scene.anims.create({
            key: 'gun-level2-fire',
            frames: this.scene.anims.generateFrameNumbers('towers', { 
                start: 3, 
                end: 2, 
            }),
            frameRate: 15,
            repeat: -1,
        });
        this.scene.anims.create({
            key: 'gun-level3-fire',
            frames: this.scene.anims.generateFrameNumbers('towers', { 
                start: 5, 
                end: 4, 
            }),
            frameRate: 15,
            repeat: -1,
            yoyo: true
        });
        this.scene.anims.create({
            key: 'cannon-level1-fire',
            frames: this.scene.anims.generateFrameNumbers('towers', {
                start: 11,
                end: 10
            }),
            frameRate: 5,
            repeat: 0
        });
        this.scene.anims.create({
            key: 'cannon-level2-fire',
            frames: this.scene.anims.generateFrameNumbers('towers', {
                start: 13,
                end: 12
            }),
            frameRate: 5,
            repeat: 0
        });
        this.scene.anims.create({
            key: 'cannon-level3-fire',
            frames: this.scene.anims.generateFrameNumbers('towers', {
                start: 15,
                end: 14
            }),
            frameRate: 5,
            repeat: 0
        });
        this.scene.anims.create({
            key: 'flamethrower',
            frames: this.scene.anims.generateFrameNumbers('towers', {
                start: 23,
                end:25
            }),
            framerate: 4,
            repeat: -1
        });
        this.scene.anims.create({
            key: 'icbmExplosion',
            frames: this.scene.anims.generateFrameNumbers('towers', {
                start: 34,
                end: 37,
                framerate: 4,
            }),
            framerate: 4,
            repeat: -1
        });
    }
}