import { Ins } from "../../Ins";
import { BaseEnemy, enemyType } from "./BaseEnemy";

export class Rotary extends BaseEnemy{
    constructor(){
        super();
    }

    addToViewPort(){
        var that = this;
        super.addToViewPort();
        that.setBody("6f6f35e6-f0ad-4431-82df-abd19d6f69a2");
        that.bodyImg.anchorX = that.bodyImg.width*0.5;
        that.bodyImg.anchorY = that.bodyImg.height*0.5;
        that.hitW = 50;
        that.hitH = 50;
        that.health = 10;
        that.speedVector.y = 1;
        that.speedY = 3;
        that.y = -50;
        that.x = Math.floor(Math.random()*Ins.stageW/4*2+Ins.stageW/4);
        that.enemyType = enemyType.normal;
    }

    updateSelf(){
        this.bodyImg.rotation += 5;
        super.updateSelf();
        this.worldTime++;
        if(this.worldTime%70 == 0){
            this.worldTime = 0;
            this.createFourSideShot();
        }
    }
}