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

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

    addToViewPort(){
        var that = this;
        super.addToViewPort();
        that.setBody("d85a42ff-ce8e-47d1-adbe-db327d575dd6");
        that.hitW = 95;
        that.hitH = 50;
        that.health = 10;
        that.speedVector.y = 1;
        that.speedY = 3;
        that.speedX = 3;
        that.y = -80;
        that.x = Math.floor(Math.random()*Ins.stageW*2/4+Ins.stageW/4);
        if(that.x >=Ins.stageW/2){
            that.speedVector.x = -1;
        }else{
            that.speedVector.x = 1;
        }
        that.enemyType = enemyType.normal;
    }

    updateSelf(){
        var that = this;
        super.updateSelf();
        if((that.x+that.bodyImg.width)>=Ins.stageW||(that.x)<=0){
            that.speedVector.x = -that.speedVector.x;
        }
    }
}