let _Ending_Img高さ = 0;
let _Ending_ImgTime = 2 *  60 * 60; 
let _Ending_Start_flame = 120; 
let _Ending_flame = 0;
let _Ending_Zuref = 0;
let _EndStartFlg = false;
let _Ending_BgmOffFlg = false;
let _EndingCheckFlg = false; 
let _endingFlame = 0;
Game_Interpreter.prototype.N_Ending_Draw = function () {
    EasingStr = "";
    _Ending_flame = 0;
    this.SetSprite(PN_EdBack , "PN_EdBack" , 0 , 0); 
    this.SetSpriteFIn(PN_EdStaff, "PN_Staff", 0, 0, 0, 0, _Ending_Start_flame);
    _EndStartFlg = true;
    _Ending_BgmOffFlg = false;
    _EndingCheckFlg = true;
    _endingFlame = 0;
}
let N_Ending_Update_control = false;
let N_Ending_Update_ok = false;
Game_Interpreter.prototype.N_Ending_Update = function () {
    if (!_EndStartFlg) {
        _endingFlame++;
        if (TouchInput.isTriggered() || Input.isTriggered('control') || Input.isTriggered('ok')) {
            let ckSprite = GetSpriteData(PN_EdStaff);
            let ckPar =  -ckSprite._y / (_Ending_Img高さ - 810);
            this.MoveSprite(PN_EdStaff, 0, -_Ending_Img高さ + 810, (_Ending_ImgTime) / 8 * (1 - ckPar));
        }
        let controlReleased = N_Ending_Update_control && !Input.isPressed("control")
        N_Ending_Update_control = Input.isPressed("control");
        let okReleased = N_Ending_Update_ok && !Input.isPressed("ok")
        N_Ending_Update_ok = Input.isPressed("ok");
        if (TouchInput.isReleased() || controlReleased || okReleased) {
            let ckSprite = GetSpriteData(PN_EdStaff);
            let ckPar =  -ckSprite._y / (_Ending_Img高さ - 810);
            this.MoveSprite(PN_EdStaff, 0, -_Ending_Img高さ + 810, (_Ending_ImgTime) * (1 - ckPar));
        }
    }
    if (GetSpriteData(PN_EdStaff).alpha == 1 && _EndStartFlg) {
        _Ending_Img高さ = GetSpriteData(PN_EdStaff).height;
        this.MoveSprite(PN_EdStaff, 0, -_Ending_Img高さ + 810, _Ending_ImgTime);
        _EndStartFlg = false;
    }
    let ckLange = GetSpriteData(PN_EdStaff)._y - (-_Ending_Img高さ + 810);
    if (Math.abs(ckLange) <= 10 || _endingFlame > _Ending_ImgTime) {
        if (!_Ending_BgmOffFlg) {
            _Ending_BgmOffFlg = true;
        }
        if (TouchInput.isTriggered() || Input.isTriggered('ok')) {
            this.MoveSprite(PN_EdStaff, true, true, 60, 0);
            return false;
        }
        return true;
    }
    _Ending_flame++;
    return true; 
}
Game_Interpreter.prototype.N_Ending_End = function (_flame) {
    _flame = typeof _flame !== 'undefined' ? _flame : 60;
    //this.MoveSprite(PN_EdBack , true , true , _flame , 0);
}
