--保存点
function SavePoint()
    PRI()
    MS4("\nSave the game?")YNJ()
    if(YES()) then
        AMC("set_levelreset_pos")--保存重置关卡的坐标
        SAV()CLR()
        CAT("\nGame saved")NOD()
    end
end
--保存点（水下）
function SavePointWater()
    PRI()
    MS4("\nSave the game?")YNJ()
    if(YES()) then
        KEY()
        ANP("saved")--设置保存动画
        AMC("set_levelreset_pos")--保存重置关卡的坐标
        SAV()
    end
end
--保存点Beta
function SavePointBeta()
    PRI()
    MS4("\nSave the game?")YNJ()
    if(YES()) then
        SOU("CS_Beta_savec")
        AMC("set_levelreset_pos")--保存重置关卡的坐标
        SAV()CLR()
        CAT("\nGame saved")NOD()
    end
end
--生命恢复点
function HealthRefill()
    PRI()
    LIP(1000)
    SOU("CS_020_health_refill")
    MS4("\nHealth has been restored.")NOD()
end
--经验吸收机
function ExpToHealth()
    PRI()
    MS4("\nClear experience to restore health?")YNJ()
    if(YES()) then
        ZAM(PLY())
        LIP(1000,PLY())
        SOU("CS_020_health_refill")
        CLR()
        MS4("\nHealth has been restored.")NOD()
    end
end
--关卡重置机
function LevelReset()
    PRI()
    MS4("Reset the level?")YNJ()
    if(YES()) then
        FAO(2)
        KEY()
        MOV(PLY())--将其他玩家带到身边
        RST("enemy","spike","trap","resetlevel_delete")--重新生成含有这些名称的实体
        AMC("set_levelreset_pos")--保存重置关卡的坐标
        WAI(16)
        PRI()
        FAI(0)
    end
end
--关卡重置机（技能）
function LevelReset_Skill()
    PRI()
    MS4("Reset the level?")YNJ()
    if(YES()) then
        FAO(2)
        KEY()
        AMC("move_levelreset_pos")--回到最后一次的坐标位置
        RST("enemy","spike","trap","resetlevel_delete")--重新生成含有这些名称的实体
        WAI(16)
        PRI()
        FAI(0)
    end
end
--床
function Bed()
    KEY()
    MS4("\nRest?")YNJ()
    if(YES()) then
        FAO(4)CMU("XXXX")WAI(20)CLR()
        MS4("\n...")NOD()CLO()
        WAI(50)
        LIP(1000)
        SOU("CS_020_health_refill")
        AMC(0,1,PLY())
        MS4("\nHealth has been restored.")NOD()CLO()
        RMU()FAI(4)
    end
end

function Died()
    CMU("XXXX")WAI(30)PRI()WAI(60)CMU("CS_Gameover",0.5)WAI(15)
    MS4("You died.\n")
    CAT("Try again?")YNJ()
    if(YES()) then
        INI()
    else
        ESC()
    end
end

function Drown()
    PRI()WAI(60)CMU("CS_Gameover",0.5)WAI(15)
    MS4("You drowned.\n")
    CAT("Try again?")YNJ()
    if(YES()) then
        INI()
    else
        ESC()
    end
end

function FallOutOfMap()
    KEY()CMU("XXXX")WAI(40)
    PRI()WAI(40)CMU("CS_Gameover",0.5)
    HMC(PLY())MS4("\nYou disappeared forever...")NOD()CLR()
    CAT("Please try again.")YNJ()
    if(YES()) then
        INI()
    else
        ESC()
    end
end

function DeathByMovingPlatform()
    KEY()WAI(30)PRI()WAI(60)CMU("CS_Gameover",0.5)WAI(15)
    MS4("You were crushed.\n")
    CAT("Try again?")YNJ()
    if(YES()) then
        INI()
    else
        ESC()
    end
end

STA("CS_pe_smoke",4,"CS_012_block_destroy")--设置星星砖破坏效果
dofile(global_path.."CS_item.lua")
dofile(global_path.."CS_mission.lua")
dofile(global_path.."CS_skill.lua")

MSS(2)