public void hit(int damage){
        health -= damage;
        if(dx > 0){
            setImage("enemy_Sprites/goblin/gethitGobR.gif");
        }else{
            setImage("enemy_Sprites/goblin/gethitGobL.gif");
        }
        if(health <= 0){
            if(dx > 0){
                setImage("enemy_Sprites/goblin/deathGobR.gif");
            }else{
                setImage("enemy_Sprites/goblin/deathGobL.gif");
            }
            dead = true;
        }
        if(!dead){
            knockback = true;
            lock = true;
            new SwingWorker() {
                @Override protected Object doInBackground() throws Exception {
                    Thread.sleep(500);
                    return null;
                }
                @Override protected void done() {
                    knockback = false;
                    lock = false;
                }
            }.execute();
        }
    }