

    '***********************************************************
    '   Official website : www.atomose.fr                      '
    '   LibertyBasic 4.51 pro licence                          '
    '   Eternal Quest © (all copyrights reserved)              '
    '   By Alexandre Lomuto (Atomose Studio) - 2026            '
    '***********************************************************

     nomainwin
     build$ = "2.94.3"
     FinalBuild$ = "Alpha"

    loadbmp "atk1", "bmp\perso\animation\atk\atk1.bmp"
    loadbmp "atk2", "bmp\perso\animation\atk\atk2.bmp"
    loadbmp "add", "bmp\add.bmp"
    loadbmp "logo", "bmp\logo.bmp"

    [debut]
    WindowWidth = 1020 : WindowHeight = 600 : UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2)
    marchandQ2 = 2 : version = 1 : bruitage = 0 : music = 1 : sex = 1 : map = 0 : introGAME = 0 : MenuMode = 2 : FPSmonitor = 0 : rageMODE$ = "off" : saveMODE = 2 : lc = 10
    gosub [Prefrestor]

    if introGAME = 1 then goto [start2]
    introGAME = 1
    open "pref.ini" for output as #pref
    print #pref, introGAME
    print #pref, music
    print #pref, bruitage
    print #pref, version
    print #pref, rageMODE$
    print #pref, saveMODE
    close #pref

    graphicbox #logo.bmap, -5, -5, DisplayWidth+15, DisplayHeight+30
    open "" for window_nf as #logo
    #logo.bmap, "down; fill black"
    #logo.bmap, "drawbmp logo 490 50"
    #logo.bmap, "backcolor black; font Times New Roman 18; color white"
    #logo.bmap, "place 310 150 ;\"; "Une création de ATOMOSE STUDIO"
    #logo.bmap, "font Times New Roman 11"
    #logo.bmap, "place 300 240 ;\"; "Le jeu développé est inspiré d'un univers médievo-fantastique propre"
    #logo.bmap, "place 435 260 ;\"; "à Atomose Studio."
    #logo.bmap, "place 300 280 ;\"; "Bien qu'utilisant certaines images non libres de droits, ce jeu respect"
    #logo.bmap, "place 360 300 ;\"; "les auteurs et les utilise sauf demande de celui ci."
    #logo.bmap, "place 300 320 ;\"; "Tous les produits, audio et images présents dans ce jeu sont la propriété"
    #logo.bmap, "place 420 340 ;\"; "de leur marque respective."
    #logo.bmap, "place 340 380 ;\"; "Ce jeu est gratuit et n'a donc aucun but commercial."
    #logo.bmap, "font Times New Roman 12 bold"
    #logo.bmap, "place ";int(WindowWidth/2-80);" 500 ;\"; "Production 2011-2023"
    #logo, "trapclose [quitlogo]"
    timer 6000, [endLogo] : wait

    [Prefrestor]
    dir$ = "" : file$ = "pref.ini"
    if fileExist(dir$,file$) = 1 then
        open "pref.ini" for input as #pref
        input #pref, introGAME
        input #pref, music
        input #pref, bruitage
        input #pref, version
        input #pref, rageMODE$
        input #pref, saveMODE
        close #pref
    end if
    return

    [quitlogo]
    timer 0 : close #logo : end

    [endLogo]
    timer 0 : close #logo : goto [start2]
    [start]
    close #2b
    if bruitage = 0 then playwave "music\hit.wav", async
    [start2]
    timer 0

    loadbmp "fond", "bmp\fond1.bmp"
    WindowWidth = 1020 :WindowHeight = 600 : UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2)
    time1 = 0 : MonsterREGEN = 0 : load = 0 : gameD = 1 : questOp = 0 : questM = 0 : game$ = "off" : BackgroundColor$ = "black" : ForegroundColor$ = "white"
    game$ = "off" : map = 0 : mapSECUR = 0 : Qvoleur = 0 : quest1STATUT = 0

    graphicbox #2b.map, 0, 0, 1100, 630
    bmpbutton #2b.son1, "bmp\sonOff.bmp", [iniMUSIC2], LR, 940,500
    bmpbutton #2b.son2, "bmp\sonOn.bmp", [iniMUSIC], LR, 940,500
    open "" for window_nf as #2b
    #2b, "trapclose [quitSbis]"
    #2b.map, "down; fill black; setfocus; when leftButtonDown [SimpleClickStartINI]"
    #2b.map, "drawbmp fond 0 0"
    print #2b.map, "background fond"
    if music = 1 then print #2b.son1, "disable" : print #2b.son2, "enable"
    if music = 0 then print #2b.son2, "disable" : print #2b.son1, "enable"
    #2b.map, "font times_new_roman 24; backcolor black; color White"
    if version = 1 then #2b.map, "place 462 319 ;\"; "JOUER"
    if version = 2 then #2b.map, "place 470 319 ;\"; "PLAY"
    #2b.map, "font times_new_roman 8"
    if version = 1 then
       #2b.map, "place 292 340 ;\"; "Options"
       #2b.map, "place 363 340 ;\"; "Aide"
       #2b.map, "place 627 340 ;\"; "Charger"
       #2b.map, "place 695 340 ;\"; "Crédit"
    end if
    if version = 2 then
       #2b.map, "place 292 340 ;\"; "Options"
       #2b.map, "place 363 340 ;\"; "Help"
       #2b.map, "place 632 340 ;\"; "Load"
       #2b.map, "place 695 340 ;\"; "Credit"
    end if
    #2b.map, "font times_new_roman 9"
    #2b.map, "place 705 260 ;\"; build$
    print #2b.map, "flush"
    wait

    [SimpleClickStartINI]
    mX = MouseX : mY = MouseY
    if mX>420 and mX<590 and mY>290 and mY<330 then goto [button1Click]
    if mX>630 and mX<670 and mY>290 and mY<330 then goto [saveMain]
    if mX>290 and mX<330 and mY>290 and mY<330 then goto [system]
    if mX>360 and mX<400 and mY>290 and mY<330 then goto [aide]
    if mX>690 and mX<730 and mY>290 and mY<330 then goto [credit]
    wait

    [son]
    if music = 1 then print #2b.son1, "enable" : print #2b.son2, "disable" : music = 0 : wait
    if music = 0 then print #2b.son1, "disable" : print #2b.son2, "enable" : music = 1 : wait

    [credit]
    if credit=1 then close #credit
    credit=1
    if bruitage = 0 then playwave "music\hit.wav", async
    WindowWidth = 270:WindowHeight = 270
    UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2)
    BackgroundColor$ = "black" : ForegroundColor$ = "white"
    text1$ = "Lomuto Alexandre"
    text2$ = "universal-soundbank.com"
    text3$ = "Warcraft 3 classique"
    text3b$ = "RPG-MAKER"
    text6$ = "Machinimasound - Rallying The Defense"
    statictext #credit.1, "- Concepteur du jeu -", 73, 40, 200, 20
    statictext #credit.t1, text1$, 88, 60, 200, 20
    statictext #credit.2, "- Musiques -", 97, 100, 200, 20
    statictext #credit.t2, text6$, 40, 120, 200, 20
    statictext #credit.3, "- Graphismes -", 92, 160, 200, 20
    statictext #credit.t3, text3$, 88, 180, 200, 20
    statictext #credit.t3b, text3b$, 103, 200, 200, 20
    Open "" for window_nf As #credit
    #credit, "trapclose [Qcredit]"
    print #credit, "font times_new_roman 11"
    print #credit.t1, "!font times_new_roman 8"
    print #credit.t2, "!font times_new_roman 8"
    print #credit.t3, "!font times_new_roman 8"
    print #credit.t3b, "!font times_new_roman 8"
    wait
    [Qcredit]
    close #credit : credit = 0 : wait

'-----Systeme-------------------------------------------------------------------------------------------------------------------|

    [langueQUESTION]
    if version = 1 then notice " " + chr$(13) + "Vous permet de choisir la langue du jeu."
    if version = 2 then notice " " + chr$(13) + "This option give you the choice of language for the game."
    wait
    [musiqueQUESTION]
    if version = 1 then notice " " + chr$(13) + "Vous permet de garder la musique ambiante du jeu en marche ou de l'arrêter."
    if version = 2 then notice " " + chr$(13) + "This option give you the choice of take off the game's music or the take it on."
    wait
    [bruitageQUESTION]
    if version = 1 then notice " " + chr$(13) + "Gère les sons des boutons ou des actions des personnages dans le jeu."
    if version = 2 then notice " " + chr$(13) + "Manage songs of buttons or charachers's song actions into the game."
    wait
    [dialogueQUESTION]
    if version = 1 then notice " " + chr$(13) + "Activie ou désactive les dialogues dans le jeu."
    if version = 2 then notice " " + chr$(13) + "Enable or disable dialogues into the game."
    wait
    [rageQUESTION]
    if version = 1 then notice " " + chr$(13) + "Ce mode multiplie la force, la vie et la résistance de vos adversaires par 10 !"
    if version = 2 then notice " " + chr$(13) + "This option add to you ennemies 10 more time life, attack and armor !"
    wait
    [astucesQUESTION]
    if version = 1 then notice " " + chr$(13) + "Permet d'afficher ou de cacher certaines astuces dans le jeu qui peuvent apprendre aux nouveaux joueurs les bases du jeu."
    if version = 2 then notice " " + chr$(13) + "Displays or hide some tricks in the game that can teach new players the basics of the game."
    wait
    [animationsQUESTION]
    if version = 1 then notice " " + chr$(13) + "Active ou désactive les animations de certains personnages dans le jeu."
    if version = 2 then notice " " + chr$(13) + "Enable or disable the animations of some characters in the game."
    wait
    [saveQUESTION]
    if version = 1 then notice " " + chr$(13) + "La sauvegarde du jeu en mode 2 est une sauvegarde normale. Si vous mourrez, vous devrez recharger une partie enregistrée. Le Mode de sauvegarde 1 est réaliste, si vous mourrez votre personnage est définitivement effacé."
    if version = 2 then notice " " + chr$(13) + "Saving the mode 2 game is a normal backup. If you die, you must reload last saved game. The Backup Mode 1 is realistic, if you die your character is permanently deleted."
    wait
    [sizeQUESTION]
    if version = 1 then notice " " + chr$(13) + "Cette option vous permet de modifier la taille de la fenêtre afin de l'adapter au mieux à votre ordinateur."
    if version = 2 then notice " " + chr$(13) + "This option allows you to change the size of the window to best fit your computer."
    wait
    [fpsQUESTION]
    if version = 1 then notice " " + chr$(13) + "Cette option vous permet d'ajouter un moniteur en haut de la fenêtre afin de voir le nombre d'images/seconde générés dans le jeu."
    if version = 2 then notice " " + chr$(13) + "This option allows to have a FPS monitory and show you the number of picture my seconde into the game."
    wait

    [system]
    if system=1 then goto [system2]
    if system=2 then close #34
    [system2]
    system=2
    if bruitage = 0 then playwave "music\hit.wav", async
    WindowWidth = 270:WindowHeight = 170
    UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2)
    BackgroundColor$ = "white" : ForegroundColor$ = "black"

    checkbox #34.cb1, "Fr", [LangueFR], [LangueFR], 100, 10, 40, 20
    checkbox #34.cb2, "Eng", [LangueENG], [LangueENG], 160, 10, 50, 20
    button #34.c1, "?", [langueQUESTION], UL, 230, 10, 20, 17

    checkbox #34.cb3, "On", [musicOn], [musicOff], 100, 30, 40, 20
    checkbox #34.cb4, "Off", [musicOff], [musicOn], 160, 30, 40, 20
    button #34.c2, "?", [musiqueQUESTION], UL, 230, 30, 20, 17

    checkbox #34.cb5, "On", [bruitageOn], [bruitageOff], 100, 50, 40, 20
    checkbox #34.cb6, "Off", [bruitageOff], [bruitageOn], 160, 50, 40, 20
    button #34.c3, "?", [bruitageQUESTION], UL, 230, 50, 20, 17

    checkbox #34.cb9, "On", [rageOn], [rageOff], 100, 70, 40, 20
    checkbox #34.cb10, "Off", [rageOff], [rageOn], 160, 70, 40, 20
    button #34.c5, "?", [rageQUESTION], UL, 230, 70, 20, 17

    checkbox #34.cb15, "1", [saveMODE1], [saveMODE2], 100, 90, 40, 20
    checkbox #34.cb16, "2", [saveMODE2], [saveMODE1], 160, 90, 40, 20
    button #34.c8, "?", [saveQUESTION], UL, 230, 90, 20, 17

    checkbox #34.cb19, "On", [fpsMonitor1], [fpsMonitor2], 100, 110, 40, 20
    checkbox #34.cb20, "Off", [fpsMonitor2], [fpsMonitor1], 160, 110, 40, 20
    button #34.c10, "?", [fpsQUESTION], UL, 230, 110, 20, 17

    if version = 1 then
        statictext #34.b1, "Langue", 10, 10, 60, 20
        statictext #34.b2, "Musique", 10, 30, 60, 20
        statictext #34.b3, "Bruitage", 10, 50, 60, 20
        statictext #34.b5, "Mode rage", 10, 70, 80, 20
        statictext #34.b8, "Sauvegarde", 10, 90, 80, 20
        statictext #34.b10, "Moniteur FPS", 10, 110, 80, 20
    end if
    if version = 2 then
        statictext #34.b1, "Language", 10, 10, 60, 20
        statictext #34.b2, "Music", 10, 30, 60, 20
        statictext #34.b3, "Song", 10, 50, 60, 20
        statictext #34.b5, "Rage Mode", 10, 70, 60, 20
        statictext #34.b8, "Backup", 10, 90, 80, 20
        statictext #34.b10, "FPS Monitor", 10, 110, 80, 20
    end if

    Open "" for window_nf As #34

    if version = 1 then print #34.cb1, "set" : print #34.cb2, "reset"
    if version = 2 then print #34.cb2, "set" : print #34.cb1, "reset"

    if music = 0 then
        print #34.cb3, "set"
        print #34.cb4, "reset"
        if game$ = "off" then print #2b.son1, "disable"
        if game$ = "off" then print #2b.son2, "enable"
        else
            print #34.cb4, "set"
            print #34.cb3, "reset"
            if game$ = "off" then print #2b.son2, "disable"
            if game$ = "off" then print #2b.son1, "enable"
    end if
    if bruitage = 0 then print #34.cb5, "set" : print #34.cb6, "reset"
    if bruitage = 1 then print #34.cb6, "set" : print #34.cb5, "reset"
    if rageMODE$ = "on" then print #34.cb9, "set" : print #34.cb10, "reset"
    if rageMODE$ = "off" then print #34.cb10, "set" : print #34.cb9, "reset"
    if saveMODE = 1 then print #34.cb15, "set" : print #34.cb16, "reset"
    if saveMODE = 2 then print #34.cb16, "set" : print #34.cb15, "reset"
    if FPSmonitor = 1 then print #34.cb19, "set" : print #34.cb20, "reset"
    if FPSmonitor = 0 then print #34.cb20, "set" : print #34.cb19, "reset"

    #34, "trapclose [savePref]"
    print #34, "font times_new_roman 8"
    print #34.b1, "!font times_new_roman 10"
    print #34.b2, "!font times_new_roman 10"
    print #34.b3, "!font times_new_roman 10"
    print #34.b5, "!font times_new_roman 10"
    print #34.b8, "!font times_new_roman 10"
    print #34.b10, "!font times_new_roman 10"
    wait

    [savePref]
    open "pref.ini" for output as #pref
    print #pref, introGAME
    print #pref, music
    print #pref, bruitage
    print #pref, version
    print #pref, rageMODE$
    print #pref, saveMODE
    close #pref
    close #34
    system=1
    if game$ = "on" then timer 140, [deplacementBOUCLE]
    wait


    [13off]
    print #34.cb13, "set" : print #34.cb14, "reset" : wait
    [11off]
    print #34.cb11, "set" : print #34.cb12, "reset" : wait
    [ecranHD]
    print #34.cb17, "set" : print #34.cb18, "reset" : wait
    [ecranHD2]
    print #34.cb17, "set" : print #34.cb18, "reset" : wait
    [fpsMonitor1]
    FPSmonitor = 1 : print #34.cb19, "set" : print #34.cb20, "reset" : wait
    [fpsMonitor2]
    FPSmonitor = 0 : print #34.cb20, "set" : print #34.cb19, "reset" : wait
    [saveMODE1]
    saveMODE = 1 : print #34.cb15, "set" : print #34.cb16, "reset" : wait
    [saveMODE2]
    saveMODE = 2 : print #34.cb16, "set" : print #34.cb15, "reset" : wait
    [bruitageOn]
    bruitage = 0 : print #34.cb5, "set" : print #34.cb6, "reset" : wait
    [bruitageOff]
    bruitage = 1 : print #34.cb6, "set" : print #34.cb5, "reset" : wait
    [dialogueOn]
    dialogue = 0 : print #34.cb7, "set" : print #34.cb8, "reset" : wait
    [dialogueOff]
    dialogue = 1 : print #34.cb8, "set" : print #34.cb7, "reset" : wait
    [LangueFR]
    version = 1 : system=1 : quest1STATUT = 0 : close #34
    if game$ = "on" then close #3b : goto [reload]
    close #2b : goto [start2]
    [LangueENG]
    version = 2 : system=1 : quest1STATUT = 0 : close #34
    if game$ = "on" then close #3b : goto [reload]
    close #2b : goto [start2]
    [musicOn]
    if game$ = "off" then print #2b.son1, "disable" : print #2b.son2, "enable"
    print #34.cb3, "set" : print #34.cb4, "reset" : gosub [iniMUSIC] : music = 0 : wait
    [musicOff]
    if game$ = "off" then print #2b.son2, "disable" : print #2b.son1, "enable"
    print #34.cb4, "set" : print #34.cb3, "reset" : gosub [iniMUSIC2] : music = 1 : wait
    [rageOn]
    rageMODE$ = "on" : print #34.cb9, "set" : print #34.cb10, "reset" : notice " " + chr$(13) + "La difficulté est maintenant au maximum !" : wait
    [rageOff]
    print #34.cb10, "set" : print #34.cb9, "reset" : rageMODE$ = "off" : wait


    [retouraide]
    close #3c : aide=1
    if game$ = "on" then timer 100, [deplacementBOUCLE]
    wait

    [aide]
    if aide=2 then close #3c
    aide=2
    if bruitage = 0 then playwave "music\hit.wav", async
    WindowWidth = 1020 :WindowHeight = 600 : BackgroundColor$ = "black" : ForegroundColor$ = "white" : UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2)
    if version = 1 then bmpbutton #3c.I1, "bmp\aide\acceuilFR.bmp", [w], UL, 280, 50
    if version = 2 then bmpbutton #3c.I1, "bmp\aide\acceuilENG.bmp", [w], UL, 280, 50
    [fenHELP]
    if version = 1 then
        bmpbutton #3c, "bmp\aide\quetesFR.bmp", [aidequetes], UL, 80, 369
        bmpbutton #3c, "bmp\aide\inventaideFR.bmp", [aideinvent], UL, 80, 243
        bmpbutton #3c, "bmp\aide\sortaideFR.bmp", [aideSorts], UL, 80, 181
        bmpbutton #3c, "bmp\aide\combataideFR.bmp", [aidecombat], UL, 80, 306
        bmpbutton #3c, "bmp\aide\support.bmp", [aidesupport], UL, 80, 118
        bmpbutton #3c, "bmp\aide\retour2FR.bmp", [retouraide], UL, 80, 450
    end if
    if version = 2 then
        bmpbutton #3c, "bmp\aide\quetesENG.bmp", [aidequetes], UL, 80, 369
        bmpbutton #3c, "bmp\aide\inventaideENG.bmp", [aideinvent], UL, 80, 243
        bmpbutton #3c, "bmp\aide\sortaideENG.bmp", [aideSorts], UL, 80, 181
        bmpbutton #3c, "bmp\aide\combataideENG.bmp", [aidecombat], UL, 80, 306
        bmpbutton #3c, "bmp\aide\support.bmp", [aidesupport], UL, 80, 118
        bmpbutton #3c, "bmp\aide\retour2ENG.bmp", [retouraide], UL, 80, 450
    end if

    Open "" for window_nf As #3c
    print #3c, "font Times New Roman 12"
    print #3c.I1, "disable"
    #3c, "trapclose [retouraide]"
    wait

    [aidequetes]
    close #3c
    if bruitage = 0 then playwave "music\hit.wav", async
    bmpbutton #3c.I1, "bmp\aide\AideQuetes.bmp", [w], UL, 280, 55
    bmpbutton #3c, "bmp\aide\control.bmp", [aide], UL, 80, 55
    goto [fenHELP]

    [aideinvent]
    close #3c
    if bruitage = 0 then playwave "music\hit.wav", async
    bmpbutton #3c.I1, "bmp\aide\Aideinventaire.bmp", [w], UL, 280, 55
    bmpbutton #3c, "bmp\aide\control.bmp", [aide], UL, 80, 55
    goto [fenHELP]

    [aidecombat]
    close #3c
    if bruitage = 0 then playwave "music\hit.wav", async
    bmpbutton #3c.I1, "bmp\aide\Aidecombat.bmp", [w], UL, 280, 55
    bmpbutton #3c, "bmp\aide\control.bmp", [aide], UL, 80, 55
    goto [fenHELP]

    [aideSorts]
    close #3c
    if bruitage = 0 then playwave "music\hit.wav", async
    bmpbutton #3c.I1, "bmp\aide\Aidesort.bmp", [w], UL, 280, 55
    bmpbutton #3c, "bmp\aide\control.bmp", [aide], UL, 80, 55
    goto [fenHELP]

    [web]
    run "explorer.exe https://www.atomose.fr"
    wait

    [aidesupport]
    close #3c
    TextboxColor$ = "black"
    if bruitage = 0 then playwave "music\hit.wav", async
    if version = 1 then
        statictext #3c.titre, "Mise à jour - Bugs - Support", 280, 120, 500, 40
        statictext #3c, "Le bouton ci-dessous permet d'aller sur le site officiel pour avoir la dernière mise à jour corrigeant de nombreux bugs et ajoutant des fonctionnalitées.", 280, 170, 670, 30
        statictext #3c, "Merci de bien vouloir vérifier votre version et de tenir celle-ci à jour afin d'éviter tout bug. Nous tenons à rappeler que ce jeu est gratuit et ne peux être commercialisé de quelques façons.", 280, 340, 670, 50
    end if
    if version = 2 then
        statictext #3c.titre, "Update, bugs and support", 280, 50, 500, 40
        statictext #3c, "The button below allows you to go to the official site to have the latest update correcting many bugs and adding functionality.", 280, 120, 670, 30
        statictext #3c, "Thank you kindly check your version and keep it updated. We remind that this game is free and can't be commercialize by some ways.", 280, 240, 670, 40
    end if
    statictext #3c, "Eternal Quest © 2011-2023 / Mr LOMUTO ALEXANDRE", 280, 300, 550, 20
    bmpbutton #3c, "bmp\WEB.bmp", [web], UL, 500, 210
    bmpbutton #3c, "bmp\aide\control.bmp", [aide], UL, 80, 55
    if version = 1 then
        bmpbutton #3c, "bmp\aide\quetesFR.bmp", [aidequetes], UL, 80, 369
        bmpbutton #3c, "bmp\aide\inventaideFR.bmp", [aideinvent], UL, 80, 243
        bmpbutton #3c, "bmp\aide\sortaideFR.bmp", [aideSorts], UL, 80, 181
        bmpbutton #3c, "bmp\aide\combataideFR.bmp", [aidecombat], UL, 80, 306
        bmpbutton #3c, "bmp\aide\support.bmp", [aidesupport], UL, 80, 118
        bmpbutton #3c, "bmp\aide\retour2FR.bmp", [retouraide], UL, 80, 450
    end if
    if version = 2 then
        bmpbutton #3c, "bmp\aide\quetesENG.bmp", [aidequetes], UL, 80, 369
        bmpbutton #3c, "bmp\aide\inventaideENG.bmp", [aideinvent], UL, 80, 243
        bmpbutton #3c, "bmp\aide\sortaideENG.bmp", [aideSorts], UL, 80, 181
        bmpbutton #3c, "bmp\aide\combataideENG.bmp", [aidecombat], UL, 80, 306
        bmpbutton #3c, "bmp\aide\support.bmp", [aidesupport], UL, 80, 118
        bmpbutton #3c, "bmp\aide\retour2ENG.bmp", [retouraide], UL, 80, 450
    end if
    Open "" for window_nf As #3c
    #3c, "trapclose [retouraide]"
    print #3c, "font times_new_roman 10"
    print #3c.titre, "!font times_new_roman 20"
    wait

'--choixPerso--------------------------------------------------------------------------------------

    [button1Click]
    if bruitage = 0 then playwave "music\hit.wav", async
    close #2b
    unloadbmp"fond"
    loadbmp"JB", "bmp\fond2.bmp"
    WindowWidth = 1020 :WindowHeight = 600 : campagne = 1 : selection = 1
    BackgroundColor$ = "black" : ForegroundColor$ = "black"
    UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2)

    if version = 1 then
        bmpbutton #2b.selectionbutton1, "bmp\selectionrace\selectionFR.bmp", [confirmhum], UL, 630, 460
        bmpbutton #2b, "bmp\retour.bmp", [start], UL, 118, 493
    end if

    if version = 2 then
        bmpbutton #2b.selectionbutton1, "bmp\selectionrace\selectionENG.bmp", [confirmhum], UL, 630, 460
        bmpbutton #2b, "bmp\back.bmp", [start], UL, 118, 493
    end if
    checkbox #2b.cb7, "", [H], [H], 460, 250, 13, 13
    checkbox #2b.cb8, "", [F], [F], 520, 250, 13, 13
    bmpbutton #2b.selection5, "bmp\selectionrace\race5.bmp", [w], UL, 480, 150
    bmpbutton #2b.selection4, "bmp\selectionrace\race4.bmp", [w], UL, 480, 150
    bmpbutton #2b.selection3, "bmp\selectionrace\race3.bmp", [w], UL, 480, 150
    bmpbutton #2b.selection2, "bmp\selectionrace\race2.bmp", [w], UL, 480, 150
    bmpbutton #2b.selection2bis, "bmp\selectionrace\race2bis.bmp", [w], UL, 480, 150
    bmpbutton #2b.selection3bis, "bmp\selectionrace\race3bis.bmp", [w], UL, 480, 150
    bmpbutton #2b.selection5bis, "bmp\selectionrace\race5bis.bmp", [w], UL, 480, 150
    bmpbutton #2b.selection1bis, "bmp\selectionrace\race1bis.bmp", [w], UL, 480, 150
    bmpbutton #2b.selection1, "bmp\selectionrace\race1.bmp", [w], UL, 480, 150
    open "" for graphics_nsb_nf as #2b
    gosub [introDATA1]
    print #2b.selection5, "disable"
    print #2b.selection4, "disable"
    print #2b.selection3, "disable"
    print #2b.selection2, "disable"
    print #2b.selection1bis, "disable"
    print #2b.selection2bis, "disable"
    print #2b.selection3bis, "disable"
    print #2b.selection5bis, "disable"
    print #2b.selection1, "disable"
    print #2b.cb7, "set"
    print #2b.cb8, "reset"
    #2b, "trapclose [quitSbis]"
    #2b, "background JB"
    #2b, "down; fill black; setfocus; when leftButtonDown [SimpleClickCLASSEselect]"
    #2b, "drawsprites"

    [refreshSelect]
    print #2b, "font Times New Roman 10 bold; color white; backcolor black"
    print #2b, "place 620 150 ;\"; "Caractéristiques principales"
    print #2b, "place 665 350 ;\"; "Habilités"
    print #2b, "font Times New Roman 9"
    print #2b, "place 450 230 ;\"; "Homme"
    print #2b, "place 510 230 ;\"; "Femme"
    print #2b, "place 620 180 ;\"; "Points de vie : ";int(PVTotal-int(strenght/4))';"  (+";int(strenght/4); "  PV)"
    print #2b, "place 620 195 ;\"; "Points de mana : ";int(PMTotal-int(intelligence/6))';" (+";int(intelligence/6);"  mana)"
    agiName = int(def-int(agility*0.1))
    if agiName<0 then agiName= 0
    print #2b, "place 620 245 ;\"; "Points de défense : ";agiName';" (+";int(agility*0.1);"  def)"
    print #2b, "place 620 260 ;\"; "Expérience par niveau : ";XpLvL
    print #2b, "place 620 290 ;\"; "Argent de départ : ";gold
    print #2b, "place 465 300 ;\"; "Type : ";caractPERSO$
    print #2b, "place 465 315 ;\"; "Combat : ";combatPERSO$
    print #2b, "place 465 330 ;\"; "Type : ";stylePERSO$

    if caractPERSO$ = "Force" then
        print #2b, "place 620 230 ;\"; "Points d'attaque : ";int(atk-(strenght/2))';" (+";int(strenght/2);" atk )"
        print #2b, "place 620 380 ;\"; "Force : ";strenght;"  (+";int(strenght/4);"  PV | +";int(strenght/2);"  atk )"
    else
        print #2b, "place 620 380 ;\"; "Force : ";strenght;"  (+";int(strenght/4);"  PV)"
    end if
    if caractPERSO$ = "Agilité" then
        print #2b, "place 620 230 ;\"; "Points d'attaque : ";int(atk-int(agility/2))';" (+";int(agility/2);" atk )"
        print #2b, "place 620 395 ;\"; "Agilité : ";agility;"  (+";int(agility*0.1);"  def  | +";int(agility/2);"  atk )"
    else
        print #2b, "place 620 395 ;\"; "Agilité : ";agility;"  (+";int(agility*0.1);"  def )"
    end if
    if caractPERSO$ = "Intelligence" then
        print #2b, "place 620 230 ;\"; "Points d'attaque : ";int(atk-int(intelligence/5))';" (+";int(intelligence/5);" atk )"
        print #2b, "place 620 410 ;\"; "Intelligence : ";intelligence;"  (+";int(intelligence/6);"  mana  | +";int(intelligence/5);"  atk )"
    else
        print #2b, "place 620 410 ;\"; "Intelligence : ";intelligence;"  (+";int(intelligence/6);"  mana )"
    end if
    if caractPERSO$ = "Intelligence - Force" then
        print #2b, "place 620 230 ;\"; "Points d'attaque : ";int(atk-int(intelligence/5+strenght/2))';" (+";int(intelligence/5+strenght/2);" atk )"
        print #2b, "place 620 395 ;\"; "Force : ";strenght;"  (+";int(strenght/4);"  PV | +";int(strenght/2);"  atk )"
        print #2b, "place 620 410 ;\"; "Intelligence : ";intelligence;"  (+";int(intelligence/6);"  mana  | +";int(intelligence/5);"  atk )"
    end if
    #2b, "font times_new_roman 12; color White; backcolor black"
    if version = 1 then #2b, "place 145 196 ;\"; "GUERRIER"
    if version = 2 then #2b, "place 145 196 ;\"; "WARRIOR"
    #2b, "place 150 245 ;\"; "ARCHER"
    #2b, "place 160 295 ;\"; "MAGE"
    #2b, "place 148 347 ;\"; "NECROM"
    #2b, "place 146 400 ;\"; "ARTISAN"
    #2b, "flush"
    wait


    [SimpleClickCLASSEselect]
    mX = MouseX : mY = MouseY
    'notice mX;" / ";mY
    if mX>120 and mX<245 and mY>170 and mY<210 then goto [classe1SELECT]
    if mX>120 and mX<245 and mY>220 and mY<260 then goto [classe2SELECT]
    if mX>120 and mX<245 and mY>270 and mY<310 then goto [classe3SELECT]
    if mX>120 and mX<245 and mY>320 and mY<360 then goto [classe4SELECT]
    if mX>120 and mX<245 and mY>370 and mY<410 then goto [classe5SELECT]
    wait

[H]
sex=1
print #2b.cb7, "set" : print #2b.cb8, "reset"
if campagne = 1 then print #2b.selection1bis, "disable" : print #2b.selection1, "enable"
if campagne = 2 then print #2b.selection2bis, "disable" : print #2b.selection2, "enable"
if campagne = 3 then print #2b.selection3bis, "disable" : print #2b.selection3, "enable"
if campagne = 5 then print #2b.selection5bis, "disable" : print #2b.selection5, "enable"
wait

[F]
sex=2
print #2b.cb8, "set" : print #2b.cb7, "reset"
if campagne = 1 then print #2b.selection1, "disable" : print #2b.selection1bis, "enable"
if campagne = 2 then print #2b.selection2, "disable" : print #2b.selection2bis, "enable"
if campagne = 3 then print #2b.selection3, "disable" : print #2b.selection3bis, "enable"
if campagne = 5 then print #2b.selection5, "disable" : print #2b.selection5bis, "enable"
wait

    [refreshCLASSEbutton]
    #2b, "font times_new_roman 12; color White; backcolor black"
    if version = 1 then #2b, "place 145 196 ;\"; "GUERRIER"
    if version = 2 then #2b, "place 145 196 ;\"; "WARRIOR"
    #2b, "place 150 245 ;\"; "ARCHER"
    #2b, "place 160 295 ;\"; "MAGE"
    #2b, "place 148 347 ;\"; "NECROM"
    #2b, "place 146 400 ;\"; "ARTISAN"
    return

    [classe1SELECT]
    #2b,"drawsprites"
    if bruitage = 0 then playwave "music\hit.wav", async
    campagne = 1
    gosub [refreshCLASSEbutton]
    gosub [introDATA1]
    print #2b.selection5, "disable"
    print #2b.selection5bis, "disable"
    print #2b.selection4, "disable"
    print #2b.selection3, "disable"
    print #2b.selection2, "disable"
    print #2b.selection2bis, "disable"
    print #2b.selection3bis, "disable"
    if sex=1 then
        print #2b.cb7, "set"
        print #2b.cb8, "reset"
        print #2b.selection1bis, "disable"
        print #2b.selection1, "enable"
    end if
    if sex=2 then
        print #2b.cb8, "set"
        print #2b.cb7, "reset"
        print #2b.selection1, "disable"
        print #2b.selection1bis, "enable"
    end if
    goto [refreshSelect]


    [classe2SELECT]
    #2b,"drawsprites"
    if bruitage = 0 then playwave "music\hit.wav", async
    campagne = 2
    gosub [refreshCLASSEbutton]
    gosub [introDATA2]
    print #2b.selection5, "disable"
    print #2b.selection5bis, "disable"
    print #2b.selection4, "disable"
    print #2b.selection1, "disable"
    print #2b.selection1bis, "disable"
    print #2b.selection3, "disable"
    print #2b.selection3bis, "disable"
    if sex=1 then
        print #2b.cb7, "set"
        print #2b.cb8, "reset"
        print #2b.selection2bis, "disable"
        print #2b.selection2, "enable"
    end if
    if sex=2 then
        print #2b.cb8, "set"
        print #2b.cb7, "reset"
        print #2b.selection2, "disable"
        print #2b.selection2bis, "enable"
    end if
    goto [refreshSelect]

    [classe3SELECT]
    #2b,"drawsprites"
    if bruitage = 0 then playwave "music\hit.wav", async
    campagne = 3
    gosub [refreshCLASSEbutton]
    gosub [introDATA3]
    print #2b.selection5, "disable"
    print #2b.selection5bis, "disable"
    print #2b.selection4, "disable"
    print #2b.selection1, "disable"
    print #2b.selection2, "disable"
    print #2b.selection3, "disable"
    print #2b.selection2bis, "disable"
    if sex=1 then
        print #2b.cb7, "set"
        print #2b.cb8, "reset"
        print #2b.selection3bis, "disable"
        print #2b.selection3, "enable"
    end if
    if sex=2 then
        print #2b.cb8, "set"
        print #2b.cb7, "reset"
        print #2b.selection3, "disable"
        print #2b.selection3bis, "enable"
    end if
    goto [refreshSelect]

    [classe4SELECT]
    #2b,"drawsprites"
    if bruitage = 0 then playwave "music\hit.wav", async
    campagne = 4
    print #2b.cb7, "reset"
    print #2b.cb8, "reset"
    gosub [refreshCLASSEbutton]
    gosub [introDATA4]
    print #2b.selection5, "disable"
    print #2b.selection5bis, "disable"
    print #2b.selection3, "disable"
    print #2b.selection1, "disable"
    print #2b.selection2, "disable"
    print #2b.selection2bis, "disable"
    print #2b.selection3bis, "disable"
    print #2b.selection4, "enable"
    goto [refreshSelect]

    [classe5SELECT]
    #2b,"drawsprites"
    if bruitage = 0 then playwave "music\hit.wav", async
    campagne = 5
    gosub [refreshCLASSEbutton]
    gosub [introDATA5]
    print #2b.selection3, "disable"
    print #2b.selection4, "disable"
    print #2b.selection1, "disable"
    print #2b.selection2, "disable"
    print #2b.selection2bis, "disable"
    print #2b.selection3bis, "disable"
    if sex=1 then
        print #2b.cb7, "set"
        print #2b.cb8, "reset"
        print #2b.selection5bis, "disable"
        print #2b.selection5, "enable"
    end if
    if sex=2 then
        print #2b.cb8, "set"
        print #2b.cb7, "reset"
        print #2b.selection5, "disable"
        print #2b.selection5bis, "enable"
    end if
    goto [refreshSelect]


    [confirmhum]
    if version = 1 then confirm "Ete-vous sûre de votre choix ?";quit$
    if version = 2 then confirm "Are you sure about your choice ?";quit$
    if quit$ = "no" then wait
    map1=0
    if sex = 0 then notice " " + chr$(13) + "Vous n'avez pas choisi le sexe de votre personnage !" : wait

    select case version
    case 1
    NameBras1$ = "Simple épée"
    NameArmure$ = "Chemise Simple"
    NamePantalon$ = "Bas Simple"
    NameBottes$ = "Chaussures simple"
    case 2
    NameBras1$ = "Single sword"
    NameArmure$ = "Single shirt"
    NamePantalon$ = "Single bottom"
    NameBottes$ = "Single shoes"
    end select
    close #2b
    selection = 0
    select case campagne
        case 1
            goto [introDATA1]
        case 2
            goto [introDATA2]
        case 3
            goto [introDATA3]
        case 4
            goto [introDATA4]
        case 5
            goto [introDATA5]
    end select
    wait

    [introDATA1]
    XpLvL= 0 : caractPERSO$ = "Force" : strenght = 12 : agility = 5 : intelligence = 4 : lvlHero=1 : campagne=1
    PVTotal = int(31+int(strenght/4)) : PMTotal = 14+int(intelligence/6)
    PV=PVTotal : PVLvL=4 : PVregenVIT = 32 : PVregenTOTAL = int(strenght/5) : PMregenTOTAL = int(intelligence/5)
    PM=PMTotal : PMLvL=2 : atk=int(12+strenght/2) : atkLvL=2 : def=int(2+agility*0.1) : defLvL=2
    GenerATKheroPOWER = 10 : speed = 1 : gold= 0 : xp=0 : PA = 5 : XpLvL=XpLvL+int(50*lvlHero) : combatPERSO$ = "Mêlée" : stylePERSO$ = "Tank"
    if selection = 1 then return
    goto [map1intro]

    [introDATA2]
    XpLvL= 0 : caractPERSO$ = "Agilité" : strenght = 6 : agility = 19 : intelligence = 5 : lvlHero=1 : campagne=2
    PVTotal = int(18+int(strenght/4)) : PMTotal = 16+int(intelligence/6) : PV=PVTotal : PVLvL=2
    PVregenVIT = 18 : PVregenTOTAL = int(strenght/5) : PMregenTOTAL = int(intelligence/5)
    PM=PMTotal : PMLvL=2 : atk=int(19+agility/2) : atkLvL=5 : def=int(0+agility*0.1) : defLvL=1
    GenerATKheroPOWER = 10 : speed = 1 : gold= 0 : xp=0 : PA = 5 : XpLvL=XpLvL+int(40*lvlHero) : combatPERSO$ = "Distance" : stylePERSO$ = "Dégâts"
    if selection = 1 then return
    goto [map1intro]

    [introDATA3]
    XpLvL= 0 : caractPERSO$ = "Intelligence" : strenght = 5 : agility = 5 : intelligence = 20 : lvlHero=1 : campagne=3
    PVTotal = int(20+int(strenght/4)) : PMTotal = 86+int(intelligence/6)
    PV=PVTotal : PVLvL=2 : PVregenVIT = 20 : PVregenTOTAL = int(strenght/5) : PMregenTOTAL = int(intelligence/5)
    PM=PMTotal : PMLvL=8 : atk=int(6+intelligence/5) : atkLvL=2 : def=int(1+agility*0.1) : defLvL=1
    GenerATKheroPOWER = 10 : speed = 1 : gold= 0 : xp=0 : PA = 5 : XpLvL=XpLvL+int(70*lvlHero) : combatPERSO$ = "Distance" : stylePERSO$ = "Magie"
    if selection = 1 then return
    goto [map1intro]

    [introDATA4]
    XpLvL= 0 : caractPERSO$ = "Intelligence" : strenght = 7 : agility = 2 : intelligence = 22 : lvlHero=1 : campagne=4
    PVTotal = int(23+int(strenght/4)) : PMTotal = 130+int(intelligence/6)
    PV=PVTotal : PVLvL=5 : PVregenVIT = 20 : PVregenTOTAL = int(strenght/5) : PMregenTOTAL = int(intelligence/5)
    PM=PMTotal : PMLvL=5 : atk=int(3+intelligence/5) : atkLvL=1 : def=int(3+agility*0.1) : defLvL=1
    GenerATKheroPOWER = 10 : speed = 1 : gold= 0 : xp=0 : PA = 5 : XpLvL=XpLvL+int(60*lvlHero) : combatPERSO$ = "Distance" : stylePERSO$ = "Invocateur"
    if selection = 1 then return
    goto [map1intro]

    [introDATA5]
    XpLvL= 0 : caractPERSO$ = "Intelligence" : strenght = 8 : agility = 8 : intelligence = 8 : lvlHero=1 : campagne=5
    PVTotal = int(25+int(strenght/4)) : PMTotal = 35+int(intelligence/6)
    PV=PVTotal : PVLvL=3 : PVregenVIT = 40 : PVregenTOTAL = int(strenght/5) : PMregenTOTAL = int(intelligence/5)
    PM=PMTotal : PMLvL=3 : atk=int(7+intelligence/5+strenght/2) : atkLvL=2 : def=int(2+agility*0.1) : defLvL=1
    GenerATKheroPOWER = 10 : speed = 1 : gold= 250 : xp=0 : PA = 5 : XpLvL=XpLvL+int(55*lvlHero) : combatPERSO$ = "Mêlée" : stylePERSO$ = "Polyvalent"
    if selection = 1 then return
    goto [map1intro]

'-----maps-------------------------------------------------------------------------------------------------------------------|

    [map1intro]

    AlifeVoleur1 = 0 : openW = 0 : load = 0 : gameD = 0 : nombre = 10 : perso1sx=642 : perso1sy=126 : potionHEAL1 = 5
    nombreITEMchemise1 = 1 : nombreITEMepee1 = 1 : nombreITEMpant1 = 1 : nombreITEMboots1 = 1
    LvlBras1 =1 : LvlArmure =1 : LvlPantalon =1 : LvlBoots = 1 : factor = 1 : iniITEM = 1
    if rageMODE$ = "on" then factor = 10
    goto [jeuhumain1]

    [map1]
    #3b.map,"when characterInput [w]"
    timer 100, [map1bis2SECURITY] : wait
    [map1bis2SECURITY]
    timer 0
    openW = 1 : load = 0
    sprites$ = "minimap1 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1 Q1 indicQ hpMONSTER"
    for s = 1 to 17
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain1]
    map=1:region=1:curseurx=55:curseury=530
    perso1qx=perso1sx:perso1qy=perso1sy:perso1dx=perso1sx:perso1dy=perso1sy:perso1zx=perso1sx:perso1zy=perso1sy
    buttonHelpIntro1x=10 : buttonHelpIntro1y=320 : buttonHelpIntro2x=780 : buttonHelpIntro2y=320 : buttonHelpIntro3x=100 : buttonHelpIntro3y=10
    sprites2$ = "buttonHelpIntro1 buttonHelpIntro2 buttonHelpIntro3"
    sprites1$ = "minimap1 curseur hb1 Q1 hpMONSTER"

    gosub [mapreg2]

    for s = 1 to 5
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next
    for s = 1 to 3
        loadbmp word$(sprites2$,s), "bmp\aide\astuces\"+word$(sprites2$,s)+".bmp"
    next
    sprites3$ = "indicQ"
    loadbmp word$(sprites3$,1), "bmp\aide\"+word$(sprites3$,1)+".bmp"

    if direction2 = 0 then direction2 = 2
    if map1 = 1 and load = 0 then direction2 = 2 : mX = 200 : mY = 30 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain1]
    if astuces = 0 then #3b.map,"addsprite buttonHelpIntro1 buttonHelpIntro1; addsprite buttonHelpIntro2 buttonHelpIntro2; addsprite buttonHelpIntro3 buttonHelpIntro3" : #3b.map,"spritexy buttonHelpIntro1 ";buttonHelpIntro1x;" ";buttonHelpIntro1y;"; spritexy buttonHelpIntro2 ";buttonHelpIntro2x;" ";buttonHelpIntro2y;"; spritexy buttonHelpIntro3 ";buttonHelpIntro3x;" ";buttonHelpIntro3y : astuces = 1

    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"addsprite Q1 Q1; addsprite indicQ indicQ; addsprite minimap1 minimap1; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy Q1 -100 -100; spritexy indicQ -100 -100; spritexy minimap1 ";minimap1x;" ";minimap1y;"; spritexy curseur ";curseurx;" ";curseury;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy;"; spritexy perso1s ";perso1sx;" ";perso1sy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touchea]"
    goto [deplacementBOUCLE]

    [control_touchea]
    #3b.map,"when characterInput [w]"
    timer 80, [1a] : wait

    [1a]
    timer 0
    gosub [case]
    #3b.map,"when characterInput [control_touchea]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    if astuces = 1 then #3b.map,"SpriteVisible buttonHelpIntro1 off; SpriteVisible buttonHelpIntro2 off; SpriteVisible buttonHelpIntro3 off" : astuces = 2
    [1aSECURITY]
    if mapSELECT = 2 then goto [1bSECURITY]
    gosub [limitesMAP1]
    goto [deplacementBOUCLE]


'carte 2 ---------------------------------------------------------------


    [map2bis]
    openW = 1 : #3b.map,"when characterInput [w]" : timer 100, [map2bis2SECURITY] : wait
    [map2bis2SECURITY]
    timer 0
    map1=1:map2=0:load=0:astuces=2 : goto [map2bis2]
    [map2]
    #3b.map,"when characterInput [w]" : timer 100, [map2bis2SECURITY2] : wait
    [map2bis2SECURITY2]
    timer 0
    openW = 1 : load=0
    [map2bis2]
    sprites$ = "minimap1 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1 Q1 hpMONSTER "
    for s = 1 to 17
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain2]
    map=2 : region = 1 : Q1x=740 : Q1y=155 : indicQx = 737 : indicQy = 120:curseurx=52:curseury=510
    sprites1$ = "minimap1 curseur hb1 Q1 hpMONSTER" : sprites2$ = "indicQ"
    gosub [mapreg2]

    for s = 1 to 5
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next
    loadbmp word$(sprites2$,1), "bmp\aide\"+word$(sprites2$,1)+".bmp"

    if direction2 = 0 then direction2 = 2
    if map2= 0 and load = 0 then mX = 198 : mY = 360 : direction2 = 4 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map2= 1 and load = 0 then mX = 960 : mY = 220 : direction2 = 3 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"addsprite minimap1 minimap1; addsprite curseur curseur; addsprite Q1 Q1; addsprite indicQ indicQ; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap1 ";minimap1x;" ";minimap1y;"; spritexy curseur ";curseurx;" ";curseury
    #3b.map,"spritexy Q1 ";Q1x;" ";Q1y;"; spritexy indicQ ";indicQx;" ";indicQy;"; spritexy ico ";icox;" ";icoy;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy
    if map2= 0 then #3b.map,"SpriteVisible perso1q off"
    #3b.map,"SpriteVisible Q1 off; SpriteVisible ico off; SpriteVisible indicQ off; SpriteVisible hpMONSTER off"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    if DQop1PART2 = 0 then #3b.map,"SpriteVisible Q1 on; SpriteVisible indicQ on"

    #3b.map,"when characterInput [control_toucheb]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain2]
    goto [deplacementBOUCLE]

    [DQop1Part2]
    DQop1PART2 = 1
    Qvoleur = 4
    if sex = 1 then sexe$ = "garçon"
    if sex = 2 then sexe$ = "fille"
    BackgroundColor$ = "black" : ForegroundColor$ = "white"
    WindowWidth = 400 : WindowHeight = 240
    UpperLeftX=int((DisplayWidth-WindowWidth)/3)
    UpperLeftY=int((DisplayHeight-WindowHeight)/3)
    bmpbutton #1.A, "bmp\icoQ1.bmp", [w], UL, 10, 50
    if version = 1 then
        statictext #1.a,"Quête optionelle : La sacoche", 70, 10, 300, 30
        statictext #1.b,"''Ma sacoche ! Vous avez réussi à la reprendre à ce petit voyou. Un grand merci jeunne ";sexe$;" ! Je dois me rendre à une auberge plus au nord. On dit que l'on y trouve toutes les informations que l'on désire. Si vous y passer je me ferais un plaisir de vous raconter ce qui m'amène ici. Pour le moment je dois vite me rendre à mon rendez vous !! Ha, j'allais oublier. Voici une petite récompense pour m'avoir aidé ... ''", 70, 45, 310, 120
        statictext #1.c,"Vous avez reçus ";int(gold/10);" Pièces d'or !", 20, 170, 220, 17
        statictext #1.d,"Vous avez reçus 50 Points d'expérience !", 20, 185, 240, 17
        button #1, "Fermer", [Q1part2OK], UL, 280, 170,80,25
    end if
    if version = 2 then
        statictext #1.a,"Optional Quest : Satchel", 90, 10, 300, 30
        statictext #1.b,"''My bag! You managed to take this little punk. A big thank for you young man! I have to go to a hostel in the north. It is said that there is any information you wish. If you spend I'd be happy to tell you what brings me here. At the moment I have to quickly get to my appointment! Ha yeah. Here is a small reward for helped me ...''", 70, 45, 310, 120
        statictext #1.c,"You have received ";int(gold/10);" gold coins!", 20, 170, 220, 55
        statictext #1.d,"You have received 50 Points of experience !", 20, 185, 220, 17
        button #1, "Fermer", [Q1part2OK], UL, 280, 170,80,25
    end if
    open "" for dialog_modal_nf as #1
    print #1.a, "!font times_new_roman 16 bold italic"
    print #1.b, "!font times_new_roman 10 italic"
    print #1.c, "!font times_new_roman 10 bold"
    print #1.d, "!font times_new_roman 10 bold"
    print #1.A, "disable"
    #1,"trapclose [w]"
    wait

    [Q1part2OK]
    close #1
    gold = gold + int(gold/10)
    xp = xp +50
    if xp >= XpLvL and sex = 1 then gosub [lvlUPwarrior1]
    if xp >= XpLvL and sex = 2 then gosub [lvlUPwarrior2]
    #3b.map,"SpriteVisible Q1 off"
    gosub [persos]
    wait

    [control_toucheb]
    #3b.map,"when characterInput [w]"
    timer 80, [1b] : wait

    [1b]
    timer 0
    #3b.map,"when characterInput [control_toucheb]"
    #3b.map,"SpriteVisible hpMONSTER off"
    #3b.map,"SpriteVisible ico off"
    gosub[case]
    [1bSECURITY]
    if mapSELECT = 1 then goto [1aSECURITY]
    gosub [limitesMAP2]
    goto [deplacementBOUCLE]


'carte 3 ---------------------------------------------------------------


    [map3bis]
    openW = 1 : #3b.map,"when characterInput [w]" : timer 100, [map3bis2SECURITY] : wait
    [map3bis2SECURITY]
    timer 0
    #3b.map,"SpriteVisible Q1 off; SpriteVisible indicQ off" : map2=1:map3=0:load=0:astuces=2 : goto [map3bis2]
    [map3]
    #3b.map,"when characterInput [w]" : timer 100, [map3bis2SECURITY2] : wait
    [map3bis2SECURITY2]
    timer 0
    openW = 1 : load=0
    [map3bis2]
    sprites$ = "minimap1 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain3]
    map=3 : region = 1 :curseurx=83:curseury=503
    sprites1$ = "minimap1 curseur hb1 Q1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 5
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map3= 0 and load = 0 then mX = 30 : mY = 328 : direction2 = 1 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map3= 1 and load = 0 then mX = 594 : mY = 42 : direction2 = 2 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"addsprite minimap1 minimap1; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap1 ";minimap1x;" ";minimap1y;"; spritexy curseur ";curseurx;" ";curseury;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touchec]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain3]
    goto [deplacementBOUCLE]

    [control_touchec]
    #3b.map,"when characterInput [w]"
    timer 80, [1c] : wait

    [1c]
    timer 0
    #3b.map,"when characterInput [control_touchec]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    [1cSECURITY]
    if mapSELECT = 2 then goto [1bSECURITY]
    if mapSELECT = 4 then goto [1dSECURITY]
    gosub [limitesMAP3]
    goto [deplacementBOUCLE]


'carte 4 ---------------------------------------------------------------

    [map4bis]
    openW = 1 : #3b.map,"when characterInput [w]" : timer 100, [map4bis2SECURITY] : wait
    [map4bis2SECURITY]
    timer 0
    map3=1:map4=0:load=0:astuces=2 : goto [map4bis2]
    [map4]
    #3b.map,"when characterInput [w]" : #3b.map,"SpriteVisible voleur1d off; SpriteVisible voleur1z off; SpriteVisible voleur1s off; SpriteVisible voleur1q off" : timer 100, [map4bis2SECURITY2] : wait
    [map4bis2SECURITY2]
    timer 0
    openW = 1 : load=0
    [map4bis2]
    load=0
    sprites$ = "minimap1 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1 ico"
    for s = 1 to 16
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain4]
    map=4 : region = 1 : QvoleurSecur = 1:curseurx=87:curseury=475
    sprites1$ = "minimap1 minimap2 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 5
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map4= 0 and load = 0 then mX = 540 : mY = 390 : direction2 = 4 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map4= 1 and load = 0 then mX = 12 : mY = 240 : direction2 = 1 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"addsprite minimap1 minimap1; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap1 ";minimap1x;" ";minimap1y;"; spritexy curseur ";curseurx;" ";curseury;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touched]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain4]
    goto [deplacementBOUCLE]

    [control_touched]
    #3b.map,"when characterInput [w]"
    timer 80, [1d] : wait

    [1d]
    timer 0
    #3b.map,"when characterInput [control_touched]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub[case]
    [1dSECURITY]
    if mapSELECT = 3 then goto [1cSECURITY]
    gosub [limitesMAP4]
    goto [deplacementBOUCLE]


'carte 5 ---------------------------------------------------------------

    [map5bis]
    openW = 1 : #3b.map,"when characterInput [w]" : timer 100, [map5bis2SECURITY] : wait
    [map5bis2SECURITY]
    timer 0
    map4=1:map5=0:load=0:astuces=2 : goto [map5bis2]
    [map5]
    #3b.map,"when characterInput [w]" : timer 100, [map5bis2SECURITY2] : wait
    [map5bis2SECURITY2]
    timer 0
    openW = 1 : load=0
    [map5bis2]
    sprites$ = "minimap1 minimap2 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 16
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain5]
    map=5 : region = 1 : DQop1 = 0 : QvoleurSecur = 0:curseurx=47:curseury=465
    sprites1$ = "minimap1 minimap2 curseur hb1 hpMONSTER"
    sprites5$ = "voleur1s voleur2s voleur3s voleur4s voleur1d voleur2d voleur3d voleur4d voleur1q voleur2q voleur3q voleur4q voleur1z voleur2z voleur3z voleur4z icoVoleur"
    sprites6$ = "Q2d Q2q"
    sprites7$ = "indicQ"
    gosub [mapreg2]

    for s = 1 to 5
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next
    for s = 1 to 17
        loadbmp word$(sprites5$,s), "bmp\perso\voleur1\"+word$(sprites5$,s)+".bmp"
    next
    for s = 1 to 2
        loadbmp word$(sprites6$,s), "bmp\perso\quetes\2\"+word$(sprites6$,s)+".bmp"
    next
    loadbmp word$(sprites7$,1), "bmp\aide\"+word$(sprites7$,1)+".bmp"

    if direction2 = 0 then direction2 = 2
    if map5= 0 and load = 0 then mX = 960 : mY = 340 : direction2 = 1 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map5= 1 and load = 0 then mX = 240 : mY = 30 : direction2 = 2 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY

    gosub [mapreg3]

    if Qvoleur = 2 then perso1zx=396:perso1zy=54
    if map4=0 then #3b.map,"spritexy perso1z ";perso1zx;" ";perso1zy
    if map4=1 then #3b.map,"spritexy perso1d ";perso1dx;" ";perso1dy

    voleur1dx = 400 : voleur1dy = 60
    #3b.map,"addsprite minimap1 minimap1; addsprite minimap2 minimap2; addsprite curseur curseur"
    #3b.map,"addsprite voleur1s voleur1s voleur2s voleur3s voleur4s; spritexy voleur1s 400 50; SpriteVisible voleur1s on"
    #3b.map,"addsprite voleur1d voleur1d voleur2d voleur3d voleur4d; spritexy voleur1d 400 50; SpriteVisible voleur1d on"
    #3b.map,"addsprite voleur1q voleur1q voleur2q voleur3q voleur4q; spritexy voleur1q 400 50; SpriteVisible voleur1q on"
    #3b.map,"addsprite voleur1z voleur1z voleur2z voleur3z voleur4z; spritexy voleur1z 400 50; SpriteVisible voleur1z on"
    #3b.map,"addsprite hpMONSTER hpMONSTER; addsprite ico ico; addsprite icoVoleur icoVoleur; addsprite Q2q Q2q; addsprite Q2d Q2d; addsprite indicQ indicQ"

    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"

    #3b.map,"spritexy curseur ";curseurx;" ";curseury;"; spritexy minimap1 ";minimap1x;" ";minimap1y;"; spritexy minimap2 ";minimap1x;" ";minimap1y;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy;"; spritexy icoVoleur ";icox;" ";icoy;"; spritexy Q2q ";Q2x;" ";Q2y;"; spritexy Q2d ";Q2x;" ";Q2y;"; spritexy indicQ ";indicQx;" ";indicQy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible icoVoleur off; SpriteVisible minimap2 off; SpriteVisible minimap1 on; SpriteVisible Q2q off; SpriteVisible Q2d off; SpriteVisible indicQ off"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    if winQ1 = 1 or Qvoleur = 0 then #3b.map,"SpriteVisible voleur1d off; SpriteVisible voleur1z off; SpriteVisible voleur1s off; SpriteVisible voleur1q off"

    #3b.map,"when characterInput [control_touchee]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain5]

    goto [deplacementBOUCLE]

    [control_touchee]
    #3b.map,"when characterInput [w]"
    timer 80, [1e] : wait

    [1e]
    timer 0
    #3b.map,"when characterInput [control_touchee]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible icoVoleur off"
    gosub [case]
    [1eSECURITY]
    if mapSELECT = 6 then goto [1fSECURITY]
    if mapSELECT = 4 then goto [1dSECURITY]
    gosub [limitesMAP5]
    goto [deplacementBOUCLE]


'carte 6 ---------------------------------------------------------------

    [map6bis]
    openW = 1 : #3b.map,"when characterInput [w]" : timer 100, [map6bis2SECURITY] : wait
    [map6bis2SECURITY]
    timer 0
    #3b.map,"SpriteVisible voleur1d off; SpriteVisible voleur1z off; SpriteVisible voleur1s off; SpriteVisible voleur1q off" : map5=1:map6=0:astuces=2 : goto [map6bis2]
    [map6]
    #3b.map,"when characterInput [w]" : timer 100, [map6bis2SECURITY2] : wait
    [map6bis2SECURITY2]
    openW=1
    timer 0
    [map6bis2]
    load=0

    sprites$ = "minimap2 curseur perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q perso4q perso1z perso2z perso4z hb1 hpMONSTER Q2d Q2q indicQ"
    for s = 1 to 19
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain6]
    map=6 : region = 2 : QvoleurSecur = 1:curseurx=52:curseury=540
    sprites1$ = "minimap1 minimap2 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 5
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map6= 0 and load = 0 then mX = 360 : mY = 390 : direction2 = 4 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map6= 1 and load = 0 then mX = 264 : mY = 30 : direction2 = 2 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map6= 2 and load = 0 then mX = 900 : mY = 78 : direction2 = 3 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY

    gosub [mapreg3]

    #3b.map,"addsprite minimap1 minimap1; addsprite minimap2 minimap2; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"spritexy minimap1 ";minimap1x;" ";minimap1y;"; spritexy minimap2 ";minimap2x;" ";minimap2y;"; spritexy curseur ";curseurx;" ";curseury;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap1 off; SpriteVisible minimap2 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touchef]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain6]
    goto [deplacementBOUCLE]

    [control_touchef]
    #3b.map,"when characterInput [w]"
    timer 80, [1f] : wait

    [1f]
    timer 0
    #3b.map,"when characterInput [control_touchef]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    [1fSECURITY]
    if mapSELECT = 5 then goto [1eSECURITY]
    if mapSELECT = 7 then goto [1gSECURITY]
    gosub [limitesMAP6]
    goto [deplacementBOUCLE]



'carte 7 ---------------------------------------------------------------

    [map7bis]
    openW = 1 : #3b.map,"when characterInput [w]" : timer 100, [map7bis2SECURITY] : wait
    [map7bis2SECURITY]
    timer 0
    map6=1:map7=0:load=0:astuces=2 : goto [map7bis2]
    [map7]
    #3b.map,"when characterInput [w]" : timer 100, [map7bis2SECURITY2] : wait
    [map7bis2SECURITY2]
    timer 0
    openW = 1 : load=0
    [map7bis2]
    load=0

    sprites$ = "minimap2 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain7]

    map=7 : region = 2 : Q2x = 740 : Q2y = 210 : indicQx = 730 : indicQy = 175:curseurx=50:curseury=510
    sprites1$ = "minimap1 minimap2 curseur hb1 hpMONSTER"
    sprites5$ = "voleur1s voleur2s voleur3s voleur4s voleur1d voleur2d voleur3d voleur4d voleur1q voleur2q voleur3q voleur4q voleur1z voleur2z voleur3z voleur4z icoVoleur"
    sprites6$ = "Q2d Q2q"
    sprites7$ = "indicQ"
    gosub [mapreg2]

    for s = 1 to 5
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next
    for s = 1 to 2
        loadbmp word$(sprites6$,s), "bmp\perso\quetes\2\"+word$(sprites6$,s)+".bmp"
    next
    loadbmp word$(sprites7$,1), "bmp\aide\"+word$(sprites7$,1)+".bmp"
    for s = 1 to 17
        loadbmp word$(sprites5$,s), "bmp\perso\voleur1\"+word$(sprites5$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map7= 0 and load = 0 then mX = 390 : mY = 390 : direction2 = 4 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map7= 1 and load = 0 then mX = 420 : mY = 30 : direction2 = 2 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY

    gosub [mapreg3]

    #3b.map,"addsprite minimap2 minimap2; addsprite curseur curseur; addsprite Q2q Q2q; addsprite Q2d Q2d; addsprite indicQ indicQ; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap2 ";minimap2x;" ";minimap2y;"; spritexy curseur ";curseurx;" ";curseury;"; spritexy Q2q ";Q2x;" ";Q2y;"; spritexy Q2d ";Q2x;" ";Q2y;"; spritexy indicQ ";indicQx;" ";indicQy;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"SpriteVisible Q2d off; SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap2 on"
    if winQ2 = 1 then #3b.map,"SpriteVisible indicQ off"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_toucheg]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain7]
    goto [deplacementBOUCLE]

    [control_toucheg]
    #3b.map,"when characterInput [w]"
    timer 80, [1g] : wait

    [1g]
    timer 0
    #3b.map,"when characterInput [control_toucheg]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    [1gSECURITY]
    if mapSELECT = 6 then goto [1fSECURITY]
    if mapSELECT = 8 then goto [1hSECURITY]
    gosub [limitesMAP7]
    goto [deplacementBOUCLE]


'carte 8 ---------------------------------------------------------------

    [map8bis]
    openW = 1
    #3b.map,"when characterInput [w]" : timer 100, [map8bis2SECURITY] : wait
    [map8bis2SECURITY]
    timer 0
    map7=1:map8=0:load=0:astuces=2 : goto [map8bis2]
    [map8]
    #3b.map,"when characterInput [w]" : timer 100, [map8bis2SECURITY2] : wait
    [map8bis2SECURITY2]
    timer 0
    openW = 1 : load=0
    [map8bis2]
    load=0
    sprites$ = "minimap2 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1 Q2d Q2q indicQ"
    for s = 1 to 18
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain8]
    map=8 : region = 2 :curseurx=45:curseury=480
    sprites1$ = "minimap2 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map8= 0 and load = 0 then mX = 270 : mY = 390 : direction2 = 4 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map8= 1 and load = 0 then mX = 650 : mY = 130 : direction2 = 2 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"addsprite minimap2 minimap2; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap2 ";minimap2x;" ";minimap2y;"; spritexy curseur ";curseurx;" ";curseury;"; spritexy perso1z ";perso1zx;" ";perso1zy;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap2 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_toucheh]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain8]
    goto [deplacementBOUCLE]

    [control_toucheh]
    #3b.map,"when characterInput [w]"
    timer 80, [1h] : wait

    [1h]
    timer 0
    #3b.map,"when characterInput [control_toucheh]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    [1hSECURITY]
    if mapSELECT = 7 then goto [1gSECURITY]
    if mapSELECT = 9 then goto [1iSECURITY]
    gosub [limitesMAP8]
    goto [deplacementBOUCLE]


'carte 9 ---------------------------------------------------------------

    [map9bis]
    openW = 1
    #3b.map,"when characterInput [w]" : timer 100, [map9bis2SECURITY] : wait
    [map9bis2SECURITY]
    timer 0
    map6=2:map8=1:map9=0:load=0:astuces=2 : goto [map9bis2]
    [map9]
    #3b.map,"when characterInput [w]" : timer 100, [map9bis2SECURITY2] : wait
    [map9bis2SECURITY2]
    timer 0
    openW = 1 : load=0
    [map9bis2]
    load=0
    sprites$ = "minimap2 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain9]
    map=9 : region = 1 : curseurx= 90 : curseury=542
    sprites1$ = "minimap2 curseur hb1 hpMONSTER"
    sprites2$ = "Q2d Q2q"
    sprites5$ = "indicQ"

    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next
    for s = 1 to 2
        loadbmp word$(sprites2$,s), "bmp\perso\quetes\2\"+word$(sprites2$,s)+".bmp"
    next
    loadbmp word$(sprites5$,1), "bmp\aide\"+word$(sprites5$,1)+".bmp"

    if direction2 = 0 then direction2 = 2
    if map9= 0 and load = 0 then mX = 30 : mY = 150 : direction2 = 1 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map9= 1 and load = 0 then mX = 960 : mY = 330 : direction2 = 3 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY

    gosub [mapreg3]
    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"addsprite minimap2 minimap2; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap2 ";minimap2x;" ";minimap2y;"; spritexy curseur ";curseurx;" ";curseury;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap2 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touchei]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain9]
    goto [deplacementBOUCLE]

    [control_touchei]
    #3b.map,"when characterInput [w]"
    timer 80, [1i] : wait

    [1i]
    timer 0
    #3b.map,"when characterInput [control_touchei]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    [1iSECURITY]
    if mapSELECT = 8 then goto [1hSECURITY]
    if mapSELECT = 10 then goto [1jSECURITY]
    gosub [limitesMAP9]
    goto [deplacementBOUCLE]


'carte 10 ---------------------------------------------------------------

    [map10bis]
    openW = 1
    #3b.map,"when characterInput [w]" : timer 100, [map10bis2SECURITY] : wait
    [map10bis2SECURITY]
    timer 0
    map9=1:map10=0:astuces=2 : goto [map10bis2]
    [map10]
    #3b.map,"when characterInput [w]" : timer 100, [map10bis2SECURITY2] : wait
    [map10bis2SECURITY2]
    timer 0
    openW = 1
    [map10bis2]
    load=0
    sprites$ = "perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 14
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain10]
    map=10 : region = 2 :curseurx=125:curseury=530
    sprites1$ = "minimap2 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map10= 0 and load = 0 then mX = 30 : mY = 360 : direction2 = 1 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map10= 1 and load = 0 then mX = 300 : mY = 150 : direction2 = 2 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map10= 2 and load = 0 then mX = 960 : mY = 240 : direction2 = 3 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"addsprite minimap2 minimap2; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap2 ";minimap2x;" ";minimap2y;"; spritexy curseur ";curseurx;" ";curseury;"; spritexy ico ";icox;" ";icoy;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap2 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touchej]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain10]
    goto [deplacementBOUCLE]

    [control_touchej]
    #3b.map,"when characterInput [w]"
    timer 80, [1j] : wait

    [1j]
    timer 0
    #3b.map,"when characterInput [control_touchej]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    [1jSECURITY]
    if mapSELECT = 9 then goto [1iSECURITY]
    if mapSELECT = 11 then goto [1kSECURITY]
    gosub [limitesMAP10]
    goto [deplacementBOUCLE]


'carte 11 ---------------------------------------------------------------

    [map11bis]
    openW = 1 : #3b.map,"when characterInput [w]" : timer 100, [map11bis2SECURITY] : wait
    [map11bis2SECURITY]
    timer 0
    map10=1:map11=0:astuces=2 : goto [map11bis2]
    [map11]
    #3b.map,"when characterInput [w]" : timer 100, [map11bis2SECURITY2] : wait
    [map11bis2SECURITY2]
    timer 0
    openW = 1
    [map11bis2]
    load=0
    sprites$ = "perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 14
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain11]
    map=11 : region = 2 : map10=1:curseurx=120:curseury=510
    sprites1$ = "minimap2 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map11= 0 and load = 0 then mX = 390 : mY = 390 : direction2 = 4 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map11= 1 and load = 0 then mX = 450 : mY = 30 : direction2 = 2 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map11= 2 and load = 0 then mX = 630 : mY = 42 : direction2 = 3 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map11= 3 and load = 0 then mX = 336 : mY = 42 : direction2 = 1 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    #3b.map,"addsprite minimap2 minimap2; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap2 ";minimap2x;" ";minimap2y;"; spritexy curseur ";curseurx;" ";curseury
    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap2 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touchek]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain11]
    goto [deplacementBOUCLE]

    [control_touchek]
    #3b.map,"when characterInput [w]"
    timer 80, [1k] : wait

    [1k]
    timer 0
    #3b.map,"when characterInput [control_touchek]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    [1kSECURITY]
    if mapSELECT = 10 then goto [1jSECURITY]
    if mapSELECT = 12 then goto [1lSECURITY]
    gosub [limitesMAP11]
    goto [deplacementBOUCLE]


'carte 12 ---------------------------------------------------------------

    [map12bis]
    openW = 1 : #3b.map,"when characterInput [w]" : timer 100, [map12bis2SECURITY] : wait
    [map12bis2SECURITY]
    timer 0
    #3b.map,"SpriteVisible Eb1 off; SpriteVisible Ea1 off; SpriteVisible Ec1 off; SpriteVisible Ed1 off; SpriteVisible Eb11 off; SpriteVisible Ea11 off; SpriteVisible Ec11 off; SpriteVisible Ed11 off; SpriteVisible Eb12 off; SpriteVisible Ea12 off; SpriteVisible Ec12 off; SpriteVisible Ed12 off" : map11=1:map12=0:astuces=2 : goto [map12bis2]
    [map12]
    #3b.map,"when characterInput [w]" : timer 100, [map12bis2SECURITY2] : wait
    [map12bis2SECURITY2]
    timer 0
    openW = 1
    [map12bis2]
    load=0
    sprites$ = "minimap2 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain12]
    map=12 : region = 2 :curseurx=120:curseury=490
    AlifeE1 = 3 : AlifeE11 = 3 : AlifeE12 = 3 : AlifeE13 = 3 : AlifeE14 = 3 : AlifeE15 = 3 : AlifeE16 = 3 : AlifeE17 = 3 : AlifeE18 = 3 : AlifeE19 = 3
    sprites1$ = "minimap2 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map12= 0 and load = 0 then mX = 450 : mY = 378 : direction2 = 4 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    #3b.map,"addsprite minimap2 minimap2; addsprite curseur curseur"
    #3b.map,"spritexy minimap2 ";minimap2x;" ";minimap2y;"; spritexy curseur ";curseurx;" ";curseury
    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"SpriteVisible minimap2 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touchel]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain12]
    goto [deplacementBOUCLE]

    [control_touchel]
    #3b.map,"when characterInput [w]"
    timer 80, [1l] : wait

    [1l]
    timer 0
    #3b.map,"when characterInput [control_touchel]"
    gosub [case]
    [1lSECURITY]
    if mapSELECT = 11 then goto [1kSECURITY]
    if mapSELECT = 13 then goto [1mSECURITY]
    gosub [limitesMAP12]
    goto [deplacementBOUCLE]



'carte 13 ---------------------------------------------------------------


    [map13bis]
    openW = 1
    #3b.map,"when characterInput [w]" : timer 100, [map13bis2SECURITY] : wait
    [map13bis2SECURITY]
    timer 0
    map11=2:map12=1:map13=0:astuces=2 : goto [map13bis2]
    [map13]
    #3b.map,"when characterInput [w]" : timer 100, [map13bis2SECURITY2] : wait
    [map13bis2SECURITY2]
    timer 0
    openW = 1
    [map13bis2]
    load=0
    sprites$ = "minimap2 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain13]
    map=13 : region = 2 :curseurx=142:curseury=505
    sprites1$ = "minimap2 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map13= 0 and load = 0 then mX = 210 : mY = 90 : direction2 = 1 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map13= 1 and load = 0 then mX = perso1sx : mY = 36 : direction2 = 2 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    #3b.map,"addsprite minimap2 minimap2; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap2 ";minimap2x;" ";minimap2y;"; spritexy curseur ";curseurx;" ";curseury
    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap2 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touchem]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain13]
    goto [deplacementBOUCLE]

    [control_touchem]
    #3b.map,"when characterInput [w]"
    timer 80, [1m] : wait

    [1m]
    timer 0
    #3b.map,"when characterInput [control_touchem]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    gosub [limitesMAP13]
    goto [deplacementBOUCLE]


'carte 14 ---------------------------------------------------------------

    [map14bis]
    #3b.map,"when characterInput [w]" : timer 100, [map14bis2SECURITY] : wait
    [map14bis2SECURITY]
    timer 0
    map15=2:map13=1:map14=0:openW=1:astuces=2 : goto [map14bis2]
    [map14]
    #3b.map,"when characterInput [w]" : timer 100, [map14bis2SECURITY2] : wait
    [map14bis2SECURITY2]
    timer 0
    openW = 1
    [map14bis2]
    load=0
    sprites$ = "minimap2 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain14]
    map=14 : region = 2 :curseurx=142:curseury=485
    sprites1$ = "minimap2 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map14= 0 and load = 0 then mX = perso1zx : mY = 390 : direction2 = 4 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map14= 1 and load = 0 then mX = 36 : mY = 150 : direction2 = 1 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    #3b.map,"addsprite minimap2 minimap2; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap2 ";minimap2x;" ";minimap2y;"; spritexy curseur ";curseurx;" ";curseury
    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap2 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touchen]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain14]
    goto [deplacementBOUCLE]

    [control_touchen]
    #3b.map,"when characterInput [w]"
    timer 80, [1n] : wait

    [1n]
    timer 0
    #3b.map,"when characterInput [control_touchen]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    gosub [limitesMAP14]
    goto [deplacementBOUCLE]


'carte 15 ---------------------------------------------------------------

    [map15bis]
    #3b.map,"when characterInput [w]" : timer 100, [map15bis2SECURITY] : wait
    [map15bis2SECURITY]
    timer 0
    map11=3:map14=1:map15=0:openW=1:astuces=2 : goto [map15bis2]
    [map15]
    map14=1 : map11=3 : #3b.map,"when characterInput [w]" : timer 100, [map15bis2SECURITY2] : wait
    [map15bis2SECURITY2]
    timer 0
    openW = 1
    [map15bis2]
    load=0
    sprites$ = "minimap2 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain15]
    map=15 : region = 2 :curseurx=105:curseury=485
    sprites1$ = "minimap2 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map15= 0 and load = 0 then mX = 642 : mY = 396 : direction2 = 3 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map15= 1 and load = 0 then mX = 450 : mY = 390 : direction2 = 4 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map15= 2 and load = 0 then mX = 960 : mY = 120 : direction2 = 3 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    #3b.map,"addsprite minimap2 minimap2; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap2 ";minimap2x;" ";minimap2y;"; spritexy curseur ";curseurx;" ";curseury
    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap2 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_toucheo]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain15]
    goto [deplacementBOUCLE]

    [control_toucheo]
    #3b.map,"when characterInput [w]"
    timer 80, [1o] : wait

    [1o]
    timer 0
    #3b.map,"when characterInput [control_toucheo]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    gosub [limitesMAP15]
    goto [deplacementBOUCLE]


'carte 16 ---------------------------------------------------------------

    [map16bis]
    #3b.map,"when characterInput [w]" : timer 100, [map16bis2SECURITY] : wait
    [map16bis2SECURITY]
    timer 0
    map15=1:map16=0:openW=1:astuces=2 : goto [map16bis2]
    [map16]
    #3b.map,"when characterInput [w]" : timer 100, [map16bis2SECURITY2] : wait
    [map16bis2SECURITY2]
    timer 0
    openW = 1
    [map16bis2]
    load=0
    sprites$ = "minimap2 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain16]
    map=16 : region = 2 :curseurx=105:curseury=515
    sprites1$ = "minimap2 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map16= 0 and load = 0 then mX = 400 : mY = 12 : direction2 = 2 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    #3b.map,"addsprite minimap2 minimap2; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap2 ";minimap2x;" ";minimap2y;"; spritexy curseur ";curseurx;" ";curseury;"; spritexy perso1s ";perso1sx;" ";perso1sy
    #3b.map,"spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap2 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touchep]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain16]
    goto [deplacementBOUCLE]

    [control_touchep]
    #3b.map,"when characterInput [w]"
    timer 80, [1p] : wait

    [1p]
    timer 0
    #3b.map,"when characterInput [control_touchep]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    gosub [limitesMAP16]
    goto [deplacementBOUCLE]


'carte 17 ---------------------------------------------------------------

    [map17bis]
    #3b.map,"when characterInput [w]" : timer 100, [map17bis2SECURITY] : wait
    [map17bis2SECURITY]
    timer 0
    map10=2:map16=1:map17=0:openW=1:astuces=2 : goto [map17bis2]
    [map17]
    #3b.map,"when characterInput [w]" : timer 100, [map17bis2SECURITY2] : wait
    [map17bis2SECURITY2]
    timer 0
    openW = 1
    [map17bis2]
    load=0
    sprites$ = "perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 14
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain17]
    map=17 : region = 3 :curseurx=92:curseury=465
    sprites1$ = "minimap3 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map17= 0 and load = 0 then mX = 36 : mY = 232 : direction2 = 1 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map17= 1 and load = 0 then mX = 450 : mY = 372 : direction2 = 4 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    #3b.map,"addsprite minimap3 minimap3; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap3 ";minimap3x;" ";minimap3y;"; spritexy curseur ";curseurx;" ";curseury
    #3b.map,"spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap3 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_toucheq]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain17]
    goto [deplacementBOUCLE]

    [control_toucheq]
    #3b.map,"when characterInput [w]"
    timer 80, [1q] : wait

    [1q]
    timer 0
    #3b.map,"when characterInput [control_toucheq]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    gosub [limitesMAP17]
    goto [deplacementBOUCLE]


'carte 18 ---------------------------------------------------------------

    [map18bis]
    #3b.map,"when characterInput [w]" : timer 100, [map18bis2SECURITY] : wait
    [map18bis2SECURITY]
    timer 0
    map17=1:map18=0:openW=1:astuces=2 : goto [map18bis2]
    [map18]
    #3b.map,"when characterInput [w]" : timer 100, [map18bis2SECURITY2] : wait
    [map18bis2SECURITY2]
    timer 0
    openW = 1
    [map18bis2]
    load=0
    sprites$ = "minimap3 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain18]
    map=18 : region = 3 :curseurx=105 :curseury=490
    sprites1$ = "minimap3 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map18= 0 and load = 0 then mX = 450 : mY = 36 : direction2 = 2 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map18= 1 and load = 0 then mX = 450 : mY = 372 : direction2 = 4 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    #3b.map,"addsprite minimap3 minimap3; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap3 ";minimap3x;" ";minimap3y;"; spritexy curseur ";curseurx;" ";curseury
    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"
    #3b.map,"spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap3 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_toucher]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain18]
    goto [deplacementBOUCLE]

    [control_toucher]
    #3b.map,"when characterInput [w]"
    timer 80, [1r] : wait

    [1r]
    timer 0
    #3b.map,"when characterInput [control_toucher]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    gosub [limitesMAP18]
    goto [deplacementBOUCLE]


'carte 19 ---------------------------------------------------------------

    [map19bis]
    #3b.map,"when characterInput [w]" : timer 100, [map19bis2SECURITY] : wait
    [map19bis2SECURITY]
    timer 0
    map18=1:map19=0:map20=0:openW=1:astuces=2 : goto [map19bis2]
    [map19]
    #3b.map,"when characterInput [w]" : timer 100, [map19bis2SECURITY2] : wait
    [map19bis2SECURITY2]
    timer 0
    openW = 1
    [map19bis2]
    load=0
    sprites$ = "minimap3 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain19]
    map=19 : region = 3 :curseurx=102 :curseury=514
    sprites1$ = "minimap3 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map19= 0 and load = 0 then mX = 450 : mY = 36 : direction2 = 2 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map19= 1 and load = 0 then mX = 450 : mY = 372 : direction2 = 4 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    #3b.map,"addsprite minimap3 minimap3; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap3 ";minimap3x;" ";minimap3y;"; spritexy curseur ";curseurx;" ";curseury
    #3b.map,"spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap3 on"
    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touches]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain19]
    goto [deplacementBOUCLE]

    [control_touches]
    #3b.map,"when characterInput [w]"
    timer 80, [1s] : wait

    [1s]
    timer 0
    #3b.map,"when characterInput [control_touches]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    gosub [limitesMAP19]
    goto [deplacementBOUCLE]


'carte 20 ---------------------------------------------------------------

    [map20bis]
    #3b.map,"when characterInput [w]" : timer 100, [map20bis2SECURITY] : wait
    [map20bis2SECURITY]
    timer 0
    map19=1:map20=0:openW=1:astuces=2 : goto [map20bis2]
    [map20]
    #3b.map,"when characterInput [w]" : timer 100, [map20bis2SECURITY2] : wait
    [map20bis2SECURITY2]
    timer 0
    openW = 1
    [map20bis2]
    load=0
    sprites$ = "minimap3 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain20]
    map=20 : region = 3 :curseurx=97 :curseury=540
    sprites1$ = "minimap3 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map20= 0 and load = 0 then mX = 450 : mY = 36 : direction2 = 2 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map20= 1 and load = 0 then mX = 36 : mY = 300 : direction2 = 1 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    if map20= 2 and load = 0 then mX = 800 : mY = 300 : direction2 = 3 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"

    #3b.map,"addsprite minimap3 minimap3; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap3 ";minimap3x;" ";minimap3y;"; spritexy curseur ";curseurx;" ";curseury;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap3 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touchet]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain20]
    goto [deplacementBOUCLE]

    [control_touchet]
    #3b.map,"when characterInput [w]"
    timer 80, [1t] : wait

    [1t]
    timer 0
    #3b.map,"when characterInput [control_touchet]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    gosub [limitesMAP20]
    goto [deplacementBOUCLE]


'carte 21 ---------------------------------------------------------------

    [map21bis]
    #3b.map,"when characterInput [w]" : timer 100, [map21bis2SECURITY] : wait
    [map21bis2SECURITY]
    timer 0
    map20=2:map21=0:openW=1:astuces=2 : goto [map21bis2]
    [map21]
    #3b.map,"when characterInput [w]" : timer 100, [map21bis2SECURITY2] : wait
    [map21bis2SECURITY2]
    timer 0
    openW = 1
    [map21bis2]
    load=0
    sprites$ = "minimap3 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain21]
    map=21 : region = 3 :curseurx=125 :curseury=530
    sprites1$ = "minimap3 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map21= 0 and load = 0 then mX = 36 : mY = 384 : direction2 = 1 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    #3b.map,"addsprite minimap3 minimap3; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap3 ";minimap3x;" ";minimap3y;"; spritexy curseur ";curseurx;" ";curseury;"; spritexy perso1d ";perso1dx;" ";perso1dy;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap3 on"

    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_toucheu]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain21]
    goto [deplacementBOUCLE]

    [control_toucheu]
    #3b.map,"when characterInput [w]"
    timer 80, [1u] : wait

    [1u]
    timer 0
    #3b.map,"when characterInput [control_toucheu]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    gosub [limitesMAP21]
    goto [deplacementBOUCLE]


'carte 22 ---------------------------------------------------------------

    [map22bis]
    #3b.map,"when characterInput [w]" : timer 100, [map22bis2SECURITY] : wait
    [map22bis2SECURITY]
    timer 0
    map20=1:map22=0:openW=1:astuces=2 : goto [map22bis2]
    [map22]
    timer 100, [map22bis2SECURITY2] : wait
    [map22bis2SECURITY2]
    timer 0
    openW = 1
    [map22bis2]
    load=0
    sprites$ = "minimap3 perso1d perso2d perso4d perso1s perso2s perso4s perso1q perso2q "+_
               "perso4q perso1z perso2z perso4z curseur hb1"
    for s = 1 to 15
        unloadbmp word$(sprites$,s)
    next
    unloadbmp "JB"

    [jeuhumain22]
    map=22 : region = 3 :curseurx=70 :curseury=545
    sprites1$ = "minimap3 curseur hb1 hpMONSTER"
    gosub [mapreg2]

    for s = 1 to 4
        loadbmp word$(sprites1$,s), "bmp\"+word$(sprites1$,s)+".bmp"
    next

    if direction2 = 0 then direction2 = 2
    if map22= 0 and load = 0 then mX = 950 : mY = 282 : direction2 = 3 : perso1zx=mX : perso1zy=mY : perso1qx=mX : perso1qy=mY : perso1dx=mX : perso1dy=mY : perso1sx=mX : perso1sy=mY
    gosub [mapreg3]

    if direction2 = 1 then #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1d on"
    if direction2 = 2 then #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy;"; SpriteVisible perso1q off;SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
    if direction2 = 3 then #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy;"; SpriteVisible perso1d off;SpriteVisible perso1s off; SpriteVisible perso1z off; SpriteVisible perso1q on"
    if direction2 = 4 then #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy;"; SpriteVisible perso1q off;SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z on"

    #3b.map,"addsprite minimap3 minimap3; addsprite curseur curseur; addsprite hpMONSTER hpMONSTER; addsprite ico ico"
    #3b.map,"spritexy minimap3 ";minimap3x;" ";minimap3y;"; spritexy curseur ";curseurx;" ";curseury;"; spritexy perso1q ";perso1qx;" ";perso1qy;"; spritexy hpMONSTER ";hpMONSTERx;" ";hpMONSTERy;"; spritexy ico ";icox;" ";icoy
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off; SpriteVisible minimap3 on"

    gosub [AlifeEnnemi]
    gosub [mapreg4]

    #3b.map,"when characterInput [control_touchev]"
    if reloadBUG = 1 then openW = 0 : reloadBUG = 0 : close #3b : goto [jeuhumain22]
    goto [deplacementBOUCLE]

    [control_touchev]
    #3b.map,"when characterInput [w]"
    timer 80, [1v] : wait

    [1v]
    timer 0
    #3b.map,"when characterInput [control_touchev]"
    #3b.map,"SpriteVisible hpMONSTER off; SpriteVisible ico off"
    gosub [case]
    gosub [limitesMAP22]
    goto [deplacementBOUCLE]

'-------generateurs de cartes ------------------------------------------------------------------

    [mapreg1]
    #3b.map, "addsprite hb1 hb1; addsprite perso1d perso1d perso2d perso3d perso4d; addsprite perso1q perso1q perso2q perso3q perso4q; addsprite perso1s perso1s perso2s perso3s perso4s; addsprite perso1z perso1z perso2z perso3z perso4z; addsprite atk1 atk1; addsprite atk2 atk2"
    #3b.map, "spritexy hb1 ";hb1x;" ";hb1y+10
    #3b.map, "setfocus;down"
    #3b.map, "drawbmp JB 0 0"
    #3b.map, "background JB"
    return

    [mapreg2]
    if iniITEM = 1 then
        gosub [itemsDATA]
        gosub [equipITEM]
    end if
    gosub [closeSecur]
    WindowWidth = 1020:WindowHeight = 600 : game$ = "on" : PasseMap = 1 : mapSECUR = map
    UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2)
    system=1:agrandmap=1:sortbook=1:inventaire=1:menugame=1:minimap1x=16:minimap1y=447:hb1x=-6:hb1y=418:minimap2x=16:minimap2y=447:minimap3x=16:minimap3y=447
    hpMONSTERx = 0 : hpMONSTERy = 0 : icox = 03 : icoy = 03

    graphicbox #3b.map, 0, 0, 1020, 600
    loadbmp "JB", "bmp\map\maphum";map;".bmp"
    gosub [stopMusic2]
    if music = 0 then gosub [startMusic]

    sprites4$ = "perso1d perso2d perso3d perso4d perso1s perso2s perso3s perso4s perso1q perso2q perso3q perso4q perso1z perso2z perso3z perso4z"
    sprites3$ = "Ea1 Ea2 Ea3 Ea4 Eb1 Eb2 Eb3 Eb4 Ec1 Ec2 Ec3 Ec4 Ed1 Ed2 Ed3 Ed4 ico"

    for s = 1 to 17
        loadbmp word$(sprites3$,s), "bmp\perso\dog1\"+word$(sprites3$,s)+".bmp"
    next
    for s = 1 to 16
        if sex = 1 and campagne = 1 then loadbmp word$(sprites4$,s), "bmp\perso\CHARACT\warrior\male\"+word$(sprites4$,s)+".bmp"
        if sex = 2 and campagne = 1 then loadbmp word$(sprites4$,s), "bmp\perso\CHARACT\warrior\femelle\"+word$(sprites4$,s)+".bmp"
        if campagne = 4 then loadbmp word$(sprites4$,s), "bmp\perso\CHARACT\necrom\"+word$(sprites4$,s)+".bmp"
        if sex = 1 and campagne = 2 then loadbmp word$(sprites4$,s), "bmp\perso\CHARACT\archer\male\"+word$(sprites4$,s)+".bmp"
        if sex = 2 and campagne = 2 then loadbmp word$(sprites4$,s), "bmp\perso\CHARACT\archer\femelle\"+word$(sprites4$,s)+".bmp"
        if sex = 1 and campagne = 3 then loadbmp word$(sprites4$,s), "bmp\perso\CHARACT\mage\male\"+word$(sprites4$,s)+".bmp"
        if sex = 2 and campagne = 3 then loadbmp word$(sprites4$,s), "bmp\perso\CHARACT\mage\femelle\"+word$(sprites4$,s)+".bmp"
        if sex = 2 and campagne = 5 then loadbmp word$(sprites4$,s), "bmp\perso\CHARACT\marchand\femelle\"+word$(sprites4$,s)+".bmp"
        if sex = 1 and campagne = 5 then loadbmp word$(sprites4$,s), "bmp\perso\CHARACT\marchand\male\"+word$(sprites4$,s)+".bmp"
    next
    return

    [mapreg3]
    if openW = 0 then
        if version = 1 then open "Eternal Quest : Les Runes de l'Apocalypse " for window_nf as #3b
        if version = 2 then open "Eternal Quest : Runes of the Apocalypse " for window_nf as #3b
        openW = 1
    end if
    #3b "trapclose [quit]"
    gosub [MonsterGEN]
    gosub [mapreg1]
    return

    [mapreg4]
    openW = 1
    #3b.map, "down; fill black"
    #3b.map, "when leftButtonDown SimpleClick"
    #3b.map, "setfocus; when leftButtonDown [SimpleClickMENUingame]"
    #3b.map, "SpriteVisible atk1 off; SpriteVisible atk2 off"
    #3b.map, "drawsprites"
    #3b.map, "flush"
    return


[SimpleClickStart]
mXOLD = MouseX : mYOLD = MouseY
mX = MouseX : mY = MouseY

timer 0

if mX>796 and mX<836 and mY>470 and mY<510 then goto [inventaire]
if mX>846 and mX<886 and mY>470 and mY<510 then goto [sort]
if mX>896 and mX<936 and mY>470 and mY<510 then goto [Questmenu]
if mX>796 and mX<836 and mY>515 and mY<555 then goto [aide]
if mX>190 and mX<215 and mY>450 and mY<475 then goto [map1grand]
if mX>896 and mX<936 and mY>515 and mY<555 then MenuMode = 1 : game$ = "on" : goto [saveMain]
if mX>846 and mX<886 and mY>515 and mY<555 then goto [system]
if mX>946 and mX<986 and mY>515 and mY<555 then goto [quit]
if mX>285 and mX<320 and mY>525 and mY<560 then goto [usePOTION1]
if mX>325 and mX<355 and mY>525 and mY<560 then goto [usePOTION2]

if astuces = 1 then #3b.map,"SpriteVisible buttonHelpIntro1 off; SpriteVisible buttonHelpIntro2 off; SpriteVisible buttonHelpIntro3 off" : astuces = 2

if mY < 440 then
    BLOCKED = 0
    if mX > perso1dx then mY = mY - 30 : mX = mX - 10 : goto [marcheDROITE2]
    if mX < perso1qx then mY = mY - 30 : mX = mX - 10 : goto [marcheGAUCHE2]
    if mY < perso1zy then mY = mY - 30 : mX = mX - 10 : goto [marcheHAUT2]
    if mY > perso1sy then mY = mY - 30 : mX = mX - 10 : goto [marcheBAS2]
end if

mX = mXOLD : mY = mYOLD
timer 100, [deplacementBOUCLE]
wait

            [SimpleClickMENUingame]
            mX = MouseX
            mY = MouseY
            if mX>796 and mX<836 and mY>470 and mY<510 then goto [inventaire]
            if mX>846 and mX<886 and mY>470 and mY<510 then goto [sort]
            if mX>896 and mX<936 and mY>470 and mY<510 then goto [Questmenu]
            if mX>796 and mX<836 and mY>515 and mY<555 then goto [aide]
            if mX>190 and mX<215 and mY>450 and mY<475 then goto [map1grand]
            if mX>896 and mX<936 and mY>515 and mY<555 then MenuMode = 1 : game$ = "on" : goto [saveMain]
            if mX>846 and mX<886 and mY>515 and mY<555 then goto [system]
            if mX>946 and mX<986 and mY>515 and mY<555 then goto [quit]
            if mX>285 and mX<320 and mY>525 and mY<560 then goto [usePOTION1]
            if mX>325 and mX<355 and mY>525 and mY<560 then goto [usePOTION2]
            wait

[usePOTION1]
if potionHEAL1 >= 1 and PV < PVTotal then
    potionHEAL1 = potionHEAL1 - 1
    PV = int(PV + (PVTotal/3))
    if PV > PVTotal then PV = PVTotal
end if
timer int(100-passive5), [deplacementBOUCLE]
wait
[usePOTION2]
if potionHEAL2 >= 1 and PV < PVTotal then
    potionHEAL2 = potionHEAL2 - 1
    PV = int(PV + (PVTotal/1.5))
    if PV > PVTotal then PV = PVTotal
end if
timer int(100-passive5), [deplacementBOUCLE]
wait
'-----------------------------------------------------------------------------------------------------------------------------------
[AlifeEnnemi]
    if AlifeE1 = 0 or AlifeE1 = 2 then print #3b.map,"SpriteVisible Ea1 off; SpriteVisible Eb1 off; SpriteVisible Ec1 off; SpriteVisible Ed1 off"
    if AlifeE11 = 0 or AlifeE11 = 2 then print #3b.map,"SpriteVisible Ea11 off; SpriteVisible Eb11 off; SpriteVisible Ec11 off; SpriteVisible Ed11 off"
    if AlifeE12 = 0 or AlifeE12 = 2 then print #3b.map,"SpriteVisible Ea12 off; SpriteVisible Eb12 off; SpriteVisible Ec12 off; SpriteVisible Ed12 off"
    if AlifeE13 = 0 or AlifeE13 = 2 then print #3b.map,"SpriteVisible Ea13 off; SpriteVisible Eb13 off; SpriteVisible Ec13 off; SpriteVisible Ed13 off"
    if AlifeE14 = 0 or AlifeE14 = 2 then print #3b.map,"SpriteVisible Ea14 off; SpriteVisible Eb14 off; SpriteVisible Ec14 off; SpriteVisible Ed14 off"
    if AlifeE15 = 0 or AlifeE15 = 2 then print #3b.map,"SpriteVisible Ea15 off; SpriteVisible Eb15 off; SpriteVisible Ec15 off; SpriteVisible Ed15 off"
    if AlifeE16 = 0 or AlifeE16 = 2 then print #3b.map,"SpriteVisible Ea16 off; SpriteVisible Eb16 off; SpriteVisible Ec16 off; SpriteVisible Ed16 off"
    if AlifeE17 = 0 or AlifeE17 = 2 then print #3b.map,"SpriteVisible Ea17 off; SpriteVisible Eb17 off; SpriteVisible Ec17 off; SpriteVisible Ed17 off"
    if AlifeE18 = 0 or AlifeE18 = 2 then print #3b.map,"SpriteVisible Ea18 off; SpriteVisible Eb18 off; SpriteVisible Ec18 off; SpriteVisible Ed18 off"
    if AlifeE19 = 0 or AlifeE19 = 2 then print #3b.map,"SpriteVisible Ea19 off; SpriteVisible Eb19 off; SpriteVisible Ec19 off; SpriteVisible Ed19 off"
    return

'-----sous-fenetres-------------------------------------------------------------------------------------------------------------------|


            [inventaire]
            timer 0
            inventaire = 2 : astuces = 2 : load = 1
            if bruitage = 0 then playwave "music\hit.wav", async
            WindowWidth=1020:WindowHeight = 600 : UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2)
            loadbmp "INV", "bmp\invent.bmp"
            loadbmp "potion", "bmp\items\lifePOTION.bmp"
            loadbmp "potion2", "bmp\items\lifePOTION2.bmp"
            loadbmp "armor1", "bmp\items\armor\chemise1.bmp"
            loadbmp "epee1", "bmp\items\armor\epee1.bmp"
            loadbmp "pant1", "bmp\items\armor\pant1.bmp"
            loadbmp "boots1", "bmp\items\armor\boots1.bmp"
            loadbmp "sacocheQuete1", "bmp\items\quest\act1\sacocheQuete1.bmp"

            #3b,"trapclose [w]"
            #3b.map, "down"
            [REFRESHinventaire]
            #3b.map,"when characterInput [w]"
            #3b.map, "setfocus; when leftButtonDown [inventoryCLICK]"
            #3b.map, "drawbmp INV 0 0"
            print #3b.map, "background INV"
            print #3b.map, "font Times New Roman 10; color white; backcolor black"

            gosub [itemsDATA]

            if version = 1 then
                print #3b.map, "place 250 60 ;\"; "Niveau : "; lvlHero
                print #3b.map, "place 900 60 ;\"; "FERMER"
                print #3b.map, "place 122 42 ;\"; "Heaume"
                print #3b.map, "place 270 115 ;\"; "Armure"
                print #3b.map, "place 250 310 ;\"; "Pantalon"
                print #3b.map, "place 67 215 ;\"; "Bras"
                print #3b.map, "place 302 215 ;\"; "Bras"
                print #3b.map, "place 55 145 ;\"; "Gants"
                print #3b.map, "place 125 440 ;\"; "Bottes"
                print #3b.map, "place 75 480 ;\"; "Anneau"
                print #3b.map, "place 140 480 ;\"; "Anneau"
                print #3b.map, "place 265 480 ;\"; "Amulette"
                print #3b.map, "place 420 55 ;\"; "P.V : ";PV;" / ";PVTotal
                print #3b.map, "place 420 80 ;\"; "P.M : ";PM;" / ";PMTotal
                print #3b.map, "place 580 55 ;\"; "Attaque : ";atk
                print #3b.map, "place 580 80 ;\"; "Défense : ";def
                print #3b.map, "place 720 55 ;\"; "Monnaie : ";gold
            end if
            if version = 2 then
                print #3b.map, "place 250 60 ;\"; "Level : "; lvlHero
                print #3b.map, "place 900 60 ;\"; "CLOSE"
                print #3b.map, "place 122 42 ;\"; "Helmet"
                print #3b.map, "place 270 115 ;\"; "Armor"
                print #3b.map, "place 250 310 ;\"; "Pants"
                print #3b.map, "place 67 215 ;\"; "Arm"
                print #3b.map, "place 302 215 ;\"; "Arm"
                print #3b.map, "place 55 145 ;\"; "Gloves"
                print #3b.map, "place 125 440 ;\"; "Boots"
                print #3b.map, "place 75 480 ;\"; "Ring"
                print #3b.map, "place 140 480 ;\"; "Ring"
                print #3b.map, "place 265 480 ;\"; "Amulet"
                print #3b.map, "place 420 55 ;\"; "H.P : ";PV;" / ";PVTotal
                print #3b.map, "place 420 80 ;\"; "P.M : ";PM;" / ";PMTotal
                print #3b.map, "place 580 55 ;\"; "Attack : ";atk
                print #3b.map, "place 580 80 ;\"; "Defense : ";def
                print #3b.map, "place 720 55 ;\"; "Monney : ";gold
            end if

            print #3b.map, "size 1"
            print #3b.map, "place 975 "; 43
            print #3b.map, "box 875 "; 43 + 25

            if Qvoleur = 3 then Xinventory = 389 : Yinventory = 103 : NombreItemInventaire = NombreItemInventaire + 1 : print #3b.map, "drawbmp sacocheQuete1 ";Xinventory;" ";Yinventory;""

            'items equipés
            if NameArmure$ = "Chemise Simple" or NameArmure$ = "Single shirt" and equipITEMa1 = 1 then armorEquip = 1 : print #3b.map, "drawbmp armor1 ";269;" ";123;""
            if NameBras1$ = "Simple épée" or NameBras1$ = "Single sword" and equipITEMe1 = 1 then bras1Equip = 1 : print #3b.map, "drawbmp epee1 ";57;" ";222;""
            if NamePantalon$ = "Bas Simple" or NamePantalon$ = "Single bottom" and equipITEMp1 = 1 then pant1Equip = 1 : print #3b.map, "drawbmp pant1 ";253;" ";315;""
            if NameBottes$ = "Chaussures simple" or NameBottes$ = "Single shoes" and equipITEMb1 = 1 then boots1Equip = 1 : print #3b.map, "drawbmp boots1 ";121;" ";384;""
            if potionHEAL1 >99 then potionHEAL1 = 99
            if potionHEAL2 >99 then potionHEAL2 = 99

            if potionHEAL1 > 0 then
                NombreItemInventaire = NombreItemInventaire + 1
                potionSECU = 1
                gosub [caseINVENTORY]
                potionSECU = 0 : PositionXpotion1 = Xinventory : PositionYpotion1 = Yinventory
                print #3b.map, "drawbmp potion ";Xinventory;" ";Yinventory;""
                print #3b.map, "font Times New Roman 7; color white; backcolor black"
                print #3b.map, "place ";Xinventory-5;" ";Yinventory+26;" ;\"; potionHEAL1
            end if
            if potionHEAL2 > 0 then
                NombreItemInventaire = NombreItemInventaire + 1
                potionSECU = 1
                gosub [caseINVENTORY]
                potionSECU = 0 : PositionXpotion2 = Xinventory : PositionYpotion2 = Yinventory
                print #3b.map, "drawbmp potion2 ";Xinventory+6;" ";Yinventory-3;""
                print #3b.map, "font Times New Roman 7; color white; backcolor black"
                print #3b.map, "place ";Xinventory-5;" ";Yinventory+24;" ;\"; potionHEAL2
            end if


            if nombreITEMchemise1 > 0 then
                NombreItemInventaire = NombreItemInventaire + 1
                gosub [caseINVENTORY]
                positionArmor1x = Xinventory
                positionArmor1y = Yinventory
                print #3b.map, "drawbmp armor1 ";Xinventory;" ";Yinventory;""
                print #3b.map, "font Times New Roman 7; color white"
                if nombreITEMchemise1< 1 then nombreITEMchemise1 = 1
                print #3b.map, "backcolor black ; place ";Xinventory+2;" ";Yinventory+37;" ;\"; nombreITEMchemise1
            end if
            if nombreITEMepee1> 0 then
                NombreItemInventaire = NombreItemInventaire + 1
                gosub [caseINVENTORY]
                positionEpee1x = Xinventory
                positionEpee1y = Yinventory
                print #3b.map, "drawbmp epee1 ";Xinventory;" ";Yinventory;""
                print #3b.map, "font Times New Roman 7; color white"
                if nombreITEMepee1< 1 then nombreITEMepee1 = 1
                print #3b.map, "backcolor black ; place ";Xinventory+2;" ";Yinventory+37;" ;\"; nombreITEMepee1
            end if
            if nombreITEMpant1> 0 then
                NombreItemInventaire = NombreItemInventaire + 1
                gosub [caseINVENTORY]
                positionPant1x = Xinventory
                positionPant1y = Yinventory
                print #3b.map, "drawbmp pant1 ";Xinventory;" ";Yinventory;""
                print #3b.map, "font Times New Roman 7; color white"
                if nombreITEMpant1< 1 then nombreITEMpant1 = 1
                print #3b.map, "backcolor black ; place ";Xinventory+2;" ";Yinventory+37;" ;\"; nombreITEMpant1
            end if
            if nombreITEMboots1> 0 then
                NombreItemInventaire = NombreItemInventaire + 1
                gosub [caseINVENTORY]
                positionBoots1x = Xinventory
                positionBoots1y = Yinventory
                print #3b.map, "drawbmp boots1 ";Xinventory;" ";Yinventory;""
                print #3b.map, "font Times New Roman 7; color white"
                if nombreITEMboots1< 1 then nombreITEMboots1 = 1
                print #3b.map, "backcolor black ; place ";Xinventory+2;" ";Yinventory+37;" ;\"; nombreITEMboots1
            end if
            print #3b.map, "flush"
            wait

[useITEMpotion]
if removePOTION1 = 1 and potionHEAL1 > 0 and PV< PVTotal then potionHEAL1 = potionHEAL1 - 1 : PV = int(PV + (PVTotal/3)) : if PV > PVTotal then PV = PVTotal
if removePOTION1 = 1 and potionHEAL1 <= 0 then close #test : removePOTION1 = 0 : INFOITEM = 0
if removePOTION2 = 1 and potionHEAL2 > 0 and PV< PVTotal then potionHEAL2 = potionHEAL2 - 1 : PV = int(PV + (PVTotal/1.5)): if PV > PVTotal then PV = PVTotal
if removePOTION2 = 1 and potionHEAL2 <= 0 then close #test : removePOTION2 = 0 : INFOITEM = 0
NombreItemInventaire = 0
goto [REFRESHinventaire]

            [inventoryCLICK]
            mX = MouseX
            mY = MouseY
            if INFOITEM = 1 then gosub [killitem]
            'potions
            if MouseX > PositionXpotion1 and MouseX < PositionXpotion1 +40 and MouseY > PositionYpotion1 and MouseY< PositionYpotion1 +40 and potionHEAL1> 0 then
                if INFOITEM = 1 then gosub [killitem]
                INFOITEM = 1 : removePOTION1 = 1
                WindowWidth = 200  :WindowHeight = 120 : UpperLeftX= WindowWidth + PositionXpotion1 +10 : UpperLeftY= WindowHeight + PositionYpotion1 -25
                graphicbox #test.map, 0, 0, 220, 120
                button #test, "Utiliser", [useITEMpotion], UL, 65, 60
                open "" for window_nf as #test
                #test,"trapclose [CLOSEitemsINFO]"
                #test.map, "down"
                print #test.map, "font Times New Roman 9; fill white; color black; backcolor white"
                print #test.map, "place 20 20 ;\"; "Petite Potion de soin"
                print #test.map, "place 20 40 ;\"; "PV restauré : "; int(PVTotal/10)
                print #test.map, "flush"
                wait
            end if
            if MouseX > PositionXpotion2 and MouseX < PositionXpotion2 +40 and MouseY > PositionYpotion2 and MouseY< PositionYpotion2 +40 and potionHEAL2> 0 then
                if INFOITEM = 1 then gosub [killitem]
                INFOITEM = 1 : removePOTION2 = 1
                WindowWidth = 200  :WindowHeight = 120 : UpperLeftX= WindowWidth + PositionXpotion2 +10 : UpperLeftY= WindowHeight + PositionYpotion2 -25
                graphicbox #test.map, 0, 0, 220, 120
                button #test, "Utiliser", [useITEMpotion], UL, 65, 60
                open "" for window_nf as #test
                #test,"trapclose [CLOSEitemsINFO]"
                #test.map, "down"
                print #test.map, "font Times New Roman 9; fill white ;color black; backcolor white"
                print #test.map, "place 20 20 ;\"; "Potion de soin moyenne"
                print #test.map, "place 20 40 ;\"; "PV restauré : "; int((PVTotal/100)*25)
                print #test.map, "flush"
                wait
            end if

            'item arm 1
            gosub [itemsDATA]
            if MouseX > 50 and MouseX < 100 and MouseY > 220 and MouseY< 260  and bras1Equip = 1 then
                if INFOITEM = 1 then gosub [killitem]
                    INFOITEM = 1
                    removeARME = 1
                    WindowWidth = 200  :WindowHeight = 200
                    UpperLeftX= WindowWidth + 80
                    UpperLeftY= WindowHeight + 130
                    graphicbox #test.map, 0, 0, 220, 220
                    button #test, "Ranger", [removeITEM], UL, 70, 130
                    open "" for window_nf as #test
                    #test,"trapclose [CLOSEitemsINFO]"
                    #test.map, "down"
                    print #test.map, "drawbmp epee1 20 20"
                    print #test.map, "font Times New Roman 9; fill white; color black"
                    print #test.map, "backcolor white ; place 20 30 ;\"; epee1FR$
                    print #test.map, "backcolor white ; place 20 50 ;\"; "Niveau : ";LvlBras1
                    print #test.map, "backcolor white ; place 20 90 ;\"; "Attaque : + "; epee1valATK
                    print #test.map, "flush"
                    wait
            end if
            if MouseX > positionEpee1x and MouseX < positionEpee1x +40 and MouseY > positionEpee1y and MouseY< positionEpee1y +40 and nombreITEMepee1> 0 then
                if INFOITEM = 1 then gosub [killitem]
                    INFOITEM = 1
                    removeARME = 1
                    epee1valATK=6 + 1* LvlBras1
                    epee1valGold=42 + 5*LvlBras1
                    WindowWidth = 200  :WindowHeight = 200
                    UpperLeftX= WindowWidth + positionEpee1x +20
                    UpperLeftY= WindowHeight + positionEpee1y -90
                    graphicbox #test.map, 0, 0, 220, 220
                    button #test, "Equiper", [equipITEM], UL, 65, 130
                    'button #test, "R", [removeITEM], UL, 50, 130
                    open "" for window_nf as #test
                    #test,"trapclose [CLOSEitemsINFO]"
                    #test.map, "down"
                    print #test.map, "drawbmp epee1 20 20"
                    print #test.map, "font Times New Roman 9; fill white; color black"
                    print #test.map, "backcolor white ; place 20 30 ;\"; epee1FR$
                    print #test.map, "backcolor white ; place 20 50 ;\"; "Niveau : ";LvlBras1
                    print #test.map, "backcolor white ; place 20 90 ;\"; "Attaque : + "; epee1valATK
                    print #test.map, "flush"
                    wait
            end if

            'item armure
            if MouseX > 262 and MouseX < 312 and MouseY > 121 and MouseY< 161 and armorEquip = 1 then
                if INFOITEM = 1 then gosub [killitem]
                    INFOITEM = 1
                    removeARMOR = 1
                    WindowWidth = 200  :WindowHeight = 200
                    UpperLeftX= WindowWidth + 300
                    UpperLeftY= WindowHeight + 20
                    button #test, "Ranger", [removeITEM], UL, 70, 130
                    graphicbox #test.map, 0, 0, 220, 220
                    open "" for window_nf as #test
                    #test,"trapclose [CLOSEitemsINFO]"
                    #test.map, "down"
                    print #test.map, "drawbmp armor1 20 20"
                    print #test.map, "font Times New Roman 9; fill white; color black"
                    print #test.map, "backcolor white ; place 20 30 ;\"; armor1FR$
                    print #test.map, "backcolor white ; place 20 50 ;\"; "Niveau : ";LvlArmure
                    print #test.map, "backcolor white ; place 20 90 ;\"; "Armure : + "; armor1valDef
                    print #test.map, "backcolor white ; place 20 110 ;\"; "Santé : + "; armor1valPV
                    print #test.map, "flush"
                    wait
            end if
            if MouseX > positionArmor1x and MouseX < positionArmor1x +40 and MouseY > positionArmor1y and MouseY< positionArmor1y +40 and nombreITEMchemise1> 0 then
                if INFOITEM = 1 then gosub [killitem]
                    INFOITEM = 1
                    removeARMOR = 1
                    armor1valDef=0 + 1*LvlArmure-1
                    armor1valPV= 6 + 5*LvlArmure-1
                    WindowWidth = 200  :WindowHeight = 200
                    UpperLeftX= WindowWidth + positionArmor1x +20
                    UpperLeftY= WindowHeight + positionArmor1y -90
                    graphicbox #test.map, 0, 0, 220, 220
                    button #test, "Equiper", [equipITEM], UL, 65, 130
                    'button #test, "R", [removeITEM], UL, 50, 130
                    open "" for window_nf as #test
                    #test,"trapclose [CLOSEitemsINFO]"
                    #test.map, "down"
                    print #test.map, "drawbmp armor1 20 20"
                    print #test.map, "font Times New Roman 9; fill white; color black"
                    print #test.map, "backcolor white ; place 20 30 ;\"; armor1FR$
                    print #test.map, "backcolor white ; place 20 50 ;\"; "Niveau : ";LvlArmure
                    print #test.map, "backcolor white ; place 20 90 ;\"; "Armure : + "; armor1valDef
                    print #test.map, "backcolor white ; place 20 110 ;\"; "Santé : + "; armor1valPV
                    print #test.map, "flush"
                    wait
            end if

            'item pantalon
            if MouseX > 250 and MouseX < 290 and MouseY > 310 and MouseY< 350 and pant1Equip = 1 then
                if INFOITEM = 1 then gosub [killitem]
                    INFOITEM = 1
                    removePANT = 1
                    pant1valDef=0 + 2*LvlPantalon-1
                    WindowWidth = 200  :WindowHeight = 200
                    UpperLeftX= WindowWidth + 280
                    UpperLeftY= WindowHeight + 100
                    button #test, "Ranger", [removeITEM], UL, 70, 130
                    graphicbox #test.map, 0, 0, 220, 220
                    open "" for window_nf as #test
                    #test,"trapclose [CLOSEitemsINFO]"
                    #test.map, "down"
                    print #test.map, "drawbmp pant1 20 20"
                    print #test.map, "font Times New Roman 9; fill white; color black"
                    print #test.map, "backcolor white ; place 20 30 ;\"; pant1FR$
                    print #test.map, "backcolor white ; place 20 50 ;\"; "Niveau : ";LvlPantalon
                    print #test.map, "backcolor white ; place 20 90 ;\"; "Armure : + "; pant1valDef
                    print #test.map, "backcolor white ; place 20 110 ;\"; "Santé : + "; pant1valPV
                    print #test.map, "flush"
                    wait
            end if
            if MouseX > positionPant1x and MouseX < positionPant1x +40 and MouseY > positionPant1y and MouseY< positionPant1y +40 and nombreITEMpant1> 0 then
                if INFOITEM = 1 then gosub [killitem]
                    INFOITEM = 1
                    removePANT = 1
                    pant1valDef=0 + 2*LvlPantalon-1
                    pant1valPV=2 + 4*LvlPantalon-1
                    WindowWidth = 200  :WindowHeight = 200
                    UpperLeftX= WindowWidth + positionPant1x +20
                    UpperLeftY= WindowHeight + positionPant1y -90
                    graphicbox #test.map, 0, 0, 220, 220
                    button #test, "Equiper", [equipITEM], UL, 65, 130
                    'button #test, "R", [removeITEM], UL, 50, 130
                    open "" for window_nf as #test
                    #test,"trapclose [CLOSEitemsINFO]"
                    #test.map, "down"
                    print #test.map, "drawbmp pant1 20 20"
                    print #test.map, "font Times New Roman 9; fill white; color black"
                    print #test.map, "backcolor white ; place 20 30 ;\"; pant1FR$
                    print #test.map, "backcolor white ; place 20 50 ;\"; "Niveau : ";LvlPantalon
                    print #test.map, "backcolor white ; place 20 90 ;\"; "Armure : + "; pant1valDef
                    print #test.map, "backcolor white ; place 20 110 ;\"; "Santé : + "; pant1valPV
                    print #test.map, "flush"
                    wait
            end if

        'item boots
            if MouseX > 110 and MouseX < 160 and MouseY > 370 and MouseY< 420 and boots1Equip = 1 then
                if INFOITEM = 1 then gosub [killitem]
                    INFOITEM = 1
                    removeBOOTS = 1
                    WindowWidth = 200  :WindowHeight = 200
                    UpperLeftX= WindowWidth + 150
                    UpperLeftY= WindowHeight + 250
                    button #test, "Ranger", [removeITEM], UL, 70, 130
                    graphicbox #test.map, 0, 0, 220, 220
                    open "" for window_nf as #test
                    #test,"trapclose [CLOSEitemsINFO]"
                    #test.map, "down"
                    print #test.map, "drawbmp boots1 20 20"
                    print #test.map, "font Times New Roman 9; fill white; color black"
                    print #test.map, "backcolor white ; place 20 30 ;\"; chausse1FR$
                    print #test.map, "backcolor white ; place 20 50 ;\"; "Niveau : ";LvlBoots
                    print #test.map, "backcolor white ; place 20 90 ;\"; "Armure : + "; chausse1valDef
                    print #test.map, "backcolor white ; place 20 110 ;\"; "Santé : + "; chausse1valPV
                    print #test.map, "flush"
                    wait
            end if
            if MouseX > positionBoots1x and MouseX < positionBoots1x +40 and MouseY > positionBoots1y and MouseY< positionBoots1y +40 and nombreITEMboots1> 0 then
                if INFOITEM = 1 then gosub [killitem]
                    INFOITEM = 1
                    removeBOOTS = 1
                    chausse1valDef=1+ 1*LvlBoots-1
                    chausse1valPV=0+ 2*LvlBoots-1
                    WindowWidth = 200  :WindowHeight = 200
                    UpperLeftX= WindowWidth + positionPant1x +20
                    UpperLeftY= WindowHeight + positionPant1y -90
                    graphicbox #test.map, 0, 0, 220, 220
                    button #test, "Equiper", [equipITEM], UL, 65, 130
                    'button #test, "R", [removeITEM], UL, 50, 130
                    open "" for window_nf as #test
                    #test,"trapclose [CLOSEitemsINFO]"
                    #test.map, "down"
                    print #test.map, "drawbmp boots1 20 20"
                    print #test.map, "font Times New Roman 9; fill white; color black"
                    print #test.map, "backcolor white ; place 20 30 ;\"; chausse1FR$
                    print #test.map, "backcolor white ; place 20 50 ;\"; "Niveau : ";LvlBoots
                    print #test.map, "backcolor white ; place 20 90 ;\"; "Armure : + "; chausse1valDef
                    print #test.map, "backcolor white ; place 20 110 ;\"; "Santé : + "; chausse1valPV
                    print #test.map, "flush"
                    wait
            end if
            lc = 20
            if mX>int(44*lc) and mX<int((44*lc)+95) and mY>int(2*lc) and mY<int((2*lc)+40) then NombreItemInventaire = 0 : inventaire = 0 : BLOCKED = 1 : goto [reload3]
            wait


    [killitem]
    if INFOITEM = 1 then
        close #test
        INFOITEM = 0
        removeARMOR = 0
        removeARME = 0
        removeBOOTS = 0
        removePANT = 0
        INFOITEM = 0
        removePOTION1 = 0
        removePOTION2 = 0
    end if


    print #3b.map, "font Times New Roman 10; color white"
    if version = 1 then
            print #3b.map, "backcolor black ; place 420 55 ;\"; "P.V : ";PV;" / ";PVTotal
            print #3b.map, "backcolor black ; place 420 80 ;\"; "P.M : ";PM;" / ";PMTotal
            print #3b.map, "backcolor black ; place 580 55 ;\"; "Attaque : ";atk
            print #3b.map, "backcolor black ; place 580 80 ;\"; "Défense : ";def
            print #3b.map, "backcolor black ; place 720 55 ;\"; "Monnaie : ";gold
    end if
    if version = 2 then
            print #3b.map, "backcolor black ; place 420 55 ;\"; "H.P : ";PV;" / ";PVTotal
            print #3b.map, "backcolor black ; place 420 80 ;\"; "P.M : ";PM;" / ";PMTotal
            print #3b.map, "backcolor black ; place 580 55 ;\"; "Attack : ";atk
            print #3b.map, "backcolor black ; place 580 80 ;\"; "Defense : ";def
            print #3b.map, "backcolor black ; place 720 55 ;\"; "Monney : ";gold
    end if
    return

    [removeITEM]
    'armures
    if NameArmure$ = "Chemise Simple" or NameArmure$ = "Single shirt" and equipITEMa1 = 1 and removeARMOR = 1 then
        equipITEMa1 = 0
        nombreITEMchemise1 = nombreITEMchemise1 +1
        NameArmure$ = ""
        armorEquip = 0
        PV = PV - armor1valPV
        PVTotal =  PVTotal - armor1valPV
        def = def - armor1valDef
    end if
    'armes1
    if NameBras1$ = "Simple épée" or NameBras1$ = "Single sword" and equipITEMe1 = 1 and removeARME = 1 then
        equipITEMe1 = 0
        nombreITEMepee1 = nombreITEMepee1 +1
        NameBras1$ = ""
        bras1Equip = 0
        atk = atk - epee1valATK
    end if
    if NamePantalon$ = "Bas Simple" or NamePantalon$ = "Single bottom" and equipITEMp1 = 1 and removePANT = 1 then
        equipITEMp1 = 0
        pant1valDef=0 + 2*LvlPantalon-1
        pant1valPV=2 + 4*LvlPantalon-1
        nombreITEMpant1 = nombreITEMpant1 +1
        NamePantalon$ = ""
        pant1Equip = 0
        PV = PV - pant1valPV
        def = def - pant1valDef
        PVTotal =  PVTotal - pant1valPV
    end if
    if NameBottes$ = "Chaussures simple" or NameBottes$ = "Single shoes" and equipITEMb1 = 1 and removeBOOTS = 1 then
        equipITEMb1 = 0
        nombreITEMboots1 = nombreITEMboots1 +1
        NameBottes$ = ""
        boots1Equip = 0
        PV = PV - chausse1valPV
        def = def - chausse1valDef
        PVTotal =  PVTotal - chausse1valPV
    end if

    removeARME = 0 : removeARMOR = 0 : removePANT = 0 : removeBOOTS = 0 : NombreItemInventaire = 0 : INFOITEM = 0
    close #test
    goto [REFRESHinventaire]


    [equipITEM]
    'armures
    if iniITEM = 1 then
        equipITEMa1 = 0 : removeARMOR = 1
        equipITEMe1 = 0 : removeARME = 1
        equipITEMp1 = 0 : removePANT = 1
        equipITEMb1 = 0 : removeBOOTS = 1
    end if
    if equipITEMa1 = 0 and removeARMOR = 1 then
        equipITEMa1 = 1
        nombreITEMchemise1 = nombreITEMchemise1 -1
        NameArmure$ = armor1FR$
        armorEquip = 1
        PV = PV + armor1valPV
        PVTotal =  PVTotal + armor1valPV
    end if
    'armes
    if equipITEMe1 = 0 and removeARME = 1 then
        equipITEMe1 = 1
        nombreITEMepee1 = nombreITEMepee1 -1
        NameBras1$ = epee1FR$
        bras1Equip = 1
        atk = atk + epee1valATK
    end if
    'bas
    if equipITEMp1 = 0 and removePANT = 1 then
        equipITEMp1 = 1
        nombreITEMpant1 = nombreITEMpant1 -1
        NamePantalon$ = pant1FR$
        pant1Equip = 1
        PV = PV + pant1valPV
        def = def + pant1valDef
        PVTotal =  PVTotal + pant1valPV
    end if
    if equipITEMb1 = 0 and removeBOOTS = 1 then
        equipITEMb1 = 1
        nombreITEMboots1 = nombreITEMboots1 -1
        NameBottes$ = chausse1FR$
        boots1Equip = 1
        PV = PV + chausse1valPV
        def = def + chausse1valDef
        PVTotal =  PVTotal + chausse1valPV
    end if
    removeARME = 0 : removeARMOR = 0 : removePANT = 0 : removeBOOTS = 0 : NombreItemInventaire = 0 : INFOITEM = 0
    if iniITEM = 1 then iniITEM = 0 : return
    close #test
    goto [REFRESHinventaire]

    [CLOSEitemsINFO]
    close #test
    removeARMOR = 0
    removeARME = 0
    removePANT = 0
    removeBOOTS = 0
    INFOITEM = 0
    removePOTION = 0
    wait

    [caseINVENTORY]
    select case NombreItemInventaire
         case 1
            if potionSECU = 1 then Xinventory = 400 : Yinventory = 112
            if potionSECU = 0 then Xinventory = 389 : Yinventory = 103
         case 2
            if potionSECU = 1 then Xinventory = 400 : Yinventory = 156
            if potionSECU = 0 then Xinventory = 389 : Yinventory = 145
         case 3
            if potionSECU = 1 then Xinventory = 400 : Yinventory = 196
            if potionSECU = 0 then Xinventory = 389 : Yinventory = 187
         case 4
            if potionSECU = 1 then Xinventory = 400 : Yinventory = 236
            if potionSECU = 0 then Xinventory = 389 : Yinventory = 229
         case 5
            if potionSECU = 1 then Xinventory = 400 : Yinventory = 276
            if potionSECU = 0 then Xinventory = 389 : Yinventory = 271
        case 6
            if potionSECU = 1 then Xinventory = 400 : Yinventory = 306
            if potionSECU = 0 then Xinventory = 389 : Yinventory = 313
    end select
    return

            [Questmenu]
            timer 0

            astuces = 2 : lc = 20 : load = 1
            if bruitage = 0 then playwave "music\hit.wav", async
            WindowWidth=1020:WindowHeight = 600 : UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2)
            #3b,"trapclose [w]"
            #3b.map, "down; fill black; when characterInput [w]; setfocus; when leftButtonDown [SimpleClick4]"
            print #3b.map, "flush"
            print #3b.map, "size 1; color white"
            print #3b.map, "line "; 500; " "; 120; " "; 500; " "; 500
            print #3b.map, "place 970 "; 28
            print #3b.map, "box 870 "; 28 + 25

            gosub [QuestDATA]

            if version = 1 then
            print #3b.map, "font Times New Roman 18; color white"
            print #3b.map, "backcolor black ; place 380 60 ;\"; "JOURNAL DES QUÊTES"
            print #3b.map, "font Times New Roman 14 underscore; color white"
            print #3b.map, "backcolor black ; place 50 150 ;\"; "Quêtes Principales :"
            print #3b.map, "backcolor black ; place 550 150 ;\"; "Quêtes Optionelles :"
            print #3b.map, "font Times New Roman 10; color white"
            print #3b.map, "backcolor black ; place 895 45 ;\"; "FERMER"
            print #3b.map, "backcolor black ; place 550 200 ;\";" -   ";NameQUEST1$; " " ; NotORnotNOT1$
            print #3b.map, "backcolor black ; place 550 215 ;\";" -   ";NameQUEST2$; " " ; NotORnotNOT2$
            end if
            if version = 2 then
            print #3b.map, "font Times New Roman 18; color white"
            print #3b.map, "backcolor black ; place 420 60 ;\"; "Quests Log"
            print #3b.map, "font Times New Roman 14 underscore; color white"
            print #3b.map, "backcolor black ; place 50 150 ;\"; "Main Quests :"
            print #3b.map, "backcolor black ; place 550 150 ;\"; "Optional Quests :"
            print #3b.map, "font Times New Roman 10; color white"
            print #3b.map, "backcolor black ; place 895 45 ;\"; "CLOSE"
            print #3b.map, "backcolor black ; place 550 200 ;\";" -   ";NameQUEST1$; " " ; NotORnotNOT1$
            print #3b.map, "backcolor black ; place 550 215 ;\";" -   ";NameQUEST2$; " " ; NotORnotNOT2$
            end if
            Questmenu = 2
            wait

    [SimpleClick4]
    mX = MouseX
    mY = MouseY
    if mX>int(44*lc) and mX<int((44*lc)+95) and mY>int(1*lc) and mY<int((1*lc)+40) then
        [closeQUESTS]
        Questmenu = 0 : BLOCKED = 1 : goto [reload3]
    end if
    wait

[QuestDATA]
l = 9 : c = 9
dim tableau$(c, l)

if Qvoleur = 1 or Qvoleur = 2 then
    if version = 1 then quest1$ = "La sacoche" : NotORnotNOT1$ = "  (en cours...)"
    if version = 2 then quest1$ = "Satchel" : NotORnotNOT1$ = "  (in progress...)"
    else
        quest1$ = ""
end if
if Q2 = 1 then
    if version = 1 then quest2$ = "Le marchand" : NotORnotNOT2$ = "  (en cours...)"
    if version = 2 then quest2$ = "The merchant" : NotORnotNOT2$ = "  (in progress...)"
    else
        quest2$ = ""
end if

if winQ1 = 1 then
    if version = 1 then quest1$ = "La sacoche" : NotORnotNOT1$ = "  (Terminé - réussite)"
    if version = 2 then quest1$ = "Satchel" : NotORnotNOT1$ = "  (Finished - success)"
end if
if winQ1 = 2 then
    if version = 1 then quest1$ = "La sacoche" : NotORnotNOT1$ = "  (Terminé - échec)"
    if version = 2 then quest1$ = "Satchel" : NotORnotNOT1$ = "  (Finished - defeat)"
end if
if winQ2 = 1 then
    if version = 1 then quest2$ = "Le marchand" : NotORnotNOT2$ = "  (Terminé - réussite)"
    if version = 2 then quest2$ = "The merchant" : NotORnotNOT2$ = "  (Finished - success)"
end if
if winQ2 = 2 then
    if version = 1 then quest2$ = "Le marchand" : NotORnotNOT2$ = "  (Terminé - échec)"
    if version = 2 then quest2$ = "The merchant" : NotORnotNOT2$ = "  (Finished - defeat)"
end if

for y = 0 to l
    for x = 0 to c
        if tableau$(x,y) = "" and quest1STATUT = 0 then
            tableau$(x,y) = quest1$
            quest1STATUT = 1
        end if
        if tableau$(x,y) = "" and quest2STATUT = 0 then
            tableau$(x,y) = quest2$
            quest2STATUT = 1
        end if
        if tableau$(x,y) = quest1$ then NameQUEST1$ = quest1$
        if tableau$(x,y) = quest2$ then NameQUEST2$ = quest2$
    next
next
return

            [sort]
            timer 0
            astuces = 2
            Global ncx, ncy, lc
            lc = 20
            NumberPageBookTotal = 1
            NumberPageBook = 1
            if bruitage = 0 then playwave "music\hit.wav", async
            WindowWidth=1020:WindowHeight = 600 : UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2)
            loadbmp"JB", "bmp\book.bmp"

            #3b,"trapclose [w]"
            #3b.map, "down; fill black; when characterInput [w]; setfocus; when leftButtonDown [SimpleClick3]"
            Gwidth = CenterX * 2 : Gheight = CenterY * 2
            ncx = int(Gwidth/lc)+1 : ncy = int(Gheight/lc)+1
            #3b.map, "drawbmp JB 0 0"
            #3b.map, "drawbmp add 640 335; drawbmp add 640 350; drawbmp add 640 365; drawbmp add 640 380; drawbmp add 640 395; drawbmp add 640 410; drawbmp add 640 425; drawbmp add 640 440; drawbmp add 640 455; drawbmp add 640 470; drawbmp add 640 485; drawbmp add 640 500"
            print #3b.map, "background JB"
            print #3b.map, "font Times New Roman 10; color white"
            print #3b.map, "size 1"
            print #3b.map, "place 970 "; 28
            print #3b.map, "box 870 "; 28 + 25

                    ' supprime le backcolor pour texte transparent
    hGBox = hwnd(#3b.map)
    CallDLL #user32, "GetDC",_
        hGBox As ulong,_  'handle of graphicbox
        gDC As ulong      'device context
   ' CallDLL #gdi32, "SetBkMode",_
   '     gDC As ulong,_          'handle of graphicbox
   '     _TRANSPARENT As long,_  'flag for transparent background
   '     result As long          'previous bkmode
    CallDLL #gdi32, "SetBkMode",_
       gDC As ulong,_     'handle of graphicbox
       _OPAQUE As long,_  'flag for opaque background
       result As long     'previous bkmode

    CallDLL#user32,"ReleaseDC",_
        hGBox As ulong,_    'graphicbox handle
        gDC As ulong,_      'device context
        result As long


            if sort1 = 1 then print #3b.map, "backcolor black ; place 620 250 ;\"; sort1$;sort1lvl
            print #3b.map, "backcolor black ; place 300 520 ;\"; NumberPageBook;" / "; NumberPageBookTotal

            if version = 1 then
                print #3b.map, "backcolor black ; place 895 45 ;\"; "FERMER"
                print #3b.map, "font Times New Roman 10; color green"
                print #3b.map, "backcolor black ; place 620 87 ;\"; "Compétences actives               niveau              effet              coût"
                print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA
                print #3b.map, "font Times New Roman 10; color white"
                print #3b.map, "backcolor black ; place 660 345 ;\"; "Augmentation de la santé : ";passive1
                print #3b.map, "backcolor black ; place 660 360 ;\"; "Augmentation de l'attaque : ";passive2
                print #3b.map, "backcolor black ; place 660 375 ;\"; "Augmentation de la défense : ";passive3
                print #3b.map, "backcolor black ; place 660 390 ;\"; "Augmentation de la magie : ";passive4
                print #3b.map, "backcolor black ; place 660 405 ;\"; "Augmentation du déplacement : ";passive5
                print #3b.map, "backcolor black ; place 660 420 ;\"; "Augmentation de l'expérience : ";passive6
                print #3b.map, "backcolor black ; place 660 435 ;\"; "Augmentation de l'or reçu : ";passive7
                print #3b.map, "backcolor black ; place 660 450 ;\"; "Augmentation de la régénération des PV : ";passive8
                print #3b.map, "backcolor black ; place 660 465 ;\"; "Augmentation de la régénération du mana : ";passive9
                print #3b.map, "backcolor black ; place 660 480 ;\"; "Augmentation des dégâts magiques : ";passive10
                print #3b.map, "backcolor black ; place 660 495 ;\"; "Augmentation des sorts de soins : ";passive11
                print #3b.map, "backcolor black ; place 660 510 ;\"; "Augmentation du niveau max des d'objet : ";passive12
            end if

            if version = 2 then
                print #3b.map, "backcolor black ; place 900 45 ;\"; "CLOSE"
                print #3b.map, "font Times New Roman 10; color green"
                print #3b.map, "backcolor black ; place 620 87 ;\"; "Compétences actives               niveau              effet              coût"
                print #3b.map, "backcolor black ; place 635 305 ;\"; "Skill points available : ";PA
                print #3b.map, "font Times New Roman 10; color white"
                print #3b.map, "backcolor black ; place 660 345 ;\"; "Improve you points of life : ";passive1
                print #3b.map, "backcolor black ; place 660 360 ;\"; "Improve you points of attack : ";passive2
                print #3b.map, "backcolor black ; place 660 375 ;\"; "Improve you points of defense : ";passive3
                print #3b.map, "backcolor black ; place 660 390 ;\"; "Improve you points of mana : ";passive4
                print #3b.map, "backcolor black ; place 660 405 ;\"; "Improve you speed (walk) : ";passive5
                print #3b.map, "backcolor black ; place 660 420 ;\"; "Improve you points of experience : ";passive6
                print #3b.map, "backcolor black ; place 660 435 ;\"; "Improve you gold cash : ";passive7
                print #3b.map, "backcolor black ; place 660 450 ;\"; "Improve you life regeneration : ";passive8
                print #3b.map, "backcolor black ; place 660 465 ;\"; "Improve you mana regeneration : ";passive9
                print #3b.map, "backcolor black ; place 660 480 ;\"; "Improve you magical damages : ";passive10
                print #3b.map, "backcolor black ; place 660 495 ;\"; "Improve you heal spells : ";passive11
                print #3b.map, "backcolor black ; place 660 510 ;\"; "Improve you maximum upgrade item level : ";passive12
            end if
            sortbook = 2
            print #3b.map, "flush"
            wait

            [SimpleClick3]
            mX = MouseX
            mY = MouseY
            'notice mX;" / ";mY
            if mX>640 and mX<655 and mY>336 and mY<349 and PA >= 1 then [PASSIVE1]
            if mX>640 and mX<655 and mY>351 and mY<363 and PA >= 1 then [PASSIVE2]
            if mX>640 and mX<655 and mY>365 and mY<378 and PA >= 1 then [PASSIVE3]
            if mX>640 and mX<655 and mY>380 and mY<393 and PA >= 1 then [PASSIVE4]
            if mX>640 and mX<655 and mY>395 and mY<407 and PA >= 1 then [PASSIVE5]
            if mX>640 and mX<655 and mY>409 and mY<422 and PA >= 1 then [PASSIVE6]
            if mX>640 and mX<655 and mY>424 and mY<437 and PA >= 1 then [PASSIVE7]
            if mX>640 and mX<655 and mY>439 and mY<451 and PA >= 1 then [PASSIVE8]
            if mX>640 and mX<655 and mY>453 and mY<466 and PA >= 1 then [PASSIVE9]
            if mX>640 and mX<655 and mY>468 and mY<481 and PA >= 1 then [PASSIVE10]
            if mX>640 and mX<655 and mY>483 and mY<496 and PA >= 1 then [PASSIVE11]
            if mX>640 and mX<655 and mY>498 and mY<511 and PA >= 1 then [PASSIVE12]
            if mX>int(44*lc) and mX<int((44*lc)+95) and mY>int(1*lc) and mY<int((1*lc)+40) then BLOCKED = 1 : sortbook = 0 : unloadbmp"JB" : goto [reload3]
            wait

            [PASSIVE1]
            PA = PA - 1 : passive1 = passive1 + 1 : PV = PV + int(passive1*5) : PVTotal = PVTotal + int(passive1*5)
            print #3b.map, "font Times New Roman 10; color green"
            print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA;"   "
            print #3b.map, "font Times New Roman 10; color white"
            if version = 1 then print #3b.map, "place 660 345 ;\"; "Augmentation de la santé : ";passive1;"   "
            if version = 2 then print #3b.map, "place 660 345 ;\"; "Improve you points of life : ";passive1;"   "
            wait
            [PASSIVE2]
            PA = PA - 1 : passive2 = passive2 + 1 : atk = atk + int(passive2*3)
            print #3b.map, "font Times New Roman 10; color green"
            print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA;"   "
            print #3b.map, "font Times New Roman 10; color white"
            if version = 1 then print #3b.map, "place 660 360 ;\"; "Augmentation de l'attaque : ";passive2;"   "
            if version = 2 then print #3b.map, "place 660 360 ;\"; "Improve you points of attack : ";passive2;"   "
            wait
            [PASSIVE3]
            PA = PA - 1 : passive3 = passive3 + 1 : def = def + passive3
            print #3b.map, "font Times New Roman 10; color green"
            print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA;"   "
            print #3b.map, "font Times New Roman 10; color white"
            if version = 1 then print #3b.map, "place 660 375 ;\"; "Augmentation de la défense : ";passive3;"   "
            if version = 2 then print #3b.map, "place 660 375 ;\"; "Improve you points of defense : ";passive3;"   "
            wait
            [PASSIVE4]
            PA = PA - 1 : passive4 = passive4 + 1 : PM = PM + passive4 : PMTotal = PMTotal + passive4
            print #3b.map, "font Times New Roman 10; color green"
            print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA;"   "
            print #3b.map, "font Times New Roman 10; color white"
            if version = 1 then print #3b.map, "place 660 390 ;\"; "Augmentation de la magie : ";passive4;"   "
            if version = 2 then print #3b.map, "place 660 390 ;\"; "Improve you points of mana : ";passive4;"   "
            wait
            [PASSIVE5]
            PA = PA - 1 : passive5 = passive5 + 1
            print #3b.map, "font Times New Roman 10; color green"
            print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA;"   "
            print #3b.map, "font Times New Roman 10; color white"
            if version = 1 then print #3b.map, "place 660 405 ;\"; "Augmentation du déplacement : ";passive5;"   "
            if version = 2 then print #3b.map, "place 660 405 ;\"; "Improve you speed (walk) : ";passive5;"   "
            wait
            [PASSIVE6]
            PA = PA - 1 : passive6 = passive6 + 1 : XPbonus =  XPbonus + 7 +  passive6
            print #3b.map, "font Times New Roman 10; color green"
            print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA;"   "
            print #3b.map, "font Times New Roman 10; color white"
            if version = 1 then print #3b.map, "place 660 420 ;\"; "Augmentation de l'expérience : ";passive6;"   "
            if version = 2 then print #3b.map, "place 660 420 ;\"; "Improve you points of experience : ";passive6;"   "
            wait
            [PASSIVE7]
            PA = PA - 1 : passive7 = passive7 + 1 : GOLDbonus = GOLDbonus + 4
            print #3b.map, "font Times New Roman 10; color green"
            print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA;"   "
            print #3b.map, "font Times New Roman 10; color white"
            if version = 1 then print #3b.map, "place 660 435 ;\"; "Augmentation de l'or reçu : ";passive7;"   "
            if version = 2 then print #3b.map, "place 660 435 ;\"; "Improve you gold cash : ";passive7;"   "
            wait
            [PASSIVE8]
            PA = PA - 1 : passive8 = passive8 + 1
            print #3b.map, "font Times New Roman 10; color green"
            print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA;"   "
            print #3b.map, "font Times New Roman 10; color white"
            if version = 1 then print #3b.map, "place 660 450 ;\"; "Augmentation de la régénération des PV : ";passive8;"   "
            if version = 2 then print #3b.map, "place 660 450 ;\"; "Improve you life regeneration : ";passive8;"   "
            wait
            [PASSIVE9]
            PA = PA - 1 : passive9 = passive9 + 1
            print #3b.map, "font Times New Roman 10; color green"
            print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA;"   "
            print #3b.map, "font Times New Roman 10; color white"
            if version = 1 then print #3b.map, "place 660 465 ;\"; "Augmentation de la régénération du mana : ";passive9;"   "
            if version = 2 then print #3b.map, "place 660 465 ;\"; "Improve you mana regeneration : ";passive9;"   "
            wait
            [PASSIVE10]
            PA = PA - 1 : passive10 = passive10 + 1
            print #3b.map, "font Times New Roman 10; color green"
            print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA;"   "
            print #3b.map, "font Times New Roman 10; color white"
            if version = 1 then print #3b.map, "place 660 480 ;\"; "Augmentation des dégâts magiques : ";passive10;"   "
            if version = 2 then print #3b.map, "place 660 480 ;\"; "Improve you magical damages : ";passive10;"   "
            wait
            [PASSIVE11]
            PA = PA - 1 : passive11 = passive11 + 1
            print #3b.map, "font Times New Roman 10; color green"
            print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA;"   "
            print #3b.map, "font Times New Roman 10; color white"
            if version = 1 then print #3b.map, "place 660 480 ;\"; "Augmentation des sorts de soins : ";passive11;"   "
            if version = 2 then print #3b.map, "place 660 495 ;\"; "Improve you heal spells : ";passive11;"   "
            wait
            [PASSIVE12]
            PA = PA - 1 : passive12 = passive12 + 1
            print #3b.map, "font Times New Roman 10; color green"
            print #3b.map, "backcolor black ; place 635 305 ;\"; "Points de compétences passives disponibles : ";PA;"   "
            print #3b.map, "font Times New Roman 10; color white"
            if version = 1 then print #3b.map, "place 660 495 ;\"; "Augmentation du niveau max des d'objet : ";passive12;"   "
            if version = 2 then print #3b.map, "place 660 510 ;\"; "Improve you maximum upgrade item level : ";passive12;"   "
            wait


            [map1grand]
            if agrandmap=1 then [map1grand2]
            if agrandmap=2 then close #33
            [map1grand2]
            agrandmap=2
            loadbmp"map1", "bmp\map\indic\carteindic1.bmp"
            loadbmp"map2", "bmp\map\indic\carteindic2.bmp"
            loadbmp"map3", "bmp\map\indic\carteindic3.bmp"
            loadbmp"curseur", "bmp\curseur2.bmp"


            if bruitage = 0 then playwave "music\hit.wav", async
            WindowWidth = 660:WindowHeight = 600 : UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2)
            graphicbox #33.map, 0, 0, 1300, 750
            open "Zoom" for window_nf as #33
            #33,"trapclose [quitSTART]"
            #33.map,"down; setfocus"

            select case map
                case 1
                    #33.map, "drawbmp map1 0 0"
                    if perso1dx <= 500 then #33.map, "drawbmp curseur 100 450"
                    if perso1dx > 500 then #33.map, "drawbmp curseur 160 450"
                case 2
                    #33.map, "drawbmp map1 0 0"
                    if perso1dx <= 500 then #33.map, "drawbmp curseur 85 350"
                    if perso1dx > 500 then #33.map, "drawbmp curseur 140 325"
                case 3
                    #33.map, "drawbmp map1 0 0" : #33.map, "drawbmp curseur 250 290"
                case 4
                    #33.map, "drawbmp map1 0 0" : #33.map, "drawbmp curseur 260 130"
                case 5
                    #33.map, "drawbmp map1 0 0" : #33.map, "drawbmp curseur 85 100"
                case 6
                    #33.map, "drawbmp map2 0 0"
                    if perso1dx > 500 then #33.map, "drawbmp curseur 180 480"
                    if perso1dx <= 500 then #33.map, "drawbmp curseur 80 520"
                case 7
                    #33.map, "drawbmp map2 0 0" : #33.map, "drawbmp curseur 70 330"
                case 8
                    #33.map, "drawbmp map2 0 0" : #33.map, "drawbmp curseur 60 180"
                case 9
                    #33.map, "drawbmp map2 0 0"
                    if perso1dx <= 500 then #33.map, "drawbmp curseur 260 500"
                    if perso1dx > 500 then #33.map, "drawbmp curseur 320 530"
                case 10
                    #33.map, "drawbmp map2 0 0"
                    if perso1dx <= 500 then #33.map, "drawbmp curseur 440 480"
                    if perso1dx > 500 then #33.map, "drawbmp curseur 550 480"
                case 11
                    #33.map, "drawbmp map2 0 0" : #33.map, "drawbmp curseur 425 320"
                case 12
                    #33.map, "drawbmp map2 0 0" : #33.map, "drawbmp curseur 435 245"
                case 13
                    #33.map, "drawbmp map2 0 0" : #33.map, "drawbmp curseur 540 320"
                case 14
                    #33.map, "drawbmp map2 0 0" : #33.map, "drawbmp curseur 540 200"
                case 15
                    #33.map, "drawbmp map2 0 0" : #33.map, "drawbmp curseur 350 200"
                case 16
                    #33.map, "drawbmp map2 0 0" : #33.map, "drawbmp curseur 355 380"
                case 17
                    #33.map, "drawbmp map3 0 0"
                    if perso1dx <= 500 then #33.map, "drawbmp curseur 250 110"
                    if perso1dx > 500 then #33.map, "drawbmp curseur 320 170"
                case 18
                    #33.map, "drawbmp map3 0 0" : #33.map, "drawbmp curseur 330 260"
                case 19
                    #33.map, "drawbmp map3 0 0" : #33.map, "drawbmp curseur 320 370"
                case 20
                    #33.map, "drawbmp map3 0 0" : #33.map, "drawbmp curseur 310 530"
                case 21
                    #33.map, "drawbmp map3 0 0" : #33.map, "drawbmp curseur 415 470"
                case 22
                    #33.map, "drawbmp map3 0 0" : #33.map, "drawbmp curseur 165 550"
            end select
        wait

        [monsterDATAcenter]
        select case map
        case 1
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 2 : AlifeE13 = 2 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 2
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            AlifeE1 = 2 : AlifeE11 = 2 : AlifeE12 = 2 : AlifeE13 = 2 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 3
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 1 : AlifeE13 = 2 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 4
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map) : LvlMonster5 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE14TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL : PvE14 = PvE14TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4) : GenerATKe5POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 1 : AlifeE13 = 1 : AlifeE14 = 1 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 5
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map) : LvlMonster5 = int(rnd(1)*int(map*2)+map)
            vieQ1Total = 450 : vieQ1 = vieQ1Total : Q1def = 9 : Q1atk = 36 : goldQ = 100 : xpQ = 240 : LvlMonsterQ = 18
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor): PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE14TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL : PvE14 = PvE14TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4) : GenerATKe5POWER = int((rnd(1)*6)+4)
            AlifeE1 = 2 : AlifeE11 = 2 : AlifeE12 = 2 : AlifeE13 = 2 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 6
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map) : LvlMonster5 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE14TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL : PvE14 = PvE14TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4) : GenerATKe5POWER = int((rnd(1)*6)+4)
            AlifeE1 = 2 : AlifeE11 = 2 : AlifeE12 = 2 : AlifeE13 = 2 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 7
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 1 : AlifeE13 = 2 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 8
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            AlifeE1 = 2 : AlifeE11 = 2 : AlifeE12 = 2 : AlifeE13 = 2 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 9
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 1 : AlifeE13 = 1 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 10
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 1 : AlifeE13 = 1 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 11
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            AlifeE1 = 2 : AlifeE11 = 2 : AlifeE12 = 2 : AlifeE13 = 2 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 13
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 1 : AlifeE13 = 1 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 14
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 1 : AlifeE13 = 1 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 15
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 1 : AlifeE13 = 1 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 16
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 1 : AlifeE13 = 1 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 17
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4)
            AlifeE1 = 2 : AlifeE11 = 2 : AlifeE12 = 2 : AlifeE13 = 2 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 18
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 1 : AlifeE13 = 1 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 19
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 1 : AlifeE13 = 1 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 20
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4)
            AlifeE1 = 1 : AlifeE11 = 1 : AlifeE12 = 1 : AlifeE13 = 1 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 21
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4)
            AlifeE1 = 2 : AlifeE11 = 2 : AlifeE12 = 2 : AlifeE13 = 2 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case 22
            LvlMonster1 = int(rnd(1)*int(map*2)+map) : LvlMonster2 = int(rnd(1)*int(map*2)+map) : LvlMonster3 = int(rnd(1)*int(map*2)+map)
            LvlMonster4 = int(rnd(1)*int(map*2)+map)
            PvE1TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE11TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE12TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor) : PvE13TOTAL = int((rnd(1)*int(LvlMonster1*10)+LvlMonster1*20)*factor)
            PvE1 = PvE1TOTAL : PvE11 = PvE11TOTAL : PvE12 = PvE12TOTAL : PvE13 = PvE13TOTAL
            atkE = int(rnd(1)*int(map*1)+map*4)
            defE = int(rnd(1)*int(map*1))
            GenerATKe1POWER = int((rnd(1)*6)+4) : GenerATKe2POWER = int((rnd(1)*6)+4) : GenerATKe3POWER = int((rnd(1)*6)+4)
            GenerATKe4POWER = int((rnd(1)*6)+4)
            AlifeE1 = 2 : AlifeE11 = 2 : AlifeE12 = 2 : AlifeE13 = 2 : AlifeE14 = 2 : AlifeE15 = 2 : AlifeE16 = 2 : AlifeE17 = 2 : AlifeE18 = 2 : AlifeE19 = 2
        case else
        end select
        return

    [MonsterGEN]
    timer 0
    select case map
        case 1
            E1x = 240 : E1y = 240 : E11x = 660 : E11y = 240 : gosub [loading2unitMAP] : return
        case 2
            E1x = 198 : E1y = 270 : E11x = 600 : E11y = 300 : E12x = 480 : E12y = 192 : gosub [loading3unitMAP] : return
        case 3
            E1x = 600 : E1y = 150 : E11x = 400 : E11y = 300 : E12x = 480 : E12y = 240 : gosub [loading3unitMAP] : return
        case 4
            E1x = 600 : E1y = 210 : E11x = 660 : E11y = 330 : E12x = 300 : E12y = 180 : E13x = 390 : E13y = 240 : E14x = 150 : E14y = 210 : gosub [loading5unitMAP] : return
        case 5
            E1x = 300 : E1y = 210 : E11x = 660 : E11y = 330 : E12x = 270 : E12y = 180 : E13x = 180 : E13y = 240 : E14x = 210 : E14y = 210 : gosub [loading5unitMAP] : return
        case 6
            E1x = 300 : E1y = 330 : E11x = 330 : E11y = 240 : E12x = 390 : E12y = 270 : E13x = 600 : E13y = 150 : E14x = 810 : E14y = 120 : gosub [loading5unitMAP] : return
        case 7
            E1x = 420 : E1y = 150 : E11x = 630 : E11y = 270 : E12x = 210 : E12y = 330 : gosub [loading3unitMAP] : return
        case 8
            E1x = 300 : E1y = 210 : E11x = 390 : E11y = 240 : gosub [loading2unitMAP] : return
        case 9
            E1x = 300 : E1y = 210 : E11x = 390 : E11y = 270 : E12x = 360 : E12y = 180 : E13x = 780 : E13y = 330 : gosub [loading4unitMAP] : return
        case 10
            E1x = 870 : E1y = 180 : E11x = 390 : E11y = 330 : E12x = 360 : E12y = 180 : E13x = 660 : E13y = 150 : gosub [loading4unitMAP] : return
        case 11
            E1x = 390 : E1y = 150 : E11x = 420 : E11y = 240 : E12x = 450 : E12y = 90 : gosub [loading3unitMAP] : return
        case 12
            return
        case 13
            E1x = 600 : E1y = 210 : E11x = 390 : E11y = 360 : E12x = 300 : E12y = 60 : E13x = 360 : E13y = 180 : gosub [loading4unitMAP] : return
        case 14
            E1x = 660 : E1y = 210 : E11x = 450 : E11y = 240 : E12x = 150 : E12y = 180 : E13x = 360 : E13y = 300 : gosub [loading4unitMAP] : return
        case 15
            E1x = 330 : E1y = 180 : E11x = 390 : E11y = 240 : E12x = 360 : E12y = 390 : E13x = 540 : E13y = 180 : gosub [loading4unitMAP] : return
        case 16
            E1x = 450 : E1y = 60 : E11x = 390 : E11y = 330 : E12x = 360 : E12y = 180 : E13x = 600 : E13y = 300 : gosub [loading4unitMAP] : return
        case 17
            E1x = 150 : E1y = 150 : E11x = 420 : E11y = 330 : E12x = 720 : E12y = 180 : E13x = 360 : E13y = 180 : gosub [loading4unitMAP] : return
        case 18
            E1x = 540 : E1y = 300 : E11x = 600 : E11y = 240 : E12x = 450 : E12y = 180 : E13x = 360 : E13y = 330 : gosub [loading4unitMAP] : return
        case 19
            E1x = 300 : E1y = 210 : E11x = 390 : E11y = 330 : E12x = 720 : E12y = 180 : E13x = 360 : E13y = 180 : gosub [loading4unitMAP] : return
        case 20
            E1x = 150 : E1y = 300 : E11x = 510 : E11y = 240 : E12x = 360 : E12y = 330 : E13x = 780 : E13y = 300 : gosub [loading4unitMAP] : return
        case 21
            E1x = 690 : E1y = 240 : E11x = 780 : E11y = 270 : E12x = 750 : E12y = 210 : E13x = 750 : E13y = 300 : gosub [loading4unitMAP] : return
        case 22
            E1x = 300 : E1y = 210 : E11x = 690 : E11y = 360 : E12x = 360 : E12y = 180 : E13x = 360 : E13y = 330 : gosub [loading4unitMAP] : return
    end select
    wait

    [loading2unitMAP]
    nom1$ = "Ea" : nom2$ = "Eb" : nom3$ = "Ec" : nom4$ = "Ed"
    if loadSECUR = 1 then load = 0
    if load = 0 or reload = 0 then gosub [monsterDATAcenter]
    if loadSECUR = 1 then load = 1 : loadSECUR = 0
    for i = 1 to nombre+9
        print #3b.map, "addsprite ";nom1$;i;" Ea2 Ea3 Ea4; addsprite ";nom2$;i;" Eb2 Eb3 Eb4; addsprite ";nom3$;i;" Ec2 Ec3 Ec4; addsprite ";nom4$;i;" Ed2 Ed3 Ed4"
        if iSECUR = 0 then i = i+9 : iSECUR = 1
    next
    #3b.map,"spritexy Ea1 ";E1x;" ";E1y;"; spritexy Eb1 ";E1x;" ";E1y;"; spritexy Ec1 ";E1x;" ";E1y;"; spritexy Ed1 ";E1x;" ";E1y;"; spritexy Ea11 ";E11x;" ";E11y;"; spritexy Eb11 ";E11x;" ";E11y;"; spritexy Ec11 ";E11x;" ";E11y;"; spritexy Ed11 ";E11x;" ";E11y
    #3b.map,"SpriteVisible Eb1 off; SpriteVisible Ea1 off; SpriteVisible Ed1 off; SpriteVisible Ea11 off; SpriteVisible Ec11 off; SpriteVisible Ed11 off"
    iSECUR = 0
    return
    [loading3unitMAP]
    nom1$ = "Ea" : nom2$ = "Eb" : nom3$ = "Ec" : nom4$ = "Ed"
    if loadSECUR = 1 then load = 0
    if load = 0 or reload = 0 then gosub [monsterDATAcenter]
    if loadSECUR = 1 then load = 1 : loadSECUR = 0
    for i = 1 to nombre+9
        print #3b.map, "addsprite ";nom1$;i;" Ea2 Ea3 Ea4; addsprite ";nom2$;i;" Eb2 Eb3 Eb4; addsprite ";nom3$;i;" Ec2 Ec3 Ec4; addsprite ";nom4$;i;" Ed2 Ed3 Ed4"
        if iSECUR = 0 then i = i+9 : iSECUR = 1
    next
    #3b.map,"spritexy Ea1 ";E1x;" ";E1y;"; spritexy Eb1 ";E1x;" ";E1y;"; spritexy Ec1 ";E1x;" ";E1y;"; spritexy Ed1 ";E1x;" ";E1y;"; spritexy Ea11 ";E11x;" ";E11y;"; spritexy Eb11 ";E11x;" ";E11y;"; spritexy Ec11 ";E11x;" ";E11y;"; spritexy Ed11 ";E11x;" ";E11y;"; spritexy Ea12 ";E12x;" ";E12y;"; spritexy Eb12 ";E12x;" ";E12y;"; spritexy Ec12 ";E12x;" ";E12y;"; spritexy Ed12 ";E12x;" ";E12y
    #3b.map,"SpriteVisible Eb1 off; SpriteVisible Ea1 off; SpriteVisible Ed1 off; SpriteVisible Ea11 off; SpriteVisible Ec11 off; SpriteVisible Ed11 off; SpriteVisible Eb12 off; SpriteVisible Ea12 off; SpriteVisible Ed12 off"
    iSECUR = 0
    return
    [loading4unitMAP]
    nom1$ = "Ea" : nom2$ = "Eb" : nom3$ = "Ec" : nom4$ = "Ed"
    if loadSECUR = 1 then load = 0
    if load = 0 or reload = 0 then gosub [monsterDATAcenter]
    if loadSECUR = 1 then load = 1 : loadSECUR = 0
    for i = 1 to nombre+9
        print #3b.map, "addsprite ";nom1$;i;" Ea2 Ea3 Ea4; addsprite ";nom2$;i;" Eb2 Eb3 Eb4; addsprite ";nom3$;i;" Ec2 Ec3 Ec4; addsprite ";nom4$;i;" Ed2 Ed3 Ed4"
        if iSECUR = 0 then i = i+9 : iSECUR = 1
    next
    #3b.map,"spritexy Ea1 ";E1x;" ";E1y;"; spritexy Eb1 ";E1x;" ";E1y;"; spritexy Ec1 ";E1x;" ";E1y;"; spritexy Ed1 ";E1x;" ";E1y;"; spritexy Ea11 ";E11x;" ";E11y;"; spritexy Eb11 ";E11x;" ";E11y;"; spritexy Ec11 ";E11x;" ";E11y;"; spritexy Ed11 ";E11x;" ";E11y;"; spritexy Ea12 ";E12x;" ";E12y;"; spritexy Eb12 ";E12x;" ";E12y;"; spritexy Ec12 ";E12x;" ";E12y;"; spritexy Ed12 ";E12x;" ";E12y;"; spritexy Ea13 ";E13x;" ";E13y;"; spritexy Eb13 ";E13x;" ";E13y;"; spritexy Ec13 ";E13x;" ";E13y;"; spritexy Ed13 ";E13x;" ";E13y
    #3b.map,"SpriteVisible Eb1 off; SpriteVisible Ea1 off; SpriteVisible Ed1 off; SpriteVisible Ea11 off; SpriteVisible Ec11 off; SpriteVisible Ed11 off; SpriteVisible Eb12 off; SpriteVisible Ea12 off; SpriteVisible Ed12 off; SpriteVisible Ea13 off; SpriteVisible Ec13 off; SpriteVisible Ed13 off"
    iSECUR = 0
    return
    [loading5unitMAP]
    nom1$ = "Ea" : nom2$ = "Eb" : nom3$ = "Ec" : nom4$ = "Ed"
    if loadSECUR = 1 then load = 0
    if load = 0 or reload = 0 then gosub [monsterDATAcenter]
    if loadSECUR = 1 then load = 1 : loadSECUR = 0
    for i = 1 to nombre+9
        print #3b.map, "addsprite ";nom1$;i;" Ea2 Ea3 Ea4; addsprite ";nom2$;i;" Eb2 Eb3 Eb4; addsprite ";nom3$;i;" Ec2 Ec3 Ec4; addsprite ";nom4$;i;" Ed2 Ed3 Ed4"
        if iSECUR = 0 then i = i+9 : iSECUR = 1
    next
    #3b.map,"spritexy Ea1 ";E1x;" ";E1y;"; spritexy Eb1 ";E1x;" ";E1y;"; spritexy Ec1 ";E1x;" ";E1y;"; spritexy Ed1 ";E1x;" ";E1y;"; spritexy Ea11 ";E11x;" ";E11y;"; spritexy Eb11 ";E11x;" ";E11y;"; spritexy Ec11 ";E11x;" ";E11y;"; spritexy Ed11 ";E11x;" ";E11y;"; spritexy Ea12 ";E12x;" ";E12y;"; spritexy Eb12 ";E12x;" ";E12y;"; spritexy Ec12 ";E12x;" ";E12y;"; spritexy Ed12 ";E12x;" ";E12y;"; spritexy Ea13 ";E13x;" ";E13y;"; spritexy Eb13 ";E13x;" ";E13y;"; spritexy Ec13 ";E13x;" ";E13y;"; spritexy Ed13 ";E13x;" ";E13y;"; spritexy Ea14 ";E14x;" ";E14y;"; spritexy Eb14 ";E14x;" ";E14y;"; spritexy Ec14 ";E14x;" ";E14y;"; spritexy Ed14 ";E14x;" ";E14y
    #3b.map,"SpriteVisible Eb1 off; SpriteVisible Ea1 off; SpriteVisible Ed1 off; SpriteVisible Ea11 off; SpriteVisible Ec11 off; SpriteVisible Ed11 off; SpriteVisible Eb12 off; SpriteVisible Ea12 off; SpriteVisible Ed12 off; SpriteVisible Ea13 off; SpriteVisible Ec13 off; SpriteVisible Ed13 off; SpriteVisible Ea14 off; SpriteVisible Eb14 off; SpriteVisible Ed14 off"
    iSECUR = 0
    return

    [closeSecur]
    if saveMain = 1 then saveMain = 0 : close #saveMain
    if aide = 2 then aide=1 : close #3c
    if menugame = 2 then close #3 : menugame = 1
    if agrandmap = 2 then close #33 : agrandmap = 1
    if system = 2 then close #34 : system = 1
    if bruitage = 0 then playwave "music\hit.wav", async
    return

    [quit]
    timer 0
    if bruitage = 0 then playwave "music\hit.wav", async
    if aide = 2 then aide=1 : close #3c : timer 100, [deplacementBOUCLE] : wait
    if version = 1 then confirm "Voulez-vous quitter le Jeu ?";quit$
    if version = 2 then confirm "Do you want to exit the game?";quit$
    if quit$ = "no" then timer 100, [deplacementBOUCLE] : wait
    gosub [closeSecur]
    close #3b
    music = 1
    gosub [stopMusic2]
    end

    [quitS]
    timer 0
    gosub [closeSecur]
    if version = 1 then confirm "Voulez-vous quitter le Jeu ?";quit$
    if version = 2 then confirm "Do you want to exit the game?";quit$
    if quit$ = "no" then timer 100, [deplacementBOUCLE] : wait
    playwave ""
    close #3b
    end

    [quitSbis]
    timer 0
    gosub [closeSecur]
    playwave ""
    close #2b
    if credit=1 then close #credit
    end

    [quitSTART]
    if agrandmap=2 then agrandmap=1 : close #33 : goto [quitEND]
    if system=2 then
        system=1 : close #34
        if map>0 then goto [quitEND]
        wait
    end if
    [quitEND]
    if game$ = "on" then timer 100, [deplacementBOUCLE]
    if bruitage = 0 then playwave "music\hit.wav", async
    #3b.map "SetFocus; DrawSprites"
    wait

    [w]
    wait

'----QuestsOptionnel1----------------------------------------------------------------------------------------------------------------|

[DQop1]
timer 0
if sex = 1 then sexe$ = "garçon"
if sex = 2 then sexe$ = "fille"
AlifeVoleur1 = 0
if DQop1 = 1 then close #1
WindowWidth = 400 : WindowHeight = 210
UpperLeftX=int((DisplayWidth-WindowWidth)/3)
UpperLeftY=int((DisplayHeight-WindowHeight)/3)
BackgroundColor$ = "black" : ForegroundColor$ = "white"
bmpbutton #1.A, "bmp\icoQ1.bmp", [w], UL, 10, 55
if version = 1 then
    statictext #1.a,"Quête optionelle : La sacoche", 70, 10, 300, 30
    statictext #1.b,"''Tiens, un inconnu ? Attendez donc jeune ";sexe$;" ! Voulez-vous me rendre un service ? Un voleur ! Oui il m'a volé, dépouillé le voyou ! Retrouvez le et ramener moi ma sacoche.  Je vous attendrez ici avec une récompense... ''", 70, 50, 320, 70
    statictext #1.c,"Acceptez-vous ?", 50, 145, 100, 55
    button #1, "Oui", [Q1accept], UL, 180, 140,80,25
    button #1, "Non", [Q1refuse], UL, 280, 140,80,25
end if
if version = 2 then
    statictext #1.a,"Optional Quest : Satchel", 70, 10, 300, 30
    statictext #1.b,"''Here, a stranger? Wait a boy! Would you do me a favor? A thief! Yes he stole, stripped the thug! Find him and bring me my bag. I'll wait here with a gift ... ''", 70, 50, 320, 70
    statictext #1.c,"Do you agree?", 50, 145, 120, 55
    button #1, "Yes", [Q1accept], UL, 180, 140,80,25
    button #1, "No", [Q1refuse], UL, 280, 140,80,25
end if
open "" for dialog_modal_nf as #1
print #1.a, "!font times_new_roman 16 bold italic"
print #1.b, "!font times_new_roman 10 italic"
print #1.c, "!font times_new_roman 10 bold"
print #1.A, "disable"
#1,"trapclose [w]"
DQop1 = 1
wait

[DQop2]
timer 0
if sex = 1 then sexe$ = "garçon"
if sex = 2 then sexe$ = "fille"
if DQop2 = 1 then close #1
WindowWidth = 400 : WindowHeight = 210
UpperLeftX=int((DisplayWidth-WindowWidth)/3)
UpperLeftY=int((DisplayHeight-WindowHeight)/3)
BackgroundColor$ = "black" : ForegroundColor$ = "white"
bmpbutton #1.A, "bmp\icoQ1.bmp", [w], UL, 10, 55
if version = 1 then
    statictext #1.a,"Quête optionelle : Le marchand", 70, 10, 300, 30
    statictext #1.b,"''Bonjour jeune ";sexe$;" ! Ces satanés loups sauvages m'empêchent d'avoir des clients. On se plaint de se faire attaquer lorsque l'on vient me voir... Pouvez-vous m'en débarrasser ? Je vous offrirais quelques pièces en échange.''", 70, 50, 320, 80
    statictext #1.b2,"But : Tuer 3 loups sauvages", 70, 130, 200, 18
    statictext #1.c,"Acceptez-vous ?", 70, 155, 100, 15
    button #1, "Oui", [Q2accept], UL, 180, 150,80,25
    button #1, "Non", [Q2refuse], UL, 280, 150,80,25
end if
if version = 2 then
    statictext #1.a,"Optional Quest : The merchant", 70, 10, 300, 30
    statictext #1.b,"''Hello young ";sexe$;" ! These damn wild wolves keep me from having customers. They complain of being attacked when they come to see me ... Can you get rid of me? I would offer you a few coins in exchange.''", 70, 50, 320, 80
    statictext #1.b2,"Goal : Kill 3 Wild Wolves", 70, 130, 200, 18
    statictext #1.c,"Do you accept ?", 70, 155, 120, 15
    button #1, "YES", [Q2accept], UL, 180, 150,80,25
    button #1, "NO", [Q2refuse], UL, 280, 150,80,25
end if
open "" for dialog_modal_nf as #1
print #1.a, "!font times_new_roman 16 bold italic"
print #1.b, "!font times_new_roman 10 italic"
print #1.b2, "!font times_new_roman 10 bold italic"
print #1.c, "!font times_new_roman 10 bold"
print #1.A, "disable"
#1,"trapclose [w]"
DQop2 = 1
wait


[Q1accept]
close #1
Qvoleur = 1
AlifeVoleur1 = 1
if version = 1 then quest1$ = "La sacoche"
if version = 2 then quest1$ = "Satchel"
quest1STATUT = 0 : quest = 1 : DQop1 = 0 : winQ1 = 0
if version = 1 then notice " " + Chr$(13)+ "Quête acceptée !"
if version = 2 then notice " " + Chr$(13)+ "Acquired quest !"
wait
[Q1refuse]
close #1 : DQop1 = 0 : Qvoleur = 0 : winQ1 = 0 : wait

[Q2accept]
close #1
if version = 1 then quest2$ = "Le marchand"
if version = 2 then quest2$ = "Satchel"
quest = 2 : Q2 = 1 : DQop2 = 0 : winQ2 = 0 : NombreLoupTuer = 0
if version = 1 then notice " " + Chr$(13)+ "Quête acceptée !"
if version = 2 then notice " " + Chr$(13)+ "Acquired quest !"
wait
[Q2refuse]
close #1 : Q2 = 0 : DQop2 = 0 : winQ2 = 0 : wait

[Q1voleur]
if DQop1 = 1 then close #1
WindowWidth = 400
WindowHeight = 185
GenerATKvoleurPOWER = 3
UpperLeftX=int(WindowWidth/2)
UpperLeftY=int(WindowHeight/2)
BackgroundColor$ = "black" : ForegroundColor$ = "white"
bmpbutton #1.A, "bmp\perso\voleur1\icoVoleurButton.bmp", [w], UL, 10, 50
if version = 1 then
statictext #1.a,"Quête optionelle : La sacoche", 70, 10, 300, 30
statictext #1.b,"''Tiens, un étranger.... Ce n'est pas avec ce que tu as que je mangerais  ma faim le morveux ! Bouge de là avant que je te fasse goûter à ma lame.''", 70, 50, 310, 70
statictext #1.c,"Voulez-vous attaquer ?", 20, 120, 150, 50
button #1, "Oui", [confirmQ1], UL, 180, 120,80,25
button #1, "Non", [NOconfirmQ1], UL, 280, 120,80,25
end if
if version = 2 then
statictext #1.a,"Optional Quest : Satchel", 70, 10, 300, 30
statictext #1.b,"''Here, a stranger .... It is not with what you have that I eat my fill the brat! Move away before I make you taste my blade.''", 70, 50, 310, 70
statictext #1.c,"Would you like to attack him ?", 20, 120, 150, 50
button #1, "Yes", [confirmQ1], UL, 180, 120,80,25
button #1, "No", [NOconfirmQ1], UL, 280, 120,80,25
end if
open "" for dialog_modal_nf as #1
print #1.a, "!font times_new_roman 16 bold italic"
print #1.b, "!font times_new_roman 10 italic"
print #1.c, "!font times_new_roman 10 bold"
#1,"trapclose [w]"
DQop1 = 1
wait

[NOconfirmQ1]
Qvoleur = 1 : DQop1 = 0 : close #1 : wait

[confirmQ1]
Qvoleur = 2 : DQop1 = 0 : close #1 : wait

    [DQop1fight1]
    if sex = 1 then sexe$ = "garçon"
    if sex = 2 then sexe$ = "fille"
    BackgroundColor$ = "black" : ForegroundColor$ = "white"
    WindowWidth = 400 : WindowHeight = 200
    UpperLeftX=int((DisplayWidth-WindowWidth)/3)
    UpperLeftY=int((DisplayHeight-WindowHeight)/3)
    bmpbutton #1.A, "bmp\perso\voleur1\icoVoleurButton.bmp", [w], UL, 10, 60
    if version = 1 then
        statictext #1.a,"Quête optionelle : La sacoche", 70, 10, 300, 30
        statictext #1.b,"Je m'avous vaincus, voici la sacoche ...", 70, 60, 310, 17
        statictext #1.c,"Vous avez reçus ";goldQ;" Pièces d'or !", 70, 80, 280, 17
        statictext #1.d,"Vous avez reçus ";xpQ;" Points d'expérience !", 70, 97, 280, 17
        button #1, "Fermer", [DQop1fight1bis], UL, 160, 130,80,25
    end if
    if version = 2 then
        statictext #1.a,"Optional Quest : Satchel", 90, 10, 300, 30
        statictext #1.b,"Ok im done, take the satchel ...", 70, 60, 310, 17
        statictext #1.c,"You have received ";int(gold/10);" gold coins!", 70, 80, 280, 17
        statictext #1.d,"You have received 50 Points of experience !", 70, 97, 280, 17
        button #1, "Fermer", [DQop1fight1bis], UL, 160, 130,80,25
    end if
    open "" for dialog_modal_nf as #1
    print #1.a, "!font times_new_roman 16 bold italic"
    print #1.b, "!font times_new_roman 10 italic"
    print #1.c, "!font times_new_roman 9"
    print #1.d, "!font times_new_roman 9"
    print #1.A, "disable"
    #1,"trapclose [w]"
    wait

    [DQop1fight1bis]
    close #1
    gold = gold + 200
    xp = xp + 250
    if xp >= XpLvL and sex = 1 then gosub [lvlUPwarrior1]
    if xp >= XpLvL and sex = 2 then gosub [lvlUPwarrior2]
    #3b.map,"SpriteVisible hpMONSTER off"
    #3b.map,"SpriteVisible icoVoleur off"
    gosub [persos]
    print #3b.map, "font Times New Roman 7; color white"
    print #3b.map, "backcolor black ; place 295 501 ;\";"PV"
    r = 140 : v = 23 : b = 16
    print #3b.map, "backcolor ";r;" ";v;" ";b;";place 295 532 ;\";PV
    print #3b.map, "backcolor ";r;" ";v;" ";b;"; place 295 560 ;\";PVTotal
    print #3b.map, "backcolor black ; place 700 501 ;\";"PM"
    r = 28 : v = 121 : b = 138
    print #3b.map, "backcolor ";r;" ";v;" ";b;"; place 700 532 ;\";PM
    print #3b.map, "backcolor ";r;" ";v;" ";b;"; place 700 560 ;\";PMTotal
    print #3b.map, "backcolor black ; place 5 429 ;\";"Niveau : ";lvlHero; " ( "; xp;" / ";XpLvL; " )"
    print #3b.map, "place 310 522 ;\"; potionHEAL1
    print #3b.map, "place 310 552 ;\"; potionHEAL2
    print #3b.map, "place 715 522 ;\"; potionPM1
    print #3b.map, "place 715 552 ;\"; potionPM2
    wait


    [DQop2END]
    timer 0
    marchandQ2 = 0
    if DQop2 = 1 then close #1
    WindowWidth = 400 : WindowHeight = 210 : UpperLeftX=int((DisplayWidth-WindowWidth)/3) : UpperLeftY=int((DisplayHeight-WindowHeight)/3)
    BackgroundColor$ = "black" : ForegroundColor$ = "white"
    bmpbutton #1.A, "bmp\icoQ1.bmp", [w], UL, 10, 55
    if version = 1 then
        statictext #1.a,"Quête optionelle : Le marchand", 70, 10, 300, 30
        statictext #1.b,"''Un grand merci, les paysans vont pouvoir revenir m'acheter des marchandises maintenant ! Voici votre récompense :''", 70, 50, 320, 60
        statictext #1.b2,"Or : 150", 80, 120, 100, 15
        statictext #1.c,"Expérience : 120", 80, 140, 100, 15
        button #1, "Fermer", [closeDQ2], UL, 260, 140,80,25
    end if
    open "" for dialog_modal_nf as #1
    print #1.a, "!font times_new_roman 16 bold italic"
    print #1.b, "!font times_new_roman 10 italic"
    print #1.b2, "!font times_new_roman 9 bold"
    print #1.c, "!font times_new_roman 9 bold"
    print #1.A, "disable"
    #1,"trapclose [w]"
    #3b.map,"SpriteVisible indicQ off"
    #3b.map,"drawsprites"
    DQop2 = 1
    gold = gold + 150
    xp = xp + 120
    if xp >= XpLvL and sex = 1 then gosub [lvlUPwarrior1]
    if xp >= XpLvL and sex = 2 then gosub [lvlUPwarrior2]
    wait
    [closeDQ2]
    close #1
    wait

'----MARCHANDS-------------------------------------------------------------------------------

    [marchandQ2]
    WindowWidth = 500 : WindowHeight = 310 : UpperLeftX=int((DisplayWidth-WindowWidth)/3) : UpperLeftY=int((DisplayHeight-WindowHeight)/3)
    BackgroundColor$ = "black" : coutpotionPVpetite = 7 : coutpotionPVmoyenne = 16

    if marchandQ2secu = 1 then close #marchandQ2
    marchandQ2secu = 1

    loadbmp"potion", "bmp\items\lifePOTION.bmp"
    loadbmp"potion2", "bmp\items\lifePOTION2.bmp"
    bmpbutton #marchandQ2.A, "bmp\icoQ1.bmp", [w], UL, 30, 20
    bmpbutton #marchandQ2.a1, "bmp\items\+.bmp", [achatPotionPVPetite], UL, 20, 113
    bmpbutton #marchandQ2.a2, "bmp\items\-.bmp", [moinsPotionPVPetite], UL, 20, 132
    bmpbutton #marchandQ2.a1, "bmp\items\+.bmp", [achatPotionPVMoyenne], UL, 20, 173
    bmpbutton #marchandQ2.a2, "bmp\items\-.bmp", [moinsPotionPVMoyenne], UL, 20, 192
    button #marchandQ2.b, "Acheter", [ItemsMarchandQ2achat], UL, 215, 240
    graphicbox #marchandQ2.map, -5, -5, WindowWidth+5, WindowHeight+5
    open "Marchand itinérant" for dialog_modal_nf as #marchandQ2
    #marchandQ2.map , "Down ; fill black ; backcolor black"
    print #marchandQ2.A, "disable"
    print #marchandQ2.map, "drawbmp potion 50 120"
    print #marchandQ2.map, "drawbmp potion2 50 180"
    print #marchandQ2.map, "font Times New Roman 8; color white"
    print #marchandQ2.map, "place 73 140 ;\"; potionHEAL1marchand
    print #marchandQ2.map, "place 70 200 ;\"; potionHEAL2marchand
    print #marchandQ2.map, "font Times New Roman 10; color white"
    print #marchandQ2.map, "place 350 260 ;\"; "Votre argent : ";gold
    print #marchandQ2.map, "place 50 260 ;\"; "Somme due : ";goldITEMSmarchand
    print #marchandQ2.map, "place 100 35 ;\"; "Bien le bonjour étranger !"
    print #marchandQ2.map, "place 100 50 ;\"; "Voici quelques babiolles que j'ai en stock."
    print #marchandQ2.map, "place 100 65 ;\"; "N'hésite pas à te servir je ferais le compte une fois les achats finis."
    print #marchandQ2.map, "size 1; color white"
    print #marchandQ2.map, "line "; 130; " "; 80; " "; 430; " "; 80
    #marchandQ2,"trapclose [closeMarchandQ2]"
    wait
    [closeMarchandQ2]
    marchandQ2secu = 0
    close #marchandQ2
    wait

    [achatPotionPVPetite]
    if potionHEAL1marchand >= 99 then
        notice "Le maximum de potion portable est atteind."
        potionHEAL1marchand = potionHEAL1marchand
        goto [fixACHAT]
    end if
    goldITEMSmarchand = goldITEMSmarchand + coutpotionPVpetite
    potionHEAL1marchand = potionHEAL1marchand + 1
    goto [fixACHAT]
    [moinsPotionPVPetite]
    if potionHEAL1marchand = 0 then wait
    goldITEMSmarchand = goldITEMSmarchand - coutpotionPVpetite
    potionHEAL1marchand = potionHEAL1marchand - 1
    if potionHEAL1marchand < 0 then potionHEAL1marchand = 0
    goto [fixACHAT]

    [achatPotionPVMoyenne]
    if potionHEAL2marchand >= 99 then
        notice "Le maximum de potion portable est atteind."
        potionHEAL2marchand = potionHEAL2marchand
        goto [fixACHAT]
    end if
    goldITEMSmarchand = goldITEMSmarchand + coutpotionPVmoyenne
    potionHEAL2marchand = potionHEAL2marchand + 1
    goto [fixACHAT]
    [moinsPotionPVMoyenne]
    if potionHEAL2marchand = 0 then wait
    goldITEMSmarchand = goldITEMSmarchand - coutpotionPVmoyenne
    potionHEAL2marchand = potionHEAL2marchand - 1
    if potionHEAL2marchand < 0 then potionHEAL2marchand = 0
    goto [fixACHAT]

    [achatPotionPVGrande]

    [fixACHAT]
    print #marchandQ2.map, "font Times New Roman 8; color white"
    print #marchandQ2.map, "place 73 140 ;\"; "          "
    print #marchandQ2.map, "place 70 200 ;\"; "          "
    print #marchandQ2.map, "place 73 140 ;\"; potionHEAL1marchand
    print #marchandQ2.map, "place 70 200 ;\"; potionHEAL2marchand
    print #marchandQ2.map, "font Times New Roman 10; color white"
    print #marchandQ2.map, "place 350 260 ;\"; "Votre argent : "; "          "
    print #marchandQ2.map, "place 350 260 ;\"; "Votre argent : ";gold
    print #marchandQ2.map, "place 50 260 ;\"; "Somme due : "; "           "
    print #marchandQ2.map, "place 50 260 ;\"; "Somme due : ";goldITEMSmarchand
    wait
    [ItemsMarchandQ2achat]
    if gold >= goldITEMSmarchand then
        gold = gold - goldITEMSmarchand
        potionHEAL1 = potionHEAL1 + potionHEAL1marchand
        potionHEAL2 = potionHEAL2 + potionHEAL2marchand
        potionHEAL1marchand = 0
        potionHEAL2marchand = 0
        goldITEMSmarchand = 0
        if potionHEAL1 >99 then potionHEAL1 = 99 : notice "votre maximum de potion est atteind, vous ne pouvez pas porter plus de potion de cette catégorie. Objet laché."
        if potionHEAL2 >99 then potionHEAL2 = 99 : notice "votre maximum de potion est atteind, vous ne pouvez pas porter plus de potion de cette catégorie. Objet laché."
        notice "achat éffectué!"
        goto [fixACHAT]
    end if
    wait

'-----déplacement-------------------------------------------------------------------------------------------------------------------|

            [persod]
            direction = 1 : direction2 = 1
            #3b.map,"SpriteVisible perso1s off; SpriteVisible perso1q off; SpriteVisible perso1z off; SpriteVisible perso1d on"
            perso1dx=perso1dx+6
            perso1qx=perso1dx : perso1sx=perso1dx : perso1zx=perso1dx : perso1qy=perso1dy : perso1sy=perso1dy : perso1zy=perso1dy
            #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy
            #3b.map, "cyclesprite perso1d 1 once"
            compteurPV = compteurPV +1
            return

            [persos]
            direction = 2 : direction2 = 2
            #3b.map,"SpriteVisible perso1q off; SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1s on"
            perso1sy=perso1sy+6
            perso1dy=perso1sy : perso1zy=perso1sy : perso1qy=perso1sy : perso1dx=perso1sx : perso1zx=perso1sx : perso1qx=perso1sx
            #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy
            #3b.map, "cyclesprite perso1s 1 once"
            compteurPV = compteurPV +1
            return

            [persoq]
            direction = 3 : direction2 = 3
            #3b.map,"SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1q on"
            perso1qx=perso1qx-6
            perso1dx=perso1qx : perso1sx=perso1qx : perso1zx=perso1qx : perso1dy=perso1qy : perso1sy=perso1qy : perso1zy=perso1qy
            #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy
            #3b.map, "cyclesprite perso1q 1 once"
            compteurPV = compteurPV +1
            return

            [persoz]
            direction = 4 : direction2 = 4
            #3b.map,"SpriteVisible perso1q off; SpriteVisible perso1d off; SpriteVisible perso1s off; SpriteVisible perso1z on"
            perso1zy=perso1zy-6
            perso1dy=perso1zy : perso1qy=perso1zy : perso1sy=perso1zy : perso1dx=perso1zx : perso1qx=perso1zx : perso1sx=perso1zx
            #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy
            #3b.map, "cyclesprite perso1z 1 once"
            compteurPV = compteurPV +1
            return

    [case]
    timer 0
    PUSH = 1
    select case
        case asc(right$(Inkey$,1))= _VK_LEFT : gosub [persoq]
        case asc(right$(Inkey$,1))= _VK_DOWN : gosub [persos]
        case asc(right$(Inkey$,1))= _VK_RIGHT : gosub [persod]
        case asc(right$(Inkey$,1))= _VK_UP : gosub [persoz]
        case Inkey$ = "q" or Inkey$ = "Q" : gosub [persoq]
        case Inkey$ = "d" or Inkey$ = "D" : gosub [persod]
        case Inkey$ = "z" or Inkey$ = "Z" : gosub [persoz]
        case Inkey$ = "s" or Inkey$ = "S" : gosub [persos]
        case Inkey$ = "i" or Inkey$ = "I" : gosub [inventaire]
        case Inkey$ = "l" or Inkey$ = "L" : gosub [sort]
    end select

    mapSELECT = map
    Inkey$ = ""
    return


[zonage]
#3b.map, "SpriteVisible hpMONSTER off; SpriteVisible ico off"
select case map
    case 1
        gosub [limitesMAP1] : return
    case 2
        gosub [limitesMAP2] : return
    case 3
        gosub [limitesMAP3] : return
    case 4
        gosub [limitesMAP4] : return
    case 5
        gosub [limitesMAP5] : return
    case 6
        gosub [limitesMAP6] : return
    case 7
        gosub [limitesMAP7] : return
    case 8
        gosub [limitesMAP8] : return
    case 9
        gosub [limitesMAP9] : return
    case 10
        gosub [limitesMAP10] : return
    case 11
        gosub [limitesMAP11] : return
    case 12
        gosub [limitesMAP12] : return
    case 13
        gosub [limitesMAP13] : return
    case 14
        gosub [limitesMAP14] : return
    case 15
        gosub [limitesMAP15] : return
    case 16
        gosub [limitesMAP16] : return
    case 17
        gosub [limitesMAP17] : return
    case 18
        gosub [limitesMAP18] : return
    case 19
        gosub [limitesMAP19] : return
    case 20
        gosub [limitesMAP20] : return
    case 21
        gosub [limitesMAP21] : return
    case 22
        gosub [limitesMAP22] : return
end select


    [deplacementBOUCLE2]
    'déplacement du personnage a la souris partie 1
    [marcheDROITE2]
    if mX > perso1dx and BLOCKED = 0 then
        direction = 1 : direction2 = 1
        perso1dxOLD = perso1dx : perso1dx = perso1dx + 6 : PERSOxSECU = int(perso1dx/6) : perso1dx = PERSOxSECU * 6
        if perso1dx > mX then perso1dx = mX
        gosub [zonage]
        if perso1dx = perso1dxOLD then BLOCKED = 1
        #3b.map,"SpriteVisible perso1s off; SpriteVisible perso1q off; SpriteVisible perso1z off; SpriteVisible perso1d on"
        perso1qx=perso1dx : perso1sx=perso1dx : perso1zx=perso1dx : perso1qy=perso1dy : perso1sy=perso1dy : perso1zy=perso1dy
        #3b.map, "spritexy perso1d ";perso1dx;" ";perso1dy
        #3b.map, "cyclesprite perso1d 1 once"
        activPOS1 = 1 : GOTO [deplacementBOUCLE]
    end if

    [marcheGAUCHE2]
    if mX < perso1qx and BLOCKED = 0 then
        direction = 2 : direction2 = 2
        perso1qxOLD = perso1qx : perso1qx = perso1qx - 6 : PERSOxSECU = int(perso1qx/6) : perso1qx = PERSOxSECU * 6
        if perso1qx < mX then perso1qx = mX
        gosub [zonage]
        if perso1qx = perso1qxOLD then BLOCKED = 1
        #3b.map,"SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1z off; SpriteVisible perso1q on"
        perso1dx=perso1qx : perso1sx=perso1qx : perso1zx=perso1qx : perso1dy=perso1qy : perso1sy=perso1qy : perso1zy=perso1qy
        #3b.map, "spritexy perso1q ";perso1qx;" ";perso1qy
        #3b.map, "cyclesprite perso1q 1 once"
        activPOS2 = 1 : GOTO [deplacementBOUCLE]
    end if

    [marcheHAUT2]
    if mY < perso1zy and BLOCKED = 0 then
        direction = 3 : direction2 = 3
        perso1zyOLD = perso1zy : perso1zy = perso1zy - 6 : PERSOySECU = int(perso1zy/6) : perso1zy = PERSOySECU * 6
        if perso1zy < mY then perso1zy = mY
        gosub [zonage]
        if perso1zy = perso1zyOLD then BLOCKED = 1
        #3b.map,"SpriteVisible perso1s off; SpriteVisible perso1d off; SpriteVisible perso1q off; SpriteVisible perso1z on"
        perso1qy=perso1zy : perso1sy=perso1zy : perso1dy=perso1zy : perso1qx=perso1zx : perso1sx=perso1zx : perso1dx=perso1zx
        #3b.map, "spritexy perso1z ";perso1zx;" ";perso1zy
        #3b.map, "cyclesprite perso1z 1 once"
        activPOS3 = 1 : GOTO [deplacementBOUCLE]
    end if

    [marcheBAS2]
    if mY > perso1sy and BLOCKED = 0 then
        direction = 4 : direction2 = 4
        perso1syOLD = perso1sy : perso1sy = perso1sy + 6 : PERSOySECU = int(perso1sy/6) : perso1sy = PERSOySECU * 6
        if perso1sy > mY then perso1sy = mY
        gosub [zonage]
        if perso1sy = perso1syOLD then BLOCKED = 1
        #3b.map,"SpriteVisible perso1z off; SpriteVisible perso1d off; SpriteVisible perso1q off; SpriteVisible perso1s on"
        perso1zy=perso1sy : perso1dy=perso1sy : perso1qy=perso1sy : perso1zx=perso1sx : perso1dx=perso1sx : perso1qx=perso1sx
        #3b.map, "spritexy perso1s ";perso1sx;" ";perso1sy
        #3b.map, "cyclesprite perso1s 1 once"
        activPOS4 = 1 : GOTO [deplacementBOUCLE]
    end if

    [deplacementBOUCLE]
    timer 0
    #3b.map, "when leftButtonDown [SimpleClickStart]"
    compteurPV = compteurPV +1 : PUSH = 1 : mapSELECT = map

    if AlifeE1 = 0 then compteur1 = compteur1 +1
    if AlifeE11 = 0 then compteur2 = compteur2 +1
    if AlifeE12 = 0 then compteur3 = compteur3 +1
    if AlifeE13 = 0 then compteur4 = compteur4 +1
    if AlifeE14 = 0 then compteur5 = compteur5 +1
    if AlifeE15 = 0 then compteur6 = compteur6 +1
    if AlifeE16 = 0 then compteur7 = compteur7 +1
    if AlifeE17 = 0 then compteur8 = compteur8 +1
    if AlifeE18 = 0 then compteur9 = compteur9 +1
    if AlifeE19 = 0 then compteur10 = compteur10 +1

    #3b.map,"SpriteVisible atk1 off"
    #3b.map,"SpriteVisible atk2 off"

'declencheurs mouvements des ennemis

            if AlifeVoleur1 = 1 and map = 5 then
                random = int(rnd(1)*20+1)
                if random = 2 then #3b.map,"SpriteVisible voleur1q off; SpriteVisible voleur1d off; SpriteVisible voleur1z off; SpriteVisible voleur1s on"
                if random = 3 then #3b.map,"SpriteVisible voleur1s off; SpriteVisible voleur1d off; SpriteVisible voleur1z off; SpriteVisible voleur1q on"
                if random = 4 then #3b.map,"SpriteVisible voleur1z off; SpriteVisible voleur1q off; SpriteVisible voleur1s off; SpriteVisible voleur1d on"
            end if
            if AlifeVoleur1 = 0 or AlifeVoleur1 = 2 and map = 5 then #3b.map,"SpriteVisible voleur1z off; SpriteVisible voleur1d off; SpriteVisible voleur1q off; SpriteVisible voleur1s off"

            if map = 7 then
                random = int(rnd(1)*2+1)
                if random = 1 then #3b.map,"SpriteVisible Q2q off; SpriteVisible Q2d on"
                if random = 2 then #3b.map,"SpriteVisible Q2d off; SpriteVisible Q2q on"
                if Q2 = 1 or Q2 = 2 then #3b.map,"SpriteVisible Q2q off; SpriteVisible Q2d off"
            end if


if compteurPV = PVregenVIT then
    compteurPV = 0
    PV = PV+PVregenTOTAL+passive8
    PM = PM+PMregenTOTAL+passive9
    if PV > PVTotal then PV = PVTotal
    if PM > PMTotal then PM = PMTotal
end if

if AlifeE1 = 0 and compteur1 >=300 then PvE1 = PvE1TOTAL : AlifeE1= 1 : compteur1 = 0
if AlifeE11 = 0 and compteur2 >=300 then PvE11 = PvE11TOTAL : AlifeE11= 1 : compteur2 = 0
if AlifeE12 = 0 and compteur12 >=300 then PvE12 = PvE12TOTAL : AlifeE12= 1 : compteur3 = 0
if AlifeE13 = 0 and compteur13 >=300 then PvE13 = PvE13TOTAL : AlifeE13= 1 : compteur4 = 0
if AlifeE14 = 0 and compteur14 >=300 then PvE14 = PvE14TOTAL : AlifeE14= 1 : compteur5 = 0
if AlifeE15 = 0 and compteur15 >=300 then PvE15 = PvE15TOTAL : AlifeE15= 1 : compteur6 = 0
if AlifeE16 = 0 and compteur16 >=300 then PvE16 = PvE16TOTAL : AlifeE16= 1 : compteur7 = 0
if AlifeE17 = 0 and compteur17 >=300 then PvE17 = PvE17TOTAL : AlifeE17= 1 : compteur8 = 0
if AlifeE18 = 0 and compteur18 >=300 then PvE18 = PvE18TOTAL : AlifeE18= 1 : compteur9 = 0
if AlifeE19 = 0 and compteur19 >=300 then PvE19 = PvE19TOTAL : AlifeE19= 1 : compteur10 = 0

        if direction = 1 then persoX = perso1dx : persoY = perso1dy
        if direction = 2 then persoX = perso1sx : persoY = perso1sy
        if direction = 3 then persoX = perso1qx : persoY = perso1qy
        if direction = 4 then persoX = perso1zx : persoY = perso1zy

dommage = int((rnd(1)*int(atk+1))-defE)
dommageE = int(((rnd(1)*int(atkE+1))-def/2)*factor)
if dommageE< 0 then dommageE = 0
if dommage< 0 then dommage = 0

    if AlifeVoleur1 = 1 and Qvoleur = 2 and int(voleur1dx - persoX) < 20 and int(voleur1dx - persoX) > -20 AND int(voleur1dy - persoY) < 40 and int(voleur1dy - persoY) > -20 then
        ATKon = 0
        GenerATKhero = GenerATKhero +1
        GenerATKvoleur = GenerATKvoleur +1
        if GenerATKhero >= GenerATKheroPOWER then
            ATKon = 1
            GenerATKhero = 0
        end if
        ATKonVOLEUR = 0
        if GenerATKvoleur >= GenerATKvoleurPOWER then ATKonVOLEUR = 1 : GenerATKvoleur = 0

        if ATKonVOLEUR = 1 then
            dommageE = int(((rnd(1)*int(Q1atk+1))-def/2)*factor)
            if dommageE< 0 then dommageE = 0
            PV = int(PV - dommageE)
            fightVOLEUR1 = 1
            if voleur1dx < persoX and voleur1dy > persoY-20 and voleur1dy < persoY+15 then #3b.map,"spritexy atk1 ";persoX;" ";persoY
            if voleur1dx > persoX and voleur1dy > persoY-20 and voleur1dy < persoY+15 then #3b.map,"spritexy atk1 ";persoX;" ";persoY
            if voleur1dx > persoX -15 and voleur1dx < persoX +15 and voleur1dy < persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY
            if voleur1dx > persoX -15 and voleur1dx < persoX +15 and voleur1dy > persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY
            #3b.map,"SpriteVisible atk1 on"
        end if
        if ATKon = 1 then
            dommage = int((rnd(1)*int(atk+1))-Q1def)
            if dommage< 0 and ATKon = 1 then dommage = 0
            vieQ1 = int(vieQ1-dommage)
            if bruitage = 0 and dommage>0 then playwave "bmp\perso\CHARACT\song\coupOK.wav", async
            if bruitage = 0 and dommage=0 then playwave "bmp\perso\CHARACT\song\coupNO.wav", async
            if voleur1dx > persoX and voleur1dy > persoY-20 and voleur1dy < persoY+15 then #3b.map,"spritexy atk1 ";persoX+15;" ";persoY+5
            if voleur1dx > persoX -15 and voleur1dx < persoX +15 and voleur1dy < persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY -25
            if voleur1dx < persoX and voleur1dy > persoY-20 and voleur1dy < persoY+15 then #3b.map,"spritexy atk1 ";persoX-25;" ";persoY+5
            if voleur1dx > persoX -15 and voleur1dx < persoX +15 and voleur1dy > persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY +30
            #3b.map,"SpriteVisible atk1 on"
        end if

        #3b.map,"SpriteVisible hpMONSTER on; SpriteVisible icoVoleur on"
        #3b.map,"drawsprites"

        if version = 1 then
           print #3b.map, "backcolor ";68;" ";33;" ";27;";" ;" place 165 40;\";"PV : ";vieQ1;" / ";vieQ1Total
           print #3b.map, "backcolor ";68;" ";33;" ";27;";" ;" place 80 40;\";"Niveau : ";LvlMonsterQ
        end if
        if version = 2 then
           print #3b.map, "backcolor ";68;" ";33;" ";27;";" ;" place 165 40;\";"HP : ";vieQ1;" / ";vieQ1Total
           print #3b.map, "backcolor ";68;" ";33;" ";27;";" ;" place 80 40;\";"Level : ";LvlMonsterQ
        end if

        if ATKon = 1 then print #3b.map, "backcolor red ; place ";voleur1dx;" ";int(voleur1dy+10);" ;\";" -" ;dommage
        if ATKonVOLEUR = 1 then print #3b.map, "backcolor blue ; place ";perso1dx;" ";int(perso1dy+20);" ;\";" -" ;dommageE

        if vieQ1 <= 0 then
           AlifeVoleur1 = 0
           gold = gold + goldQ + GOLDbonus
           QvoleurSecur = 0
           winQ1 = 1
           Qvoleur = 3
           DQop1PART2 = 0
           xp = xp + xpQ + XPbonus
           PotionRND = int(rnd(1)*10+1)
                if PotionRND = 10 then
                    potionHEAL1 = potionHEAL1 + 3
                    notice "Vous avez trouvé trois petites potions"
                end if
           if xp >= XpLvL and sex = 1 and campagne = 1 then gosub [lvlUPwarrior1]
           if xp >= XpLvL and sex = 2 and campagne = 1 then gosub [lvlUPwarrior2]
           if xp >= XpLvL and sex = 2 or sex = 1 and campagne = 4 then gosub [lvlUPnecrom]
           if xp >= XpLvL and sex = 1 and campagne = 2 then gosub [lvlUParcher1]
           if xp >= XpLvL and sex = 2 and campagne = 2 then gosub [lvlUParcher2]
           if xp >= XpLvL and sex = 1 and campagne = 3 then gosub [lvlUPmage1]
           if xp >= XpLvL and sex = 2 and campagne = 3 then gosub [lvlUPmage2]
           if xp >= XpLvL and sex = 2 and campagne = 5 then gosub [lvlUPmarchand2]
        end if


       'colision en X
    if AlifeVoleur1 = 1 and perso1dy>=int(voleur1dy-25) and perso1dy<=int(voleur1dy+15) then
       if perso1dx>int(voleur1dx-18) and perso1dx<int(voleur1dx-6) then perso1dx=int(voleur1dx -24)
       if perso1qx<int(voleur1dx+18) and perso1qx>int(voleur1dx+6) then perso1qx=int(voleur1dx +24)
    end if
    'colision en Y
    if AlifeVoleur1 = 1 and perso1zx>=int(voleur1dx-12) and perso1zx<=int(voleur1dx+12) then
       if perso1zy<int(voleur1dy+24) then perso1zy=int(voleur1dy+24)
    end if
    goto [endQ1fight2]
    end if

    if AlifeVoleur1 = 1 and Qvoleur = 2 and (int(voleur1dx - persoX) > 20 or int(voleur1dx - persoX) < -20 or int(voleur1dy - persoY) > 40 or int(voleur1dy - persoY) < -20) then #3b.map,"SpriteVisible icoVoleur off"


     ' supprime le backcolor pour texte transparent
    hGBox = hwnd(#3b.map)
    CallDLL #user32, "GetDC",_
        hGBox As ulong,_  'handle of graphicbox
        gDC As ulong      'device context
   ' CallDLL #gdi32, "SetBkMode",_
   '     gDC As ulong,_          'handle of graphicbox
   '     _TRANSPARENT As long,_  'flag for transparent background
   '     result As long          'previous bkmode
    CallDLL #gdi32, "SetBkMode",_
       gDC As ulong,_     'handle of graphicbox
       _TRANSPARENT As long,_ '_OPAQUE As long,_  'flag for opaque background
       result As long     'previous bkmode

    CallDLL#user32,"ReleaseDC",_
        hGBox As ulong,_    'graphicbox handle
        gDC As ulong,_      'device context
        result As long


' ------ AI 1 2.0 ------

    if AlifeE1 = 1 and int(E1x - persoX) < 30 and int(E1x - persoX) > -30 AND int(E1y - persoY) <42 and int(E1y - persoY) > -30 then
        GenerATKhero = GenerATKhero +1 : ATKon = 0 : noMOOVEe1 = 1 : Ex = E1x : Ey = E1y : PvE = PvE1 : PvETOTAL = PvE1TOTAL : LvlMonster = LvlMonster1 : AlifeE = AlifeE1
        if GenerATKhero >= GenerATKheroPOWER then ATKon = 1 : GenerATKhero = 0
        GenerATKe1 = GenerATKe1+1 : ATKE1on = 0 : PvE1$ = "on"
        if GenerATKe1 >= GenerATKe1POWER then ATKE1on = 1 : GenerATKe1 = 0

        if (ATKE1on = 1 or ATKE2on = 1 or ATKE3on = 1 or ATKE4on = 1 or ATKE5on = 1 or ATKE6on = 1 or ATKE7on = 1) then
            if bruitage = 0 then playwave "bmp\perso\dog1\song\songATAK.wav", async
            PV = int(PV - dommageE)
            if E1x < persoX and E1y > persoY-20 and E1y < persoY+15 then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E1x > persoX and E1y > persoY-20 and E1y < persoY+15 then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E1x > persoX -15 and E1x < persoX +15 and E1y < persoY then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E1x > persoX -15 and E1x < persoX +15 and E1y > persoY then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            #3b.map,"SpriteVisible atk2 on"
        end if
        if ATKon = 1 then
            PvE1 = int(PvE1 - dommage) : PvE = PvE1
            if bruitage = 0 and dommage>0 then playwave "bmp\perso\CHARACT\song\coupOK.wav", async
            if bruitage = 0 and dommage=0 then playwave "bmp\perso\CHARACT\song\coupNO.wav", async
            if E1x < persoX and E1y > persoY-20 and E1y < persoY+15 then #3b.map,"spritexy atk1 ";persoX-25;" ";persoY+5
            if E1x > persoX and E1y > persoY-20 and E1y < persoY+15 then #3b.map,"spritexy atk1 ";persoX+15;" ";persoY+5
            if E1x > persoX -15 and E1x < persoX +15 and E1y < persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY -35
            if E1x > persoX -15 and E1x < persoX +15 and E1y > persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY +30
            #3b.map,"SpriteVisible atk1 on"
        end if

        #3b.map,"SpriteVisible hpMONSTER on; SpriteVisible ico on"
        gosub [textATKrefresh]

        if PvE1 <= 0 then
            AlifeE1 = 0 : AlifeE = 0 : MonsterREGEN = 1 : Ex = 0 : Ey = 0 : ATKon = 0 : ATKE1on = 0 : secuWALKING = 0 : gold = gold + int(rnd(1)*int(LvlMonster1*5+1)) + GOLDbonus : xp = xp + int(rnd(1)*int(LvlMonster1*10)+map*5) + XPbonus
            if Q2 = 1 and DQop2 = 0 and winQ2 = 0 then NombreLoupTuer = NombreLoupTuer +1
            PotionRND = int(rnd(1)*10+1)
            if PotionRND = 10 then potionHEAL1 = potionHEAL1 + 1 : notice "Vous avez trouvé une petite potion"
            gosub [upPersoFIGHT]
        end if
        PvE1$ = "off"
    end if

    gosub [colisionENNEMI]

            if AlifeE1 = 1 and noMOOVEe1 = 0 then
                random1 = int(rnd(1)*6+1)
                if distanceREEL1 >0 then random1 = activatorDistance1
                if random1 = 1 then 'up
                    random1HOLD = random1 : activatorDistance1 = 1
                    if distanceREEL1 = 0 then distanceREEL1 = int(rnd(1)*8+1)
                    distanceREEL1 = distanceREEL1 - 1 : if distanceREEL1 = 0 then activatorDistance1 = 0
                    E1y=E1y - 3
                    gosub [limitesENNEMISmap]
                    #3b.map, "SpriteVisible Ea1 off; SpriteVisible Eb1 off; SpriteVisible Ec1 off; SpriteVisible Ed1 on"
                    #3b.map, "spritexy Ed1 ";E1x;" ";E1y
                    #3b.map, "cyclesprite Ed1 1 once"
                end if
                if random1 = 2 then 'down
                    random1HOLD = random1 : activatorDistance1 = 2
                    if distanceREEL1 = 0 then distanceREEL1 = int(rnd(1)*8+1)
                    distanceREEL1 = distanceREEL1 - 1 : if distanceREEL1 = 0 then activatorDistance1 = 0
                    E1y=E1y + 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ea1 off; SpriteVisible Eb1 off; SpriteVisible Ed1 off; SpriteVisible Ec1 on"
                    #3b.map,"spritexy Ec1 ";E1x;" ";E1y
                    #3b.map, "cyclesprite Ec1 1 once"
                end if
                if random1 = 3 then 'left
                    random1HOLD = random1 : activatorDistance1 = 3
                    if distanceREEL1 = 0 then distanceREEL1 = int(rnd(1)*8+1)
                    distanceREEL1 = distanceREEL1 - 1 : if distanceREEL1 = 0 then activatorDistance1 = 0
                    E1x=E1x - 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ec1 off; SpriteVisible Eb1 off; SpriteVisible Ed1 off; SpriteVisible Ea1 on"
                    #3b.map,"spritexy Ea1 ";E1x;" ";E1y
                    #3b.map, "cyclesprite Ea1 1 once"
                end if
                if random1 = 4 then 'right
                    random1HOLD = random1 : activatorDistance1 = 4
                    if distanceREEL1 = 0 then distanceREEL1 = int(rnd(1)*8+1)
                    distanceREEL1 = distanceREEL1 - 1 : if distanceREEL1 = 0 then activatorDistance1 = 0
                    E1x=E1x + 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ea1 off; SpriteVisible Ec1 off; SpriteVisible Ed1 off; SpriteVisible Eb1 on"
                    #3b.map,"spritexy Eb1 ";E1x;" ";E1y
                    #3b.map, "cyclesprite Eb1 1 once"
                end if
            end if
            if AlifeE1 = 0 then #3b.map, "SpriteVisible Ea1 off; SpriteVisible Eb1 off; SpriteVisible Ec1 off; SpriteVisible Ed1 off"


' ------ AI 2 2.0 ------

    if AlifeE11 = 1 and int(E11x - persoX) < 30 and int(E11x - persoX) > -30 AND int(E11y - persoY) <42 and int(E11y - persoY) > -30 then
        GenerATKhero = GenerATKhero +1 : ATKon = 0 : noMOOVEe2 = 1 : Ex = E11x : Ey = E11y : PvE = PvE11 : PvETOTAL = PvE11TOTAL : LvlMonster = LvlMonster2 : AlifeE = AlifeE11
        if GenerATKhero >= GenerATKheroPOWER then ATKon = 1 : GenerATKhero = 0
        GenerATKe2 = GenerATKe2+1 : ATKE2on = 0 : PvE11$ = "on"
        if GenerATKe2 >= GenerATKe2POWER then ATKE2on = 1 : GenerATKe2 = 0

        if (ATKE1on = 1 or ATKE2on = 1 or ATKE3on = 1 or ATKE4on = 1 or ATKE5on = 1 or ATKE6on = 1 or ATKE7on = 1) then
            if bruitage = 0 then playwave "bmp\perso\dog1\song\songATAK.wav", async
            PV = int(PV - dommageE)
            if E11x < persoX and E11y > persoY-20 and E11y < persoY+15 then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E11x > persoX and E11y > persoY-20 and E11y < persoY+15 then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E11x > persoX -15 and E11x < persoX +15 and E11y < persoY then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E11x > persoX -15 and E11x < persoX +15 and E11y > persoY then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            #3b.map,"SpriteVisible atk2 on"
        end if
        if ATKon = 1 then
            PvE11 = int(PvE11 - dommage) : PvE = PvE11
            if bruitage = 0 and dommage>0 then playwave "bmp\perso\CHARACT\song\coupOK.wav", async
            if bruitage = 0 and dommage=0 then playwave "bmp\perso\CHARACT\song\coupNO.wav", async
            if E11x < persoX and E11y > persoY-20 and E11y < persoY+15 then #3b.map,"spritexy atk1 ";persoX-25;" ";persoY+5
            if E11x > persoX and E11y > persoY-20 and E11y < persoY+15 then #3b.map,"spritexy atk1 ";persoX+15;" ";persoY+5
            if E11x > persoX -15 and E11x < persoX +15 and E11y < persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY -35
            if E11x > persoX -15 and E11x < persoX +15 and E11y > persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY +30
            #3b.map,"SpriteVisible atk1 on"
        end if

        #3b.map,"SpriteVisible hpMONSTER on; SpriteVisible ico on"
        gosub [textATKrefresh]

        if PvE11 <= 0 then
            AlifeE11 = 0 : AlifeE = 0 : MonsterREGEN = 1 : Ex = 0 : Ey = 0 : ATKon = 0 : ATKE2on = 0 : secuWALKING = 0 : gold = gold + int(rnd(1)*int(LvlMonster2*5+1)) + GOLDbonus : xp = xp + int(rnd(1)*int(LvlMonster2*10)+map*5) + XPbonus
            if Q2 = 1 and DQop2 = 0 and winQ2 = 0 then NombreLoupTuer = NombreLoupTuer +1
            PotionRND = int(rnd(1)*10+1)
            if PotionRND = 10 then potionHEAL1 = potionHEAL1 + 1 : notice "Vous avez trouvé une petite potion"
            gosub [upPersoFIGHT]
        end if
        PvE11$ = "off"
    end if

    gosub [colisionENNEMI]

            if AlifeE11 = 1 and noMOOVEe2 = 0 then
                random2 = int(rnd(1)*6+1)
                if distanceREEL2 >0 then random2 = activatorDistance2
                if random2 = 1 then 'up
                    random2HOLD = random2 : activatorDistance2 = 1
                    if distanceREEL2 = 0 then distanceREEL2 = int(rnd(1)*8+1)
                    distanceREEL2 = distanceREEL2 - 1 : if distanceREEL2 = 0 then activatorDistance2 = 0
                    E11y=E11y - 3
                    gosub [limitesENNEMISmap]
                    #3b.map, "SpriteVisible Ea11 off; SpriteVisible Eb11 off; SpriteVisible Ec11 off; SpriteVisible Ed11 on"
                    #3b.map, "spritexy Ed11 ";E11x;" ";E11y
                    #3b.map, "cyclesprite Ed11 1 once"
                end if
                if random2 = 2 then 'down
                    random2HOLD = random2 : activatorDistance2 = 2
                    if distanceREEL2 = 0 then distanceREEL2 = int(rnd(1)*8+1)
                    distanceREEL2 = distanceREEL2 - 1 : if distanceREEL2 = 0 then activatorDistance2 = 0
                    E11y=E11y + 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ea11 off; SpriteVisible Eb11 off; SpriteVisible Ed11 off; SpriteVisible Ec11 on"
                    #3b.map,"spritexy Ec11 ";E11x;" ";E11y
                    #3b.map, "cyclesprite Ec11 1 once"
                end if
                if random2 = 3 then 'left
                    random2HOLD = random2 : activatorDistance2 = 3
                    if distanceREEL2 = 0 then distanceREEL2 = int(rnd(1)*8+1)
                    distanceREEL2 = distanceREEL2 - 1 : if distanceREEL2 = 0 then activatorDistance2 = 0
                    E11x=E11x - 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ec11 off; SpriteVisible Eb11 off; SpriteVisible Ed11 off; SpriteVisible Ea11 on"
                    #3b.map,"spritexy Ea11 ";E11x;" ";E11y
                    #3b.map, "cyclesprite Ea11 1 once"
                end if
                if random2 = 4 then 'right
                    random2HOLD = random2 : activatorDistance2 = 4
                    if distanceREEL2 = 0 then distanceREEL2 = int(rnd(1)*8+1)
                    distanceREEL2 = distanceREEL2 - 1 : if distanceREEL2 = 0 then activatorDistance2 = 0
                    E11x=E11x + 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ea11 off; SpriteVisible Ec11 off; SpriteVisible Ed11 off; SpriteVisible Eb11 on"
                    #3b.map,"spritexy Eb11 ";E11x;" ";E11y
                    #3b.map, "cyclesprite Eb11 1 once"
                end if
            end if
            if AlifeE11 = 0 then #3b.map, "SpriteVisible Ea11 off; SpriteVisible Eb11 off; SpriteVisible Ec11 off; SpriteVisible Ed11 off"


' ------ AI 3 2.0 ------

        if AlifeE12 = 1 and int(E12x - persoX) < 30 and int(E12x - persoX) > -30 AND int(E12y - persoY) <42 and int(E12y - persoY) > -30 then
        GenerATKhero = GenerATKhero +1 : ATKon = 0 : noMOOVEe3 = 1 : Ex = E12x : Ey = E12y : PvE = PvE12 : PvETOTAL = PvE12TOTAL : LvlMonster = LvlMonster3 : AlifeE = AlifeE12
        if GenerATKhero >= GenerATKheroPOWER then ATKon = 1 : GenerATKhero = 0
        GenerATKe3 = GenerATKe3+1 : ATKE3on = 0 : PvE12$ = "on"
        if GenerATKe3 >= GenerATKe3POWER then ATKE3on = 1 : GenerATKe3 = 0

        if (ATKE1on = 1 or ATKE2on = 1 or ATKE3on = 1 or ATKE4on = 1 or ATKE5on = 1 or ATKE6on = 1 or ATKE7on = 1) then
            if bruitage = 0 then playwave "bmp\perso\dog1\song\songATAK.wav", async
            PV = int(PV - dommageE)
            if E12x < persoX and E12y > persoY-20 and E12y < persoY+15 then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E12x > persoX and E12y > persoY-20 and E12y < persoY+15 then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E12x > persoX -15 and E12x < persoX +15 and E12y < persoY then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E12x > persoX -15 and E12x < persoX +15 and E12y > persoY then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            #3b.map,"SpriteVisible atk2 on"
        end if
        if ATKon = 1 then
            PvE12 = int(PvE12 - dommage) : PvE = PvE12
            if bruitage = 0 and dommage>0 then playwave "bmp\perso\CHARACT\song\coupOK.wav", async
            if bruitage = 0 and dommage=0 then playwave "bmp\perso\CHARACT\song\coupNO.wav", async
            if E12x < persoX and E12y > persoY-20 and E12y < persoY+15 then #3b.map,"spritexy atk1 ";persoX-25;" ";persoY+5
            if E12x > persoX and E12y > persoY-20 and E12y < persoY+15 then #3b.map,"spritexy atk1 ";persoX+15;" ";persoY+5
            if E12x > persoX -15 and E12x < persoX +15 and E12y < persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY -35
            if E12x > persoX -15 and E12x < persoX +15 and E12y > persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY +30
            #3b.map,"SpriteVisible atk1 on"
        end if

        #3b.map,"SpriteVisible hpMONSTER on; SpriteVisible ico on"
        gosub [textATKrefresh]

        if PvE12 <= 0 then
            AlifeE12 = 0 : AlifeE = 0 : MonsterREGEN = 1 : Ex = 0 : Ey = 0 : ATKon = 0 : ATKE3on = 0 : secuWALKING = 0 : gold = gold + int(rnd(1)*int(LvlMonster3*5+1)) + GOLDbonus : xp = xp + int(rnd(1)*int(LvlMonster3*10)+map*5) + XPbonus
            if Q2 = 1 and DQop2 = 0 and winQ2 = 0 then NombreLoupTuer = NombreLoupTuer +1
            PotionRND = int(rnd(1)*10+1)
            if PotionRND = 10 then potionHEAL1 = potionHEAL1 + 1 : notice "Vous avez trouvé une petite potion"
            gosub [upPersoFIGHT]
        end if
        PvE12$ = "off"
    end if

    gosub [colisionENNEMI]

            if AlifeE12 = 1 and noMOOVEe3 = 0 then
                random3 = int(rnd(1)*6+1)
                if distanceREEL3 >0 then random3 = activatorDistance3
                if random3 = 1 then 'up
                    random3HOLD = random3 : activatorDistance3 = 1
                    if distanceREEL3 = 0 then distanceREEL3 = int(rnd(1)*8+1)
                    distanceREEL3 = distanceREEL3 - 1 : if distanceREEL3 = 0 then activatorDistance3 = 0
                    E12y=E12y - 3
                    gosub [limitesENNEMISmap]
                    #3b.map, "SpriteVisible Ea12 off; SpriteVisible Eb12 off; SpriteVisible Ec12 off; SpriteVisible Ed12 on"
                    #3b.map, "spritexy Ed12 ";E12x;" ";E12y
                    #3b.map, "cyclesprite Ed12 1 once"
                end if
                if random3 = 2 then 'down
                    random3HOLD = random3 : activatorDistance3 = 2
                    if distanceREEL3 = 0 then distanceREEL3 = int(rnd(1)*8+1)
                    distanceREEL3 = distanceREEL3 - 1 : if distanceREEL3 = 0 then activatorDistance3 = 0
                    E12y=E12y + 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ea12 off; SpriteVisible Eb12 off; SpriteVisible Ed12 off; SpriteVisible Ec12 on"
                    #3b.map,"spritexy Ec12 ";E12x;" ";E12y
                    #3b.map, "cyclesprite Ec12 1 once"
                end if
                if random3 = 3 then 'left
                    random3HOLD = random3 : activatorDistance3 = 3
                    if distanceREEL3 = 0 then distanceREEL3 = int(rnd(1)*8+1)
                    distanceREEL3 = distanceREEL3 - 1 : if distanceREEL3 = 0 then activatorDistance3 = 0
                    E12x=E12x - 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ec12 off; SpriteVisible Eb12 off; SpriteVisible Ed12 off; SpriteVisible Ea12 on"
                    #3b.map,"spritexy Ea12 ";E12x;" ";E12y
                    #3b.map, "cyclesprite Ea12 1 once"
                end if
                if random3 = 4 then 'right
                    random3HOLD = random3 : activatorDistance3 = 4
                    if distanceREEL3 = 0 then distanceREEL3 = int(rnd(1)*8+1)
                    distanceREEL3 = distanceREEL3 - 1 : if distanceREEL3 = 0 then activatorDistance3 = 0
                    E12x=E12x + 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ea12 off; SpriteVisible Ec12 off; SpriteVisible Ed12 off; SpriteVisible Eb12 on"
                    #3b.map,"spritexy Eb12 ";E12x;" ";E12y
                    #3b.map, "cyclesprite Eb12 1 once"
                end if
            end if
            if AlifeE12 = 0 then #3b.map, "SpriteVisible Ea12 off; SpriteVisible Eb12 off; SpriteVisible Ec12 off; SpriteVisible Ed12 off"


' ------ AI 4 2.0 ------

        if AlifeE13 = 1 and int(E13x - persoX) < 30 and int(E13x - persoX) > -30 AND int(E13y - persoY) <42 and int(E13y - persoY) > -30 then
        GenerATKhero = GenerATKhero +1 : ATKon = 0 : noMOOVEe4 = 1 : Ex = E13x : Ey = E13y : PvE = PvE13 : PvETOTAL = PvE13TOTAL : LvlMonster = LvlMonster4 : AlifeE = AlifeE13
        if GenerATKhero >= GenerATKheroPOWER then ATKon = 1 : GenerATKhero = 0
        GenerATKe4 = GenerATKe4+1 : ATKE4on = 0 : PvE13$ = "on"
        if GenerATKe4 >= GenerATKe4POWER then ATKE4on = 1 : GenerATKe4 = 0

        if (ATKE1on = 1 or ATKE2on = 1 or ATKE3on = 1 or ATKE4on = 1 or ATKE5on = 1 or ATKE6on = 1 or ATKE7on = 1) then
            if bruitage = 0 then playwave "bmp\perso\dog1\song\songATAK.wav", async
            PV = int(PV - dommageE)
            if E13x < persoX and E13y > persoY-20 and E13y < persoY+15 then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E13x > persoX and E13y > persoY-20 and E13y < persoY+15 then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E13x > persoX -15 and E13x < persoX +15 and E13y < persoY then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E13x > persoX -15 and E13x < persoX +15 and E13y > persoY then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            #3b.map,"SpriteVisible atk2 on"
        end if
        if ATKon = 1 then
            PvE13 = int(PvE13 - dommage) : PvE = PvE13
            if bruitage = 0 and dommage>0 then playwave "bmp\perso\CHARACT\song\coupOK.wav", async
            if bruitage = 0 and dommage=0 then playwave "bmp\perso\CHARACT\song\coupNO.wav", async
            if E13x < persoX and E13y > persoY-20 and E13y < persoY+15 then #3b.map,"spritexy atk1 ";persoX-25;" ";persoY+5
            if E13x > persoX and E13y > persoY-20 and E13y < persoY+15 then #3b.map,"spritexy atk1 ";persoX+15;" ";persoY+5
            if E13x > persoX -15 and E13x < persoX +15 and E13y < persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY -35
            if E13x > persoX -15 and E13x < persoX +15 and E13y > persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY +30
            #3b.map,"SpriteVisible atk1 on"
        end if

        #3b.map,"SpriteVisible hpMONSTER on; SpriteVisible ico on"
        gosub [textATKrefresh]

        if PvE13 <= 0 then
            AlifeE13 = 0 : AlifeE = 0 : MonsterREGEN = 1 : Ex = 0 : Ey = 0 : ATKon = 0 : ATKE4on = 0 : secuWALKING = 0 : gold = gold + int(rnd(1)*int(LvlMonster4*5+1)) + GOLDbonus : xp = xp + int(rnd(1)*int(LvlMonster4*10)+map*5) + XPbonus
            if Q2 = 1 and DQop2 = 0 and winQ2 = 0 then NombreLoupTuer = NombreLoupTuer +1
            PotionRND = int(rnd(1)*10+1)
            if PotionRND = 10 then potionHEAL1 = potionHEAL1 + 1 : notice "Vous avez trouvé une petite potion"
            gosub [upPersoFIGHT]
        end if
        PvE13$ = "off"
    end if

    gosub [colisionENNEMI]

            if AlifeE13 = 1 and noMOOVEe4 = 0 then
                random4 = int(rnd(1)*6+1)
                if distanceREEL4 >0 then random4 = activatorDistance4
                if random4 = 1 then 'up
                    random4HOLD = random4 : activatorDistance4 = 1
                    if distanceREEL4 = 0 then distanceREEL4 = int(rnd(1)*8+1)
                    distanceREEL4 = distanceREEL4 - 1 : if distanceREEL4 = 0 then activatorDistance4 = 0
                    E13y=E13y - 3
                    gosub [limitesENNEMISmap]
                    #3b.map, "SpriteVisible Ea13 off; SpriteVisible Eb13 off; SpriteVisible Ec13 off; SpriteVisible Ed13 on"
                    #3b.map, "spritexy Ed13 ";E13x;" ";E13y
                    #3b.map, "cyclesprite Ed13 1 once"
                end if
                if random4 = 2 then 'down
                    random4HOLD = random4 : activatorDistance4 = 2
                    if distanceREEL4 = 0 then distanceREEL4 = int(rnd(1)*8+1)
                    distanceREEL4 = distanceREEL4 - 1 : if distanceREEL4 = 0 then activatorDistance4 = 0
                    E13y=E13y + 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ea13 off; SpriteVisible Eb13 off; SpriteVisible Ed13 off; SpriteVisible Ec13 on"
                    #3b.map,"spritexy Ec13 ";E13x;" ";E13y
                    #3b.map, "cyclesprite Ec13 1 once"
                end if
                if random4 = 3 then 'left
                    random4HOLD = random4 : activatorDistance4 = 3
                    if distanceREEL4 = 0 then distanceREEL4 = int(rnd(1)*8+1)
                    distanceREEL4 = distanceREEL4 - 1 : if distanceREEL4 = 0 then activatorDistance4 = 0
                    E13x=E13x - 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ec13 off; SpriteVisible Eb13 off; SpriteVisible Ed13 off; SpriteVisible Ea13 on"
                    #3b.map,"spritexy Ea13 ";E13x;" ";E13y
                    #3b.map, "cyclesprite Ea13 1 once"
                end if
                if random4 = 4 then 'right
                    random4HOLD = random4 : activatorDistance4 = 4
                    if distanceREEL4 = 0 then distanceREEL4 = int(rnd(1)*8+1)
                    distanceREEL4 = distanceREEL4 - 1 : if distanceREEL4 = 0 then activatorDistance4 = 0
                    E13x=E13x + 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ea13 off; SpriteVisible Ec13 off; SpriteVisible Ed13 off; SpriteVisible Eb13 on"
                    #3b.map,"spritexy Eb13 ";E13x;" ";E13y
                    #3b.map, "cyclesprite Eb13 1 once"
                end if
            end if
            if AlifeE13 = 0 then #3b.map, "SpriteVisible Ea13 off; SpriteVisible Eb13 off; SpriteVisible Ec13 off; SpriteVisible Ed13 off"


' ------ AI 5 2.0 ------

        if AlifeE14 = 1 and int(E14x - persoX) < 30 and int(E14x - persoX) > -30 AND int(E14y - persoY) <42 and int(E14y - persoY) > -30 then
        GenerATKhero = GenerATKhero +1 : ATKon = 0 : noMOOVEe5 = 1 : Ex = E14x : Ey = E14y : PvE = PvE14 : PvETOTAL = PvE14TOTAL : LvlMonster = LvlMonster5 : AlifeE = AlifeE14
        if GenerATKhero >= GenerATKheroPOWER then ATKon = 1 : GenerATKhero = 0
        GenerATKe5 = GenerATKEe+1 : ATKE5on = 0 : PvE14$ = "on"
        if GenerATKe5 >= GenerATKe5POWER then ATKE5on = 1 : GenerATKe5 = 0

        if (ATKE1on = 1 or ATKE2on = 1 or ATKE3on = 1 or ATKE4on = 1 or ATKE5on = 1 or ATKE6on = 1 or ATKE7on = 1) then
            if bruitage = 0 then playwave "bmp\perso\dog1\song\songATAK.wav", async
            PV = int(PV - dommageE)
            if E14x < persoX and E14y > persoY-20 and E14y < persoY+15 then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E14x > persoX and E14y > persoY-20 and E14y < persoY+15 then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E14x > persoX -15 and E14x < persoX +15 and E14y < persoY then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E14x > persoX -15 and E14x < persoX +15 and E14y > persoY then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            #3b.map,"SpriteVisible atk2 on"
        end if
        if ATKon = 1 then
            PvE14 = int(PvE14 - dommage) : PvE = PvE14
            if bruitage = 0 and dommage>0 then playwave "bmp\perso\CHARACT\song\coupOK.wav", async
            if bruitage = 0 and dommage=0 then playwave "bmp\perso\CHARACT\song\coupNO.wav", async
            if E14x < persoX and E14y > persoY-20 and E14y < persoY+15 then #3b.map,"spritexy atk1 ";persoX-25;" ";persoY+5
            if E14x > persoX and E14y > persoY-20 and E14y < persoY+15 then #3b.map,"spritexy atk1 ";persoX+15;" ";persoY+5
            if E14x > persoX -15 and E14x < persoX +15 and E14y < persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY -35
            if E14x > persoX -15 and E14x < persoX +15 and E14y > persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY +30
            #3b.map,"SpriteVisible atk1 on"
        end if

        #3b.map,"SpriteVisible hpMONSTER on; SpriteVisible ico on"
        gosub [textATKrefresh]

        if PvE14 <= 0 then
            AlifeE14 = 0 : AlifeE = 0 : MonsterREGEN = 1 : Ex = 0 : Ey = 0 : ATKon = 0 : ATKE5on = 0 : secuWALKING = 0 : gold = gold + int(rnd(1)*int(LvlMonster5*5+1)) + GOLDbonus : xp = xp + int(rnd(1)*int(LvlMonster5*10)+map*5) + XPbonus
            if Q2 = 1 and DQop2 = 0 and winQ2 = 0 then NombreLoupTuer = NombreLoupTuer +1
            PotionRND = int(rnd(1)*10+1)
            if PotionRND = 10 then potionHEAL1 = potionHEAL1 + 1 : notice "Vous avez trouvé une petite potion"
            gosub [upPersoFIGHT]
        end if
        PvE14$ = "off"
    end if

    gosub [colisionENNEMI]

            if AlifeE14 = 1 and noMOOVEe5 = 0 then
                random5 = int(rnd(1)*6+1)
                if distanceREEL5 >0 then random5 = activatorDistance5
                if random5 = 1 then 'up
                    random5HOLD = random5 : activatorDistance5 = 1
                    if distanceREEL5 = 0 then distanceREEL5 = int(rnd(1)*8+1)
                    distanceREEL5 = distanceREEL5 - 1 : if distanceREEL5 = 0 then activatorDistance5 = 0
                    E14y=E14y - 3
                    gosub [limitesENNEMISmap]
                    #3b.map, "SpriteVisible Ea14 off; SpriteVisible Eb14 off; SpriteVisible Ec14 off; SpriteVisible Ed14 on"
                    #3b.map, "spritexy Ed14 ";E14x;" ";E14y
                    #3b.map, "cyclesprite Ed14 1 once"
                end if
                if random5 = 2 then 'down
                    random5HOLD = random5 : activatorDistance5 = 2
                    if distanceREEL5 = 0 then distanceREEL5 = int(rnd(1)*8+1)
                    distanceREEL5 = distanceREEL5 - 1 : if distanceREEL5 = 0 then activatorDistance5 = 0
                    E14y=E14y + 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ea14 off; SpriteVisible Eb14 off; SpriteVisible Ed14 off; SpriteVisible Ec14 on"
                    #3b.map,"spritexy Ec14 ";E14x;" ";E14y
                    #3b.map, "cyclesprite Ec14 1 once"
                end if
                if random5 = 3 then 'left
                    random5HOLD = random5 : activatorDistance5 = 3
                    if distanceREEL5 = 0 then distanceREEL5 = int(rnd(1)*8+1)
                    distanceREEL5 = distanceREEL5 - 1 : if distanceREEL5 = 0 then activatorDistance5 = 0
                    E14x=E14x - 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ec14 off; SpriteVisible Eb14 off; SpriteVisible Ed14 off; SpriteVisible Ea14 on"
                    #3b.map,"spritexy Ea14 ";E14x;" ";E14y
                    #3b.map, "cyclesprite Ea14 1 once"
                end if
                if random5 = 4 then 'right
                    random5HOLD = random5 : activatorDistance5 = 4
                    if distanceREEL5 = 0 then distanceREEL5 = int(rnd(1)*8+1)
                    distanceREEL5 = distanceREEL5 - 1 : if distanceREEL5 = 0 then activatorDistance5 = 0
                    E14x=E14x + 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ea14 off; SpriteVisible Ec14 off; SpriteVisible Ed14 off; SpriteVisible Eb14 on"
                    #3b.map,"spritexy Eb14 ";E14x;" ";E14y
                    #3b.map, "cyclesprite Eb14 1 once"
                end if
            end if
            if AlifeE14 = 0 then #3b.map, "SpriteVisible Ea14 off; SpriteVisible Eb14 off; SpriteVisible Ec14 off; SpriteVisible Ed14 off"


' ------ AI 6 2.0 ------

    if AlifeE15 = 1 and int(E15x - persoX) < 30 and int(E15x - persoX) > -30 AND int(E15y - persoY) <42 and int(E15y - persoY) > -30 then
        GenerATKhero = GenerATKhero +1 : ATKon = 0 : noMOOVEe6 = 1 : Ex = E15x : Ey = E15y : PvE = PvE15 : PvETOTAL = PvE15TOTAL : LvlMonster = LvlMonster6 : AlifeE = AlifeE15
        if GenerATKhero >= GenerATKheroPOWER then ATKon = 1 : GenerATKhero = 0
        GenerATKe6 = GenerATKe6+1 : ATKE6on = 0 : PvE15$ = "on"
        if GenerATKe6 >= GenerATKe6POWER then ATKE6on = 1 : GenerATKe6 = 0

        if (ATKE1on = 1 or ATKE2on = 1 or ATKE3on = 1 or ATKE4on = 1 or ATKE5on = 1 or ATKE6on = 1 or ATKE7on = 1) then
            if bruitage = 0 then playwave "bmp\perso\dog1\song\songATAK.wav", async
            PV = int(PV - dommageE)
            if E15x < persoX and E15y > persoY-20 and E15y < persoY+15 then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E15x > persoX and E15y > persoY-20 and E15y < persoY+15 then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E15x > persoX -15 and E15x < persoX +15 and E15y < persoY then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            if E15x > persoX -15 and E15x < persoX +15 and E15y > persoY then #3b.map,"spritexy atk2 ";persoX;" ";persoY
            #3b.map,"SpriteVisible atk2 on"
        end if
        if ATKon = 1 then
            PvE15 = int(PvE15 - dommage) : PvE = PvE15
            if bruitage = 0 and dommage>0 then playwave "bmp\perso\CHARACT\song\coupOK.wav", async
            if bruitage = 0 and dommage=0 then playwave "bmp\perso\CHARACT\song\coupNO.wav", async
            if E15x < persoX and E15y > persoY-20 and E15y < persoY+15 then #3b.map,"spritexy atk1 ";persoX-25;" ";persoY+5
            if E15x > persoX and E15y > persoY-20 and E15y < persoY+15 then #3b.map,"spritexy atk1 ";persoX+15;" ";persoY+5
            if E15x > persoX -15 and E15x < persoX +15 and E15y < persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY -35
            if E15x > persoX -15 and E15x < persoX +15 and E15y > persoY then #3b.map,"spritexy atk1 ";persoX;" ";persoY +30
            #3b.map,"SpriteVisible atk1 on"
        end if

        #3b.map,"SpriteVisible hpMONSTER on; SpriteVisible ico on"
        gosub [textATKrefresh]

        if PvE15 <= 0 then
            AlifeE15 = 0 : AlifeE = 0 : MonsterREGEN = 1 : Ex = 0 : Ey = 0 : ATKon = 0 : ATKE6on = 0 : secuWALKING = 0 : gold = gold + int(rnd(1)*int(LvlMonster6*5+1)) + GOLDbonus : xp = xp + int(rnd(1)*int(LvlMonster6*10)+map*5) + XPbonus
            if Q2 = 1 and DQop2 = 0 and winQ2 = 0 then NombreLoupTuer = NombreLoupTuer +1
            PotionRND = int(rnd(1)*10+1)
            if PotionRND = 10 then potionHEAL1 = potionHEAL1 + 1 : notice "Vous avez trouvé une petite potion"
            gosub [upPersoFIGHT]
        end if
        PvE15$ = "off"
    end if

    gosub [colisionENNEMI]

            if AlifeE15 = 1 and noMOOVEe6 = 0 then
                random6 = int(rnd(1)*6+1)
                if distanceREEL6 >0 then random6 = activatorDistance6
                if random6 = 1 then 'up
                    random6HOLD = random6 : activatorDistance6 = 1
                    if distanceREEL6 = 0 then distanceREEL6 = int(rnd(1)*8+1)
                    distanceREEL6 = distanceREEL6 - 1 : if distanceREEL6 = 0 then activatorDistance6 = 0
                    E15y=E15y - 3
                    gosub [limitesENNEMISmap]
                    #3b.map, "SpriteVisible Ea15 off; SpriteVisible Eb15 off; SpriteVisible Ec15 off; SpriteVisible Ed15 on"
                    #3b.map, "spritexy Ed15 ";E15x;" ";E15y
                    #3b.map, "cyclesprite Ed15 1 once"
                end if
                if random6 = 2 then 'down
                    random6HOLD = random6 : activatorDistance6 = 2
                    if distanceREEL6 = 0 then distanceREEL6 = int(rnd(1)*8+1)
                    distanceREEL6 = distanceREEL6 - 1 : if distanceREEL6 = 0 then activatorDistance6 = 0
                    E15y=E15y + 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ea15 off; SpriteVisible Eb15 off; SpriteVisible Ed15 off; SpriteVisible Ec15 on"
                    #3b.map,"spritexy Ec15 ";E15x;" ";E15y
                    #3b.map, "cyclesprite Ec15 1 once"
                end if
                if random6 = 3 then 'left
                    random6HOLD = random6 : activatorDistance6 = 3
                    if distanceREEL6 = 0 then distanceREEL6 = int(rnd(1)*8+1)
                    distanceREEL6 = distanceREEL6 - 1 : if distanceREEL6 = 0 then activatorDistance6 = 0
                    E15x=E15x - 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ec15 off; SpriteVisible Eb15 off; SpriteVisible Ed15 off; SpriteVisible Ea15 on"
                    #3b.map,"spritexy Ea15 ";E15x;" ";E15y
                    #3b.map, "cyclesprite Ea15 1 once"
                end if
                if random6 = 4 then 'right
                    random6HOLD = random6 : activatorDistance6 = 4
                    if distanceREEL6 = 0 then distanceREEL6 = int(rnd(1)*8+1)
                    distanceREEL6 = distanceREEL6 - 1 : if distanceREEL6 = 0 then activatorDistance6 = 0
                    E15x=E15x + 3
                    gosub [limitesENNEMISmap]
                    #3b.map,"SpriteVisible Ea15 off; SpriteVisible Ec15 off; SpriteVisible Ed15 off; SpriteVisible Eb15 on"
                    #3b.map,"spritexy Eb15 ";E15x;" ";E15y
                    #3b.map, "cyclesprite Eb15 1 once"
                end if
            end if
            if AlifeE15 = 0 then #3b.map, "SpriteVisible Ea15 off; SpriteVisible Eb15 off; SpriteVisible Ec15 off; SpriteVisible Ed15 off"

'-------------------------------

    #3b.map,"drawsprites"
    AlifeE = 0
    gosub [textATKrefresh]


    [endQ1fight2]
    noMOOVEe1 = 0 : noMOOVEe2 = 0 : noMOOVEe3 = 0 : noMOOVEe4 = 0 : noMOOVEe5 = 0 : noMOOVEe6 = 0 : noMOOVEe7 = 0 : noMOOVEe8 = 0 : noMOOVEe9 = 0 : noMOOVEe10 = 0
    if NombreLoupTuer >= 3 and Q2<3 THEN NombreLoupTuer = 3 : Q2 = 1 : winQ2 = 0
    if PV <= 0 then goto [die]
    print #3b.map, "font Times New Roman 7; color white"
    print #3b.map, "backcolor black ; place 486 516 ;\";"Pv : ";PV
    print #3b.map, "backcolor black ; place 486 530 ;\";"Pm : ";PM
    print #3b.map, "backcolor black ; place 488 547 ;\";"Niv : ";lvlHero  ';" / ";perso1dx
    print #3b.map, "font Times New Roman 6; color white"
    print #3b.map, "backcolor black ; place 488 560 ;\"; xp;" / ";XpLvL
    print #3b.map, "backcolor black ; place 310 547 ;\"; potionHEAL1
    print #3b.map, "backcolor black ; place 350 547 ;\"; potionHEAL2
    print #3b.map, "backcolor black ; place 388 547 ;\"; potionPM1
    print #3b.map, "backcolor black ; place 427 547 ;\"; potionPM2
    print #3b.map, "font Times New Roman 7; color white"
    direction=0

    if FPSmonitor = 1 then
        print #3b.map, "font Times New Roman 7; color white;backcolor black"
        oldTime = time : time = time$("ms") : frameTime = (time - oldTime) / 1000 : fp$ = str$(int(1/frameTime))
        #3b.map, "place 955 475;\";"FPS : ";fp$;"    "
    end if

    if music = 0 and game$ = "on" then compteurMUSIC1 = compteurMUSIC1 + 1
    if compteurMUSIC1 >= 230 then gosub [stopMusic2] : gosub [startMusic] : compteurMUSIC1 = 0

            if activPOS1 = 1 then
                if mX > perso1dx then timer int(100-passive5), [marcheDROITE2] : wait
                if perso1dy > mY then timer int(100-passive5), [marcheHAUT2] : wait
                if perso1dy < mY then timer int(100-passive5), [marcheBAS2] : wait
                activPOS1 = 0
            end if
            if activPOS2 = 1 then
                if mX < perso1qx then timer int(100-passive5), [marcheGAUCHE2] : wait
                if perso1qy > mY then timer int(100-passive5), [marcheHAUT2] : wait
                if perso1qy < mY then timer int(100-passive5), [marcheBAS2] : wait
                activPOS2 = 0
            end if
            if activPOS3 = 1 then
                if mY < perso1zy then timer int(100-passive5), [marcheHAUT2] : wait
                if perso1zx > mX then timer int(100-passive5), [marcheDROITE2] : wait
                if perso1zx < mX then timer int(100-passive5), [marcheGAUCHE2] : wait
                activPOS3 = 0
            end if
            if activPOS4 = 1 then
                if mY > perso1sy then timer int(100-passive5), [marcheBAS2] : wait
                if perso1sx > mX then timer int(100-passive5), [marcheDROITE2] : wait
                if perso1sx < mX then timer int(100-passive5), [marcheGAUCHE2] : wait
                activPOS4 = 0
            end if

    timer int(100-passive5), [deplacementBOUCLE]
    wait

        [limitesENNEMISmap]
        if E1x >990 then E1x = 990
        if E1x <20 then E1x = 20
        if E1y >390 then E1y = 390
        if E1y <20 then E1y = 20
        return

        [upPersoFIGHT]
        if xp >= XpLvL and sex = 1 and campagne = 1 then gosub [lvlUPwarrior1]
        if xp >= XpLvL and sex = 2 and campagne = 1 then gosub [lvlUPwarrior2]
        if xp >= XpLvL and campagne = 4 then gosub [lvlUPnecrom]
        if xp >= XpLvL and sex = 1 and campagne = 2 then gosub [lvlUParcher1]
        if xp >= XpLvL and sex = 2 and campagne = 2 then gosub [lvlUParcher2]
        if xp >= XpLvL and sex = 1 and campagne = 3 then gosub [lvlUPmage1]
        if xp >= XpLvL and sex = 2 and campagne = 3 then gosub [lvlUPmage2]
        if xp >= XpLvL and sex = 2 and campagne = 5 then gosub [lvlUPmarchand2]
        return

        [colisionENNEMI]
        'colision en X du personnage contre les monstres
        if AlifeE = 1 AND perso1dy>=int(Ey-18) AND perso1dy<=int(Ey+18) then
            if perso1dx>int(Ex-18) and perso1dx<int(Ex-6) then perso1dx=int(Ex-24)
            if perso1qx<int(Ex+18) and perso1qx>int(Ex+6) then perso1qx=int(Ex+24)
        end if
        'colision en Y du personnage contre les monstres
        if AlifeE = 1 AND perso1zx>=int(Ex-18) AND perso1zx<=int(Ex+18) then
            if perso1zy<int(Ey+18) and perso1zy>int(Ey+6) then perso1zy=int(Ey+24)
            if perso1sy>int(Ey-30) and perso1sy<int(Ey-6) then perso1sy=int(Ey-36)
        end if
        return

        [textATKrefresh]

        ' supprime le backcolor pour texte transparent
    hGBox = hwnd(#3b.map)
    CallDLL #user32, "GetDC",_
        hGBox As ulong,_  'handle of graphicbox
        gDC As ulong      'device context
   ' CallDLL #gdi32, "SetBkMode",_
   '     gDC As ulong,_          'handle of graphicbox
   '     _TRANSPARENT As long,_  'flag for transparent background
   '     result As long          'previous bkmode
    CallDLL #gdi32, "SetBkMode",_
       gDC As ulong,_     'handle of graphicbox
       _TRANSPARENT As long,_ '_OPAQUE As long,_  'flag for opaque background
       result As long     'previous bkmode

    CallDLL#user32,"ReleaseDC",_
        hGBox As ulong,_    'graphicbox handle
        gDC As ulong,_      'device context
        result As long

        if noMOOVEe1 = 0 and noMOOVEe2 = 0 and noMOOVEe3 = 0 and noMOOVEe4 = 0 and noMOOVEe5 = 0 and noMOOVEe6 = 0 and noMOOVEe7 = 0 and noMOOVEe8 = 0 and noMOOVEe9 = 0 and noMOOVEe10 = 0 then return
        #3b.map,"SpriteVisible hpMONSTER on; SpriteVisible ico on"
        if ATKE1on = 1 or ATKE2on = 1 or ATKE3on = 1 or ATKE4on = 1 or ATKE5on = 1 or ATKE6on = 1 or ATKE7on = 1 or ATKE8on = 1 then print #3b.map, "backcolor blue ; place ";perso1dx;" ";perso1dy-5;" ;\";" - " ;dommageE; " "
        if ATKon = 1 then print #3b.map, "backcolor red ; place ";Ex;" ";int(Ey+30);" ;\";" - " ;dommage; " "
        if version = 1 then
            print #3b.map, "backcolor ";68;" ";33;" ";27;";" ;" place 165 40;\";"PV : ";PvE;" / ";PvETOTAL
            print #3b.map, "backcolor ";68;" ";33;" ";27;";" ;" place 80 40;\";"Niveau : ";LvlMonster1
        end if
        if version = 2 then
            print #3b.map, "backcolor ";68;" ";33;" ";27;";" ;" place 165 40;\";"HP : ";PvE;" / ";PvETOTAL
            print #3b.map, "backcolor ";68;" ";33;" ";27;";" ;" place 80 40;\";"Niveau : ";LvlMonster
        end if
        print #3b.map, "font Times New Roman 7; color white;backcolor black"
        return

[lvlUPwarrior1]
timer 0
lvlHero = lvlHero +1
strenght = strenght + 6
agility = agility + 1
intelligence = intelligence + 1
XpLvL = XpLvL + int( XpLvL/2 + 20 )
PVTotal = PVTotal + int(strenght/4)
PV = PVTotal
atk = int(atk+atkLvL+strenght/2)
def = int(def+defLvL+agility*0.1)
PVregenTOTAL = int(strenght/5)
PMregenTOTAL = int(intelligence/5)
PA = PA + 1
if xp >= XpLvL then goto [lvlUPwarrior1]
return
[lvlUPwarrior2]
timer 0
lvlHero = lvlHero +1
strenght = strenght + 5
agility = agility + 1
intelligence = intelligence + 2
XpLvL = XpLvL + int( XpLvL/2 + 20 )
PVTotal = PVTotal + int(strenght/4)
PV = PVTotal
atk = int(atk+atkLvL+strenght/2)
def = int(def+defLvL+agility*0.1)
PVregenTOTAL = int(strenght/5)
PMregenTOTAL = int(intelligence/5)
PA = PA + 1
if xp >= XpLvL then goto [lvlUPwarrior2]
return
[lvlUParcher1]
timer 0
lvlHero = lvlHero +1
strenght = strenght + 3
agility = agility + 6
intelligence = intelligence + 2
XpLvL = XpLvL + int( XpLvL/2 + 10 )
PVTotal = PVTotal + int(strenght/4)
PV = PVTotal
atk = int(atk+atkLvL+agility/2)
def = int(def+defLvL+agility*0.1)
PVregenTOTAL = int(strenght/3)
PMregenTOTAL = int(intelligence/5)
PA = PA + 1
if xp >= XpLvL then goto [lvlUParcher1]
return
[lvlUParcher2]
timer 0
lvlHero = lvlHero +1
strenght = strenght + 1
agility = agility + 7
intelligence = intelligence + 3
XpLvL = XpLvL + int( XpLvL/2 + 10 )
PVTotal = PVTotal + int(strenght/4)
PV = PVTotal
atk = int(atk+atkLvL+agility/2)
def = int(def+defLvL+agility*0.1)
PVregenTOTAL = int(strenght/3)
PMregenTOTAL = int(intelligence/5)
PA = PA + 1
if xp >= XpLvL then goto [lvlUParcher2]
return
[lvlUPnecrom]
timer 0
lvlHero = lvlHero +1
strenght = strenght + 1
agility = agility + 1
intelligence = intelligence + 6
XpLvL = XpLvL + int( XpLvL/2 + 30 )
PVTotal = PVTotal + int(strenght/4)
PV = PVTotal
atk = int(atk+atkLvL+strenght/2)
def = int(def+defLvL+agility*0.1)
PVregenTOTAL = int(strenght/3)
PMregenTOTAL = int(intelligence/5)
PA = PA + 1
if xp >= XpLvL then goto [lvlUPnecrom]
return
[lvlUPmage1]
timer 0
lvlHero = lvlHero +1
strenght = strenght + 2
agility = agility + 1
intelligence = intelligence + 5
XpLvL = XpLvL + int( XpLvL/2 + 30 )
PVTotal = PVTotal + int(strenght/4)
PV = PVTotal
atk = int(atk+atkLvL+strenght/2)
def = int(def+defLvL+agility*0.1)
PVregenTOTAL = int(strenght/3)
PMregenTOTAL = int(intelligence/5)
PA = PA + 1
if xp >= XpLvL then goto [lvlUPmage1]
return
[lvlUPmage2]
timer 0
lvlHero = lvlHero +1
strenght = strenght + 1
agility = agility + 2
intelligence = intelligence + 5
XpLvL = XpLvL + int( XpLvL/2 + 30 )
PVTotal = PVTotal + int(strenght/4)
PV = PVTotal
atk = int(atk+atkLvL+strenght/2)
def = int(def+defLvL+agility*0.1)
PVregenTOTAL = int(strenght/3)
PMregenTOTAL = int(intelligence/5)
PA = PA + 1
if xp >= XpLvL then goto [lvlUPmage2]
return
[lvlUPmarchand1]
timer 0
lvlHero = lvlHero +1
strenght = strenght + 3
agility = agility + 1
intelligence = intelligence + 3
XpLvL = XpLvL + int( XpLvL/2 + 0 )
PVTotal = PVTotal + int(strenght/4)
PV = PVTotal
atk = int(atk+atkLvL+strenght/2)
def = int(def+defLvL+agility*0.1)
PVregenTOTAL = int(strenght/3)
PMregenTOTAL = int(intelligence/5)
PA = PA + 1
if xp >= XpLvL then goto [lvlUPmarchand1]
return
[lvlUPmarchand2]
timer 0
lvlHero = lvlHero +1
strenght = strenght + 2
agility = agility + 1
intelligence = intelligence + 4
XpLvL = XpLvL + int( XpLvL/2 + 0 )
PVTotal = PVTotal + int(strenght/4)
PV = PVTotal
atk = int(atk+atkLvL+strenght/2)
def = int(def+defLvL+agility*0.1)
PVregenTOTAL = int(strenght/3)
PMregenTOTAL = int(intelligence/5)
PA = PA + 1
if xp >= XpLvL then goto [lvlUPmarchand2]
return

[die]
timer 0
#3b.map,"when characterInput [w]"
if version = 1 then notice "Défaite"
if version = 2 then notice "Defeat"
reloadBUG = 1 : MenuMode = 2 : game$ = "off"
if saveMODE = 1 then
    kill "save.ini"
    if version = 1 then notice "Votre personnage vient d'être tué, les données relatives à sa création ont été éffacés. Bonne chance pour la prochaine fois !"
    if version = 2 then notice "You are died ! Your backup was deleted. You have to restart the game. GL&HF ;) !!"
end if
close #3b : timer 500,  [start2] : wait


'----sauvegarde-----------------------------------------------------------------------------------------------------------------------|
[save]
if map <= 22 then act = 1
[savedataTEMP]
dataloadNAME2$ = dataloadNAME$ + "-INFO"

    if sex = 1 then sexe$ = "Homme"
    if sex = 2 then sexe$ = "Femme"
    if campagne = 1 then nameCampagne$ = "Guerrier"
    if campagne = 2 then nameCampagne$ = "Archer"
    if campagne = 3 then nameCampagne$ = "Mage"
    if campagne = 4 then nameCampagne$ = "Necrom"
    if campagne = 5 then nameCampagne$ = "Marchand"

open dataloadNAME2$ for output as #save
print #save, nameCampagne$
print #save, lvlHero
print #save, act
print #save, map
print #save, PV
print #save, PVTotal
print #save, gold
print #save, sexe$
close #save

open dataloadNAME$ for output as #save
print #save, introGAME
print #save, game$
print #save, version
print #save, sex
print #save, astuces
print #save, map1
print #save, map2
print #save, map3
print #save, map4
print #save, map5
print #save, map6
print #save, map7
print #save, map8
print #save, map9
print #save, map10
print #save, map11
print #save, map12
print #save, map13
print #save, map14
print #save, map15
print #save, map16
print #save, map17
print #save, map18
print #save, map19
print #save, map20
print #save, map21
print #save, map22
print #save, openW
print #save, music
print #save, menugame
print #save, inventaire
print #save, sortbook
print #save, secteur
print #save, campagne
print #save, map
print #save, lvlHero
print #save, PV
print #save, PVTotal
print #save, PVregenVIT
print #save, PVregenTOTAL
print #save, PM
print #save, PMTotal
print #save, atk
print #save, def
print #save, GenerATKheroPOWER
print #save, GenerATKvoleurPOWER
print #save, PVLvL
print #save, PMLvL
print #save, atkLvL
print #save, defLvL
print #save, speed
print #save, gold
print #save, xp
print #save, XpLvL
print #save, perso1sx
print #save, perso1sy
print #save, perso1dx
print #save, perso1dy
print #save, perso1zx
print #save, perso1zy
print #save, perso1qx
print #save, perso1qy
print #save, PA
print #save, Qvoleur
print #save, AlifeVoleur1
print #save, winQ1
print #save, winQ2
print #save, Q2
print #save, winQ1secur
print #save, DQop1PART2
print #save, gameD
print #save, NameHeaume$
print #save, NameArmure$
print #save, LvlArmure
print #save, NameBras1$
print #save, LvlBras1
print #save, NameBras2$
print #save, NameGants$
print #save, NamePantalon$
print #save, LvlPantalon
print #save, NameBottes$
print #save, LvlBoots
print #save, NameAnneau1$
print #save, NameAnneau2$
print #save, NameAmu1$
print #save, nombre
print #save, AlifeE1
print #save, AlifeE11
print #save, AlifeE12
print #save, AlifeE13
print #save, AlifeE14
print #save, AlifeE15
print #save, AlifeE16
print #save, AlifeE17
print #save, AlifeE18
print #save, AlifeE19
print #save, quest1$
print #save, marchandQ2
print #save, potionHEAL1
print #save, potionHEAL2
print #save, equipITEMa1
print #save, equipITEMe1
print #save, equipITEMp1
print #save, equipITEMb1
print #save, nombreITEMchemise1
print #save, nombreITEMepee1
print #save, nombreITEMpant1
print #save, nombreITEMboots1
print #save, act
print #save, passive1
print #save, passive2
print #save, passive3
print #save, passive4
print #save, passive5
print #save, passive6
print #save, passive7
print #save, passive8
print #save, passive9
print #save, passive10
print #save, passive11
print #save, passive12
print #save, passive13
print #save, active1
print #save, active2
print #save, active3
print #save, active4
print #save, active5
print #save, active6
print #save, active7
print #save, active8
print #save, active9
print #save, active10
print #save, active11
print #save, active12
print #save, active13
print #save, active14
print #save, active15
print #save, active16
print #save, active17
print #save, active18
print #save, active19
print #save, active20
print #save, XPbonus
print #save, GOLDbonus
print #save, PMregenTOTAL
CLOSE #save

if dataloadNAME$ = "TEMP.sys" then return
if version = 1 then Notice " " + Chr$(13)+ "Partie sauvegardé !"
if version = 2 then Notice " " + Chr$(13)+ "Game saved !"

select case map
    case 1
        #3b.map,"when characterInput [control_touchea]"
    case 2
        #3b.map,"when characterInput [control_toucheb]"
    case 3
        #3b.map,"when characterInput [control_touchec]"
    case 4
        #3b.map,"when characterInput [control_touched]"
    case 5
        #3b.map,"when characterInput [control_touchee]"
    case 6
        #3b.map,"when characterInput [control_touchef]"
    case 7
        #3b.map,"when characterInput [control_toucheg]"
    case 8
        #3b.map,"when characterInput [control_toucheh]"
    case 9
        #3b.map,"when characterInput [control_touchei]"
    case 10
        #3b.map,"when characterInput [control_touchej]"
    case 11
        #3b.map,"when characterInput [control_touchek]"
    case 12
        #3b.map,"when characterInput [control_touchel]"
    case 13
        #3b.map,"when characterInput [control_touchem]"
    case 14
        #3b.map,"when characterInput [control_touchen]"
    case 15
        #3b.map,"when characterInput [control_toucheo]"
    case 16
        #3b.map,"when characterInput [control_touchep]"
    case 17
        #3b.map,"when characterInput [control_toucheq]"
    case 18
        #3b.map,"when characterInput [control_toucher]"
    case 19
        #3b.map,"when characterInput [control_touches]"
    case 20
        #3b.map,"when characterInput [control_touchet]"
    case 21
        #3b.map,"when characterInput [control_toucheu]"
    case 22
        #3b.map,"when characterInput [control_touchev]"
end select

close #saveMain : saveMain=0 : goto [deplacementBOUCLE]

'----chargement----------------------------------------------------------------------------------------------------------------|
[load]
if bruitage = 0 then playwave "music\hit.wav", async
load = 1 : loadSECUR = 1 : win = 2
if game$ = "off" then close #2b
if game$ = "on" then close #3b
goto [dataload]
[dataloadSECURITY]
if mapSECUR = 0 then gameINITIAL$ = "off"
if mapSECUR > 0 then gameINITIAL$ = "on"
datamenusav = 1
[dataload]
open dataloadNAME$ for input as #save
input #save, introGAME
input #save, game$
input #save, version
input #save, sex
input #save, astuces
input #save, map1
input #save, map2
input #save, map3
input #save, map4
input #save, map5
input #save, map6
input #save, map7
input #save, map8
input #save, map9
input #save, map10
input #save, map11
input #save, map12
input #save, map13
input #save, map14
input #save, map15
input #save, map16
input #save, map17
input #save, map18
input #save, map19
input #save, map20
input #save, map21
input #save, map22
input #save, openW
input #save, music
input #save, menugame
input #save, inventaire
input #save, sortbook
input #save, secteur
input #save, campagne
input #save, map
input #save, lvlHero
input #save, PV
input #save, PVTotal
input #save, PVregenVIT
input #save, PVregenTOTAL
input #save, PM
input #save, PMTotal
input #save, atk
input #save, def
input #save, GenerATKheroPOWER
input #save, GenerATKvoleurPOWER
input #save, PVLvL
input #save, PMLvL
input #save, atkLvl
input #save, defLvl
input #save, speed
input #save, gold
input #save, xp
input #save, XpLvL
input #save, perso1sx
input #save, perso1sy
input #save, perso1dx
input #save, perso1dy
input #save, perso1zx
input #save, perso1zy
input #save, perso1qx
input #save, perso1qy
input #save, PA
input #save, Qvoleur
input #save, AlifeVoleur1
input #save, winQ1
input #save, winQ2
input #save, Q2
input #save, winQ1secur
input #save, DQop1PART2
input #save, gameD
input #save, NameHeaume$
input #save, NameArmure$
input #save, LvlArmure
input #save, NameBras1$
input #save, LvlBras1
input #save, NameBras2$
input #save, NameGants$
input #save, NamePantalon$
input #save, LvlPantalon
input #save, NameBottes$
input #save, LvlBoots
input #save, NameAnneau1$
input #save, NameAnneau2$
input #save, NameAmu1$
input #save, nombre
input #save, AlifeE1
input #save, AlifeE11
input #save, AlifeE12
input #save, AlifeE13
input #save, AlifeE14
input #save, AlifeE15
input #save, AlifeE16
input #save, AlifeE17
input #save, AlifeE18
input #save, AlifeE19
input #save, quest1$
input #save, marchandQ2
input #save, potionHEAL1
input #save, potionHEAL2
input #save, equipITEMa1
input #save, equipITEMe1
input #save, equipITEMp1
input #save, equipITEMb1
input #save, nombreITEMchemise1
input #save, nombreITEMepee1
input #save, nombreITEMpant1
input #save, nombreITEMboots1
input #save, act
input #save, passive1
input #save, passive2
input #save, passive3
input #save, passive4
input #save, passive5
input #save, passive6
input #save, passive7
input #save, passive8
input #save, passive9
input #save, passive10
input #save, passive11
input #save, passive12
input #save, passive13
input #save, active1
input #save, active2
input #save, active3
input #save, active4
input #save, active5
input #save, active6
input #save, active7
input #save, active8
input #save, active9
input #save, active10
input #save, active11
input #save, active12
input #save, active13
input #save, active14
input #save, active15
input #save, active16
input #save, active17
input #save, active18
input #save, active19
input #save, active20
input #save, XPbonus
input #save, GOLDbonus
input #save, PMregenTOTAL
CLOSE #save

if datamenusav = 1 then
    datamenusav = 0
    if dataloadNAME$ = "TEMP.sys" then return
    if gameINITIAL$ = "off" then game$ = "off"
    if gameINITIAL$ = "on" then game$ = "on"
    if map < 22 then act = 1
    if sex = 1 then sexe$ = "Homme"
    if sex = 2 then sexe$ = "Femme"
    if campagne = 1 then nameCampagne$ = "Guerrier"
    if campagne = 2 then nameCampagne$ = "Archer"
    if campagne = 3 then nameCampagne$ = "Mage"
    if campagne = 4 then nameCampagne$ = "Necrom"
    if campagne = 5 then nameCampagne$ = "Marchand"
    return
end if

datamenusav = 0
[ENDLOADSECURITY]
if rageMODE$ = "on" then
    factor = 10
    else
    factor = 1
end if
if menugame > 1 then menugame = 1
if inventaire > 1 then inventaire = 1
if sortbook > 1 then sortbook = 1
[reload]

if game$ = "on" and load = 1 then goto [reload2]
gosub [closeSecur]

[reload2]
if INFOITEM = 1 then close #test : INFOITEM = 0
reload = 1 : load = 1 : astuces = 2 : openW = 0

[reload3]
if map <= 0 then map = 1
if PV <= 0 then PV = 1
MenuMode = 1

SELECT CASE map
    CASE 1
        goto [jeuhumain1]
    CASE 2
        goto [jeuhumain2]
    CASE 3
        goto [jeuhumain3]
    CASE 4
        goto [jeuhumain4]
    CASE 5
        goto [jeuhumain5]
    CASE 6
        goto [jeuhumain6]
    CASE 7
        goto [jeuhumain7]
    CASE 8
        goto [jeuhumain8]
    CASE 9
        goto [jeuhumain9]
    CASE 10
        goto [jeuhumain10]
    CASE 11
        goto [jeuhumain11]
    CASE 12
        goto [jeuhumain12]
    CASE 13
        goto [jeuhumain13]
    CASE 14
        goto [jeuhumain14]
    CASE 15
        goto [jeuhumain15]
    CASE 16
        goto [jeuhumain16]
    CASE 17
        goto [jeuhumain17]
    CASE 18
        goto [jeuhumain18]
    CASE 19
        goto [jeuhumain19]
    CASE 20
        goto [jeuhumain20]
    CASE 21
        goto [jeuhumain21]
    CASE 22
        goto [jeuhumain22]
END SELECT
wait


    [itemsDATA]
    select case version
    case 1
        epee1FR$ = "Simple épée":epee1$=epee1FR$
        shield1FR$ = "Simple bouclier de bois":shield1$=shield1FR$
        chausse1FR$ = "Chaussures simple":chausse1$=chausse1FR$
        pant1FR$ = "Bas Simple":pant1$=pant1FR$
        armor1FR$ = "Chemise Simple":armor1$=armor1FR$
        gants1FR$ = "Simple gants de cuir":gants1$=gants1FR$
        amu1FR$ = "Amulette en bois":amu1$=amu1FR$
        ring1FR$ = "Simple anneau de bois":ring1$=ring1FR$
        ring2FR$ = "Simple anneau de bois":ring2$=ring2FR$
        heaume1FR$ = "Capuchon de cuir":heaume1$=heaume1FR$
    case 2
        epee1ENG$ = "Single sword":epee1$=epee1ENG$
        shield1ENG$ = "Single shield of wood":shield1$=shield1ENG$
        chausse1ENG$ = "Single shoes":chausse1$=chausse1ENG$
        pant1ENG$ = "Single bottom":pant1$=pant1ENG$
        armor1ENG$ = "Single shirt":armor1$=armor1ENG$
        gants1ENG$ = "Single leather gloves":gants1$=gants1ENG$
        amu1ENG$ = "Amulet wood":amu1$=amu1ENG$
        ring1ENG$ = "Single wooden ring":ring1$=ring1ENG$
        ring2ENG$ = "Single wooden ring":ring2$=ring2ENG$
        heaume1ENG$ = "Leather cap":heaume1$=heaume1ENG$
    end select

    select case NameBras1$
        case "Simple épée", "Single sword"
            select case version
                case 1
                NameBras1$ = epee1FR$
                case 2
                NameBras1$ = epee1ENG$
            end select
        epee1valATK=6 + 1* LvlBras1
        epee1valDef=0 : epee1valPV=0 : epee1valPM=0 : epee1valReg=0 : epee1valSpeed=0 : epee1valGold=42 + 5*LvlBras1
        case else
        NameBras1$ = "---"
    end select
    select case NameBras2$
        case "Simple bouclier de bois", "Single shield of wood"
            select case version
                case 1
                NameBras2$ = shield1FR$
                case 2
                NameBras2$ = shield1ENG$
            end select
        shield1valATK=0 : shield1valDef=1 : shield1valPV=0 : shield1valPM=0 : shield1valReg=0 : shield1valSpeed=0 : shield1valGold=12
        case else
        NameBras2$ = "---"
    end select
    select case NameHeaume$
        case "Capuchon de cuir", "Leather cap"
            select case version
                case 1
                NameHeaume$ = heaume1FR$
                case 2
                NameHeaume$ = heaume1ENG$
            end select
        heaume1valATK=0 : heaume1valDef=1 : heaume1valPV=1 : heaume1valPM=0 : heaume1valReg=0 : heaume1valSpeed=0 : heaume1valGold=14
        case else
        NameHeaume$ = "---"
    end select
    select case NameArmure$ 
        case "Chemise Simple", "Single shirt"
            select case version
                case 1
                NameArmure$ = armor1FR$
                case 2
                NameArmure$ = armor1ENG$
            end select
        armor1valATK=0 : armor1valDef=0 + 1*LvlArmure-1 : armor1valPV= 6 + 5*LvlArmure-1 : armor1valPM=0 : armor1valReg=0 : armor1valSpeed=0 : armor1valGold=24 + 11*LvlArmure
        case else
        NameArmure$ = "---"
    end select
    select case NamePantalon$
        case "Bas Simple", "Single bottom"
            select case version
                case 1
                NamePantalon$ = pant1FR$
                case 2
                NamePantalon$ = pant1ENG$
            end select
        pant1valATK=0 : pant1valDef=1 + 2*LvlPantalon-1 : pant1valPV=2 + 4*LvlPantalon-1 : pant1valPM=0 : pant1valReg=0 : pant1valSpeed=0 : pant1valGold=31
        case else
        NamePantalon$ = "---"
    end select
    select case NameBottes$
        case "Chaussures simple", "Single shoes"
            select case version
                case 1
                NameBottes$ = chausse1FR$
                case 2
                NameBottes$ = chausse1ENG$
            end select
        chausse1valATK=0 : chausse1valDef=1+ 1*LvlBoots-1 : chausse1valPV=0+ 2*LvlBoots-1 : chausse1valPM=0 : chausse1valReg=0 : chausse1valSpeed=0 : chausse1valGold=11
        case else
        NameBottes$ = "---"
    end select
    select case NameGants$
        case "Simple gants de cuir", "Single leather gloves"
            select case version
                case 1
                NameGants$ = gants1FR$
                case 2
                NameGants$ = gants1ENG$
            end select
        gants1valATK=0 : gants1valDef=1 : gants1valPV=0 : gants1valPM=0 : gants1valReg=0 : gants1valSpeed=0 : gants1valGold=8
        case else
        NameGants$ = "---"
    end select
    select case NameAnneau1$
        case "Simple anneau de bois", "Single wooden ring"
            select case version
                case 1
                NameAnneau1$ = ring1FR$
                case 2
                NameAnneau1$ = ring1ENG$
            end select
        ring1valATK=0 : ring1valDef=1 : ring1valPV=0 : ring1valPM=0 : ring1valReg=0.5 : ring1valSpeed=0 : ring1valGold=28
        case else
        NameAnneau1$ = "---"
    end select
    select case NameAnneau2$
        case "Simple anneau de bois", "Single wooden ring"
            select case version
                case 1
                NameAnneau2$ = ring1FR$
                case 2
                NameAnneau2$ = ring1ENG$
            end select
        ring2valATK=0 : ring2valDef=1 : ring2valPV=0 : ring2valPM=0 : ring2valReg=0.5 : ring2valSpeed=0 : ring2valGold=28
        case else
        NameAnneau2$ = "---"
    end select
    select case NameAmu1$
        case "Amulette en bois", "Amulet wood"
            select case version
                case 1
                NameAmu1$ = amu1FR$
                case 2
                NameAmu1$ = amu1ENG$
            end select
        amu1valATK=0 : amu1valDef=0 : amu1valPV=1 : amu1valPM=4 : amu1valReg=0 : amu1valSpeed=0 : amu1valGold=60
        case else
        NameAmu1$ = "---"
    end select
    return


'-------limites-des-cartes-du-jeu-(collisions)---------------------------------------------------------------------------------------------------------

    [limitesMAP1]
    if perso1dy <102 and perso1dx>258 and perso1dx<270 then perso1dx=258
    if perso1zx >258 and perso1zy<102 then perso1zy=102
    if perso1dy <162 and perso1dx>324 and perso1dx<340 then perso1dx=324
    if perso1zx >324 and perso1zx<500 and perso1zy<162 then perso1zy=162
    if perso1dy <222 and perso1dx>384 and perso1dx<400 then perso1dx=384
    if perso1zx >384 and perso1zx<570 and perso1zy<222 then perso1zy=222
    if perso1qy <222 and perso1qx>550 and perso1qx<570 then perso1qx=570
    if perso1dy <132 and perso1dx=720 then perso1dx=720
    if perso1zx >720 and perso1zy=132 then perso1zy=138
    if perso1qy <320 and perso1qx=144 then perso1qx=150
    if perso1sx <168 and perso1sy=282 then perso1sy=276
    if perso1qy >276 and perso1qx=174 then perso1qx=180
    if perso1sx <240 and perso1sy=330 then perso1sy=324
    if perso1qy >324 and perso1qx=240 then perso1qx=246
    if perso1sx <372 and perso1sy=348 then perso1sy=342
    if perso1qy >342 and perso1qx=372 then perso1qx=378
    if perso1sx <582 and perso1sy=366 then perso1sy=360
    if perso1dy >306 and perso1dx=582 then perso1dx=576
    if perso1sx >576 and perso1sy=306 then perso1sy=300
    if perso1sx >660 and perso1sy=312 then perso1sy=318
    if perso1qy >306 and perso1qx=660 then perso1qx=666
    if perso1sx >660 and perso1sy=330 then perso1sy=324
    if perso1dy >258 and perso1dx=732 then perso1dx=726
    if perso1sx >726 and perso1sx <786 and perso1sy=264 then perso1sy=258
    if perso1qy >258 and perso1qx=792 then perso1qx=798
    if perso1dy >282 and perso1dx=822 then perso1dx=816
    if perso1sx >816 and perso1sy=288 then perso1sy=282
    if perso1dy >102 and perso1dx=840 then perso1dx=834
    if perso1zx >792 and perso1zy=150 then perso1zy=156
    if perso1dy <150 and perso1dx=792 then perso1dx=786
    if perso1zx >100 and perso1zx <300 and perso1zy<20 then [map2bis]
    return

    [limitesMAP2]
   ' notice perso1qx
    if perso1dy >342 and perso1dx=522 then perso1dx=516
    if perso1sx >522 and perso1sx<606 and perso1sy=342 then perso1sy=336
    if perso1qy >342 and perso1qx=600 then perso1qx=606
    if perso1dy >276 and perso1dx=660 then perso1dx=654
    if perso1sx >660 and perso1sx<756 and perso1sy=276 then perso1sy=270
    if perso1qy >276 and perso1qx=756 then perso1qx=762
    if perso1sx >750 and perso1sx <810 and perso1sy=312 then perso1sy=306
    if perso1qy >306 and perso1qx=804 then perso1qx=810
    if perso1sx >780 and perso1sy=360 then perso1sy=354
    if perso1dy >294 and perso1dx=870 then perso1dx=864
    if perso1sx >870 and perso1sy=300 then perso1sy=294
    if perso1zx >600 and perso1zy<=180 then perso1zy=186
    if perso1dy <186 and perso1dx=606 then perso1dx=600
    if perso1zx >414 and perso1zy=114 then perso1zy=120
    if perso1qy <240 and perso1qx=420 then perso1qx=426
    if perso1zx >342 and perso1zx <420 and perso1zy=234 then perso1zy=240
    if perso1qy <330 and perso1qx=348 then perso1qx=354
    if perso1zx >276 and perso1zx <348 and perso1zy=324 then perso1zy=330
    if perso1dy <324 and perso1dx=282 then perso1dx=276
    if perso1zx >228 and perso1zx <300 and perso1zy=210 then perso1zy=216
    if perso1dy <210 and perso1dx=234 then perso1dx=228
    if perso1zx >186 and perso1zx <246 and perso1zy=144 then perso1zy=150
    if perso1qy <240 and perso1qx=186 then perso1qx=192
    if perso1zx <186 and perso1zy=234 then perso1zy=240
    if perso1qy <396 and perso1qx=096 then perso1qx=102
    if perso1sy>390 then perso1sy=390
    if perso1dx>978 then perso1dx=978
    if perso1sx <400 and perso1sy>380 then [map1]
    if perso1dy >100 and perso1dx>975 then [map3bis]
    if perso1zx >720 and perso1zx < 800 and perso1zy < 187 and DQop1=0 and Qvoleur = 0 then [DQop1]
    if perso1zx >720 and perso1zx < 800 and perso1zy < 187 and Qvoleur = 2 and DQop1PART2 = 0 then [DQop1Part2]
    return

    [limitesMAP3]
    if perso1sx<258 and perso1sy>390 then perso1sy=390
    if perso1sx>258 and perso1sy>408 then perso1sy=408
    if perso1qy>390 and perso1qx<255 then perso1qx=258
    if perso1zx<050 and perso1zy=270 then perso1zy=276
    if perso1zx>084 and perso1zx<400 and perso1zy=270 then perso1zy=276
    if perso1qy<270 and perso1qx=048 then perso1qx=054
    if perso1dy<270 and perso1dx=090 then perso1dx=084
    if perso1zx<200 and perso1zy=192 then perso1zy=198
    if perso1qy<270 and perso1qx=390 then perso1qx=396
    if perso1zx<430 and perso1zy=120 then perso1zy=126
    if perso1qy<120 and perso1qx=426 then perso1qx=432
    if perso1zx<550 and perso1zy=060 then perso1zy=066
    if perso1qy<066 and perso1qx=546 then perso1qx=552
    if perso1dy<066 and perso1dx=750 then perso1dx=744
    if perso1zx>744 and perso1zy=066 then perso1zy=072
    if perso1dy<260 and perso1dx=810 then perso1dx=804
    if perso1sx>792 and perso1sy=258 then perso1sy=252
    if perso1dy>252 and perso1dx=792 then perso1dx=786
    if perso1sx>732 and perso1sy=282 then perso1sy=276
    if perso1dy>276 and perso1dx=732 then perso1dx=726
    if perso1sx>612 and perso1sy=342 then perso1sy=336
    if perso1dy>336 and perso1dx=618 then perso1dx=612
    if perso1qy >100 and perso1qx<020 then [map2]
    if perso1zx >500 and perso1zy<020 then [map4bis]
    return

    [limitesMAP4]
    if perso1sx>255 and perso1sy>408 then perso1sy=408
    if perso1qy>360 and perso1qx=330 then perso1qx=336
    if perso1sx<336 and perso1sy=360 then perso1sy=354
    if perso1qy>324 and perso1qx=210 then perso1qx=216
    if perso1sx<216 and perso1sy=324 then perso1sy=318
    if perso1qy>246 and perso1qx=120 then perso1qx=126
    if perso1sx<126 and perso1sy=246 then perso1sy=240
    if perso1dy>270 and perso1dx=768 then perso1dx=762
    if perso1zx>726 and perso1zy=282 then perso1zy=288
    if perso1dy<282 and perso1dx=726 then perso1dx=720
    if perso1zx>684 and perso1zy=240 then perso1zy=246
    if perso1dy<240 and perso1dx=684 then perso1dx=678
    if perso1zx>552 and perso1zy=192 then perso1zy=198
    if perso1dy<192 and perso1dx=552 then perso1dx=546
    if perso1zx<600 and perso1zy=072 then perso1zy=078
    if perso1qy<102 and perso1qx=156 then perso1qx=162
    if perso1zx<162 and perso1zy=102 then perso1zy=108
    if perso1qy<162 and perso1qx=120 then perso1qx=126
    if perso1zx<120 and perso1zy=162 then perso1zy=168
    if perso1qx >300 and perso1qy>400 then [map3]
    if perso1qy <388 and perso1qx<012 then [map5bis]
    return

    [limitesMAP5]
    if perso1sx>732 and perso1sy>390 then perso1sy=390
    if perso1dy>390 and perso1dx=738 then perso1dx=732
    if perso1sx>255 and perso1sy>414 then perso1sy=414
    if perso1qy>360 and perso1qx=480 then perso1qx=486
    if perso1sx<486 and perso1sy>360 then perso1sy=360
    if perso1qy>300 and perso1qx=270 then perso1qx=276
    if perso1sx<276 and perso1sx>198 and perso1sy>300 then perso1sy=300
    if perso1dy>300 and perso1dx=198 then perso1dx=192
    if perso1sx<200 and perso1sy>318 then perso1sy=318
    if perso1qy>210 and perso1qx=132 then perso1qx=138
    if perso1sx<138 and perso1sy>210 then perso1sy=210
    if perso1qy<240 and perso1qx=102 then perso1qx=108
    if perso1zx<138 and perso1zy<090 then perso1zy=090
    if perso1qy<090 and perso1qx=132 then perso1qx=138
    if perso1dy<168 and perso1dx=522 then perso1dx=516
    if perso1zx>516 and perso1zy<168 then perso1zy=168
    if perso1dy<228 and perso1dx=552 then perso1dx=546
    if perso1zx>552 and perso1zy<228 then perso1zy=228
    if perso1dy<258 and perso1dx=768 then perso1dx=762
    if perso1zx>762 and perso1zx<858 and perso1zy<258 then perso1zy=258
    if perso1qy<258 and perso1qx=852 then perso1qx=858
    if perso1zx>360 and perso1zy<018 then perso1zy=18
    if perso1dy >100 and perso1dx>980 then [map4]
    if perso1zx<360 and perso1zy<018 then [map6bis]
    if perso1zx> 390 and perso1zx< 440 and perso1zy < 80 and Qvoleur = 1 then [Q1voleur]
    return

    [limitesMAP6]
    if perso1qx<210 and perso1qy>158 then perso1qx=210
    if perso1zx<258 and perso1zy<172 and perso1zy>160 then perso1zy=172
    if perso1qx<258 and perso1qy<158 and perso1qy>060 then perso1qx=258
    if perso1sx<258 and perso1sy<070 and perso1sy>060 then perso1sy=060
    if perso1qx<240 and perso1qy<072 then perso1qx=240
    if perso1dx>348 and perso1dx<360 and perso1dy<120 then perso1dx=348
    if perso1zx>348 and perso1zx<420 and perso1zy<120 then perso1zy=120
    if perso1dx>390 and perso1dx<400 and perso1dy<162 then perso1dx=390
    if perso1zx>390 and perso1zx<462 and perso1zy<162 then perso1zy=162
    if perso1qx>450 and perso1qx<462 and perso1qy<162 then perso1qx=462
    if perso1zx>450 and perso1zx<498 and perso1zy<108 then perso1zy=108
    if perso1qx>490 and perso1qx<498 and perso1qy<108 then perso1qx=498
    if perso1zx>490 and perso1zx<672 and perso1zy<066 then perso1zy=066
    if perso1qx>660 and perso1qx<672 and perso1qy<066 then perso1qx=672
    if perso1zx>600 and perso1zx<990 and perso1zy<030 then perso1zy=030
    if perso1dx>450 and perso1dx<460 and perso1dy>282 then perso1dx=450
    if perso1sx>450 and perso1sy<300 and perso1sy>282 then perso1sy=282
    if perso1dx>524 and perso1dx<540 and perso1dy>210 then perso1dx=524
    if perso1sx>524 and perso1sy>210 and perso1sy<230 then perso1sy=210
    if perso1dx>570 and perso1dx<580 and perso1dy>168 then perso1dx=570
    if perso1sx>524 and perso1sy>210 and perso1sy<230 then perso1sy=210
    if perso1dx>570 and perso1dx<580 and perso1dy>168 then perso1dx=570
    if perso1sx>570 and perso1sy>168 and perso1sy<180 then perso1sy=168
    if perso1dx>642 and perso1dx<650 and perso1dy>132 then perso1dx=642
    if perso1sx>642 and perso1sy>132 then perso1sy=132
    if perso1sx <360 and perso1sy<18 then [map7bis]
    if perso1sx >950 then [map9bis]
    if perso1sx >50 and perso1sy>400 then [map5]
    return

    [limitesMAP7]
    if perso1sx <900 and perso1sy<18 then [map8bis]
    if perso1sx >50 and perso1sy>390 then [map6]
    if perso1dx>456 and perso1dx<470 and perso1dy>228 then perso1dx=456
    if perso1sx>456 and perso1sx<574 and perso1sy>228 then perso1sy=228
    if perso1qx<574 and perso1qx>550 and perso1qy>228 then perso1qx=574
    if perso1sx>560 and perso1sy>300 then perso1sy=300
    if perso1dx>678 and perso1dy>264 then perso1dx=678
    if perso1sx>678 and perso1sy>264 then perso1sy=264
    if perso1dx>714 and perso1dy>010 then perso1dx=714
    if perso1zx>540 and perso1zy<138 then perso1zy=138
    if perso1dx>540 and perso1dy<138 then perso1dx=540
    if perso1zx>510 and perso1zy<060 then perso1zy=060
    if perso1dx>510 and perso1dy<060 then perso1dx=510
    if perso1qx<120 and perso1qy>100 then perso1qx=120
    if perso1zx<312 and perso1zy<240 and perso1zy>180 then perso1zy=240
    if perso1qx<312 and perso1qy>144 and perso1qy<240 then perso1qx=312
    if perso1sx<312 and perso1sy>144 and perso1sy<174 then perso1sy=144
    if perso1qx<276 and perso1qy<150 then perso1qx=276
    if perso1zx<360 and perso1zy<060 then perso1zy=060
    if perso1qx<360 and perso1qy<060 then perso1qx=360
    if perso1dx>712 and perso1dy>200 and perso1dy<260 and Q2 = 0 then [DQop2]
    if perso1dx>712 and perso1dy>200 and perso1dy<260 and NombreLoupTuer >= 3 and Q2 = 1 THEN Q2 = 3 : winQ2 = 1 : goto [DQop2END]
    if perso1dx>712 and perso1dy>200 and perso1dy<260 and marchandQ2 = 0 THEN perso1dx = perso1dx - 6 : goto [marchandQ2]
    return

    [limitesMAP8]
    if perso1sx <500 and perso1sy>390 then [map7]
    if perso1dx>312 and perso1dx<350 and perso1dy>276 then perso1dx=312
    if perso1sx>312 and perso1sx<372 and perso1sy>276 then perso1sy=276
    if perso1dx>336 and perso1dx<380 and perso1dy>246 then perso1dx=336
    if perso1sx>336 and perso1sx<672 and perso1sy>246 then perso1sy=246
    if perso1dx>402 and perso1dx<462 and perso1dy>204 then perso1dx=402
    if perso1sx>402 and perso1sx<594 and perso1sy>204 then perso1sy=204
    if perso1qx<594 and perso1qx>562 and perso1qy>204 then perso1qx=594
    if perso1qx<672 and perso1qx>562 and perso1qy>246 then perso1qx=672
    if perso1sx>642 and perso1sy>300 then perso1sy=300
    if perso1dx>750 and perso1dy>010 then perso1dx=750
    if perso1zx>672 and perso1zy<210 then perso1zy=210
    if perso1dx>672 and perso1dy<210 then perso1dx=672
    if perso1zx>010 and perso1zy<126 then perso1zy=126
    if perso1qx<252 and perso1qy<168 then perso1qx=252
    if perso1zx<252 and perso1zy<168 then perso1zy=168
    if perso1qx<222 and perso1qy<258 then perso1qx=222
    if perso1zx<222 and perso1zy<258 then perso1zy=258
    if perso1qx<168 and perso1qy>010 then perso1qx=168
    return

    [limitesMAP9]
    if perso1sx>0 and perso1sy>390 then perso1sy=390
    if perso1zx>001 and perso1zx<270 and perso1zy<102 then perso1zy=102
    if perso1dx>198 and perso1dx<240 and perso1dy<156 then perso1dx=198
    if perso1zx>198 and perso1zx<264 and perso1zy<156 then perso1zy=156
    if perso1qx>250 and perso1qx<264 and perso1qy<156 then perso1qx=264
    if perso1zx>260 and perso1zx<420 and perso1zy<120 then perso1zy=120
    if perso1qx<420 and perso1qx>380 and perso1qy<120 then perso1qx=420
    if perso1zx>380 and perso1zx<540 and perso1zy<066 then perso1zy=066
    if perso1dx>492 and perso1dx<540 and perso1dy<144 then perso1dx=492
    if perso1sx>450 and perso1sy<150 and perso1sy>138 then perso1sy=138
    if perso1dx>450 and perso1dy>138 and perso1dy<282 then perso1dx=450
    if perso1zx>450 and perso1zy>270 and perso1zy<282 then perso1zy=282
    if perso1dx>654 and perso1dx<720 and perso1dy<312 then perso1dx=654
    if perso1zx>654 and perso1zx<738 and perso1zy<312 then perso1zy=312
    if perso1qx<738 and perso1qx>720 and perso1qy<312 then perso1qx=738
    if perso1sx<090 and perso1sy>222 and perso1sy<230 then perso1sy=222
    if perso1qx<090 and perso1qy>222 then perso1qx=090
    if perso1sx<300 and perso1sy>270 and perso1sy<310 then perso1sy=270
    if perso1qx<300 and perso1qy>270 then perso1qx=300
    if perso1sx<348 and perso1sy>330 and perso1sy<360 then perso1sy=330
    if perso1qx<348 and perso1qy>330 then perso1qx=348
    if perso1sx>010 and perso1sy>390 then perso1sy=390
    if perso1dx>474 and perso1dx<500 and perso1dy>366 then perso1dx=474
    if perso1sx>474 and perso1sx<546 and perso1sy>366 then perso1sy=366
    if perso1qx<546 and perso1qy>366 then perso1qx=546
    if perso1dx>828 and perso1dy>360 then perso1dx=828
    if perso1sx>828 and perso1sy>360 then perso1sy=360
    if perso1qx>950 then [map10bis]
    if perso1qx<18 then [map6]
    return

    [limitesMAP10]
    if perso1sx>0 and perso1sy>390 then perso1sy=390
    if perso1sx>001 and perso1sx<258 and perso1sy>390 then perso1sy=390
    if perso1qx<258 and perso1qy>390 then perso1qx=258
    if perso1sx>001 and perso1sy>414 then perso1sy=414
    if perso1dx>492 and perso1dy>294 and perso1dx<500 then perso1dx=492
    if perso1sx>492 and perso1sx<912 and perso1sy>294 then perso1sy=294
    if perso1dx>546 and perso1dy>270 and perso1dx<590 then perso1dx=546
    if perso1sx>546 and perso1sx<620 and perso1sy>270 then perso1sy=270
    if perso1dx>600 and perso1dy>156 and perso1dx<620 then perso1dx=600
    if perso1sx>600 and perso1sx<846 and perso1sy>156 then perso1sy=156
    if perso1dx>710 and perso1dy>132 and perso1dx<740 then perso1dx=710
    if perso1sx>710 and perso1sx<782 and perso1sy>132 then perso1sy=132
    if perso1qx>762 and perso1qy>132 and perso1qx<782 then perso1qx=782
    if perso1qx>820 and perso1qy>156 and perso1qx<846 then perso1qx=846
    if perso1qx>900 and perso1qy>294 and perso1qx<912 then perso1qx=912
    if perso1sx>900 and perso1sy>330 then perso1sy=330
    if perso1zx>001 and perso1zx<306 and perso1zy<342 and perso1zy>322 then perso1zy=342
    if perso1qx>290 and perso1qy<342 and perso1qx<306 then perso1qx=306
    if perso1sx>100 and perso1sx<306 and perso1sy>210 and perso1sy<230 then perso1sy=210
    if perso1qx>240 and perso1qy<230 and perso1qx<288 then perso1qx=288
    if perso1zx>330 and perso1zx<516 and perso1zy<132 then perso1zy=132
    if perso1qx>500 and perso1qy<132 and perso1qx<516 then perso1qx=516
    if perso1zx>001 and perso1zx<668 and perso1zy<102 then perso1zy=102
    if perso1qx>650 and perso1qy<102 and perso1qx<668 then perso1qx=668
    if perso1zx>001 and perso1zy<048 then perso1zy=048
    if perso1dx>970 and perso1dy>100 then [map17bis]
    if perso1qx<18 then [map9]
    if perso1zx>270 and perso1zx<340 and perso1zy<120 then [map11bis]
    return

    [limitesMAP11]
    if perso1sx>0 and perso1sy>402 then perso1sy=402
    if perso1dx>450 and perso1dx<520 and perso1dy>294 then perso1dx=450
    if perso1sx>450 and perso1sx<510 and perso1sy>294 then perso1sy=294
    if perso1dx>492 and perso1dx<520 and perso1dy>060 then perso1dx=492
    if perso1sx>492 and perso1sy>060 then perso1sy=060
    if perso1qx<318 and perso1qx>280 and perso1qy<360 then perso1qx=318
    if perso1sx>312 and perso1sx<378 and perso1sy>150 and perso1sy<170 then perso1sy=150
    if perso1qx<378 and perso1qx>360 and perso1qy<258 and perso1qy>150 then perso1qx=378
    if perso1zx>312 and perso1zx<378 and perso1zy<258 and perso1zy>170 then perso1zy=258
    if perso1qx<342 and perso1qx>330 and perso1qy<300 and perso1qy>238 then perso1qx=342
    if perso1zx>300 and perso1zx<342 and perso1zy<300 and perso1zy>270 then perso1zy=300
    if perso1zx>240 and perso1zx<318 and perso1zy<360 and perso1zy>300 then perso1zy=360
    if perso1qx<288 and perso1qy<420 then perso1qx=288
    if perso1sx>0 and perso1sy>400 then [map10]
    if perso1zx>0 and perso1zy<18 then [map12bis]
    if perso1dx>650 and perso1dy<200 then [map13bis]
    if perso1qx<330 and perso1qy<70 then [map15bis]
    return

    [limitesMAP12]
    if perso1sx>0 and perso1sy>400 then [map11]
    if perso1qx<300 and perso1qy<500 then perso1qx=300
    if perso1zx<330 and perso1zy<372 then perso1zy=372
    if perso1qx<330 and perso1qy<372 then perso1qx=330
    if perso1zx>300 and perso1zx<600 and perso1zy<300 then perso1zy=300
    if perso1dx>438 and perso1dy<342 then perso1dx=438
    if perso1zx>438 and perso1zy<342 then perso1zy=342
    if perso1dx>612 and perso1dy>200 then perso1dx=612
    return

    [limitesMAP13]
    if perso1zx<192 and perso1zy<66 then perso1zy=66
    if perso1qx<192 and perso1qy<66 then perso1qx=192
    if perso1qx<156 and perso1qy<400 then perso1qx=156
    if perso1sx<254 and perso1sy>254 then perso1sy=254
    if perso1qx<254 and perso1qy>254 then perso1qx=254
    if perso1sx>10 and perso1sy>414 then perso1sy=414
    if perso1dx>504 and perso1dy>272 then perso1dx=504
    if perso1sx>504 and perso1sy>272 then perso1sy=272
    if perso1dx>702 and perso1dy<400 then perso1dx=702
    if perso1qx<162 and perso1qy>72 and perso1qy<132 then [map11]
    if perso1qx>192 and perso1sy<30 then [map14bis]
    return

    [limitesMAP14]
    if perso1sx<120 and perso1sy>240 then perso1sy=240
    if perso1qx<120 and perso1qy>240 then perso1qx=120
    if perso1dx>720 then perso1dx=720
    if perso1sx<240 and perso1sy>402 then perso1sy=402
    if perso1zy<114 then perso1zy=114
    if perso1sx>240 and perso1sy>400 then [map13]
    if perso1qx<30 and perso1qy<240 then [map15]
    return

    [limitesMAP15]
    if perso1qx<264 then perso1qx=264
    if perso1dx>980 and perso1dy<240 then perso1dx=980
    if perso1sx>648 and perso1sy>162 then perso1sy=162
    if perso1zy<72 then perso1zy=72
    if perso1dx>648 and perso1dy>162 and perso1dy<412 then perso1dx= 648
    if perso1dx>660 and perso1dy>412 and perso1dy<446 then [map11]
    if perso1dx>972 and perso1dy<200 then [map14]
    if perso1sx>250 and perso1sx<648 and perso1sy>446 then [map16bis]
    return

    [limitesMAP16]
    if perso1sy>414 then perso1sy=414
    if perso1qx<282 then perso1qx=282
    if perso1dx>642 then perso1dx=642
    if perso1sx>0 and perso1sy<12 then [map15]
    return

    [limitesMAP17]
    if perso1sx>0 and perso1sy>396 then perso1sy=396
    if perso1dx >900 then perso1dx = 900
    if perso1qx <9 then perso1qx = 9
    if perso1zy <9 then perso1zy = 9
    if perso1sx<252 and perso1sy>390 then perso1sy=390
    if perso1qx<252 and perso1qy>390 then perso1qx=252
    if perso1sy>440 then perso1sy=440
    if perso1dx>732 and perso1dy>390 then perso1dx=732
    if perso1sx>732 and perso1sy>390 then perso1sy=390
    if perso1qx<30 and perso1qy>150 then [map10]
    if perso1sx>30 and perso1sy>390 then [map18bis]
    return

    [limitesMAP18]
    if perso1sx>0 and perso1sy>396 then perso1sy=396
    if perso1qx<390 and perso1qy<192 then perso1qx=390
    if perso1zx<390 and perso1zy<192 then perso1zy=192
    if perso1qx<306 and perso1qy>190 then perso1qx=306
    if perso1dx>498 and perso1dy<112 then perso1dx=498
    if perso1zx>498 and perso1zy<112 then perso1zy=112
    if perso1dx>582 and perso1dy<160 then perso1dx=582
    if perso1zx>582 and perso1zy<160 then perso1zy=160
    if perso1dx>630 and perso1dy>154 then perso1dx=630
    if perso1sx>588 and perso1sy>282 then perso1sy=282
    if perso1dx>588 and perso1dy>282 then perso1dx=588
    if perso1zx>0 and perso1zy<30 then [map17]
    if perso1sx>0 and perso1sy>390 then [map19bis]
    return

    [limitesMAP19]
    if perso1qx<318 and perso1qy<102 then perso1qx=318
    if perso1zx<318 and perso1zy<102 then perso1zy=102
    if perso1qx<240 and perso1qy<150 then perso1qx=240
    if perso1zx<240 and perso1zy<150 then perso1zy=150
    if perso1qx<180 and perso1qy>100 then perso1qx=180
    if perso1dx>522 and perso1dy<88 then perso1dx=522
    if perso1zx>522 and perso1zy<88 then perso1zy=88
    if perso1dx>588 and perso1dx<648 and perso1dy<120 then perso1dx=588
    if perso1zx>588 and perso1dx<648 and perso1zy<120 then perso1zy=120
    if perso1qx>630 and perso1qx<648 and perso1qy<120 then perso1qx=648
    if perso1dx>870 and perso1dy>10 then perso1dx=870
    if perso1sx>732 and perso1sy>240 then perso1sy=240
    if perso1dx>732 and perso1dy>240 then perso1dx=732
    if perso1sx>678 and perso1sy>282 then perso1sy=282
    if perso1dx>678 and perso1dy>282 then perso1dx=678
    if perso1sx>570 and perso1sy>360 then perso1sy=360
    if perso1dx>570 and perso1dy>360 then perso1dx=570
    if perso1zx>0 and perso1zy>390 then [map20bis]
    if perso1zx>0 and perso1zy<30 then [map18]
    return

    [limitesMAP20]
    if perso1dx>600 and perso1dy<204 then perso1dx=600
    if perso1zx>600 and perso1zy<204 then perso1zy=204
    if perso1dx>678 and perso1dy<234 then perso1dx=678
    if perso1zx>678 and perso1zy<234 then perso1zy=234
    if perso1qx<390 and perso1qy<192 then perso1qx=390
    if perso1zx<390 and perso1zy<192 then perso1zy=192
    if perso1qx<180 and perso1qy<240 then perso1qx=180
    if perso1zx<180 and perso1zy<240 then perso1zy=240
    if perso1sy>390 then perso1sy=390
    if perso1dx>318 and perso1dx<360 and perso1dy>348 then perso1dx=318
    if perso1sx>318 and perso1sx<410 and perso1sy>348 then perso1sy=348
    if perso1dx>390 and perso1dx<410 and perso1dy>330 then perso1dx=390
    if perso1sx>390 and perso1sx<462 and perso1sy>330 then perso1sy=330
    if perso1qx<462 and perso1qx>430 and perso1qy>330 then perso1qx=462
    if perso1dx>528 and perso1dx<550 and perso1dy>342 then perso1dx=528
    if perso1sx>528 and perso1sx<600 and perso1sy>342 then perso1sy=342
    if perso1qx<600 and perso1qx>590 and perso1qy>342 then perso1qx=600
    if perso1dx>642 and perso1dx<670 and perso1dy>342 then perso1dx=642
    if perso1sx>642 and perso1sx<732 and perso1sy>342 then perso1sy=342
    if perso1qx<732 and perso1qx>720 and perso1qy>342 then perso1qx=732
    if perso1zy<030 then [map19]
    if perso1zx>850 then [map21bis]
    if perso1zx<030 then [map22bis]
    return

    [limitesMAP21]
    if perso1sx<252 and perso1sy>390 then perso1sy=390
    if perso1qx<252 and perso1qy>390 then perso1qx=252
    if perso1sy>440 then perso1sy=440
    if perso1dx>732 and perso1dy>390 then perso1dx=732
    if perso1sx>732 and perso1sy>390 then perso1sy=390
    if perso1zx<196 and perso1zy<312 then perso1zy=312
    if perso1qx<196 and perso1qy<312 then perso1qx=196
    if perso1zy<108 then perso1zy=108
    if perso1dy<240 and perso1dx>402 then perso1dx=402
    if perso1zx>402 and perso1zy<240 then perso1zy=240
    if perso1dy<282 and perso1dx>720 then perso1dx=720
    if perso1zx>720 and  perso1zy<282 then perso1zy=282
    if perso1dy<342 and perso1dx>828 then perso1dx=828
    if perso1zx>828 and  perso1zy<342 then perso1zy=342
    if perso1dx>900 then perso1dx=900
    if perso1zx<30 and perso1zy>30 then [map20]
    return

    [limitesMAP22]
    if perso1zy<150 then perso1zy=150
    if perso1qx<600 and perso1qy<222 then perso1qx=600
    if perso1zx<600 and perso1zy<222 then perso1zy=222
    if perso1sx<582 and perso1sy>318 then perso1sy=318
    if perso1qx<582 and perso1qy>318 then perso1qx=582
    if perso1sy>360 then perso1sy=360
    if perso1qx<828 and perso1qy>330 then perso1qx=828
    if perso1sx<828 and perso1sy>342 then perso1sy=342
    if perso1qx<300 then perso1qx=300
    if perso1dx>980 then [map20]
    return

'-------------------------------------------------------------------------------------------------------------------------------
[dataloadSECURITYingame]
dataloadNAME2$ = dataloadNAME$ + "-INFO"
open dataloadNAME2$ for input as #save
input #save, SAVnameCampagne$
input #save, SAVlvlHero
input #save, SAVact
input #save, SAVmap
input #save, SAVPV
input #save, SAVPVTotal
input #save, SAVgold
input #save, SAVsexe$
close #save
return

    [dataSAVEmode]
    MenuMode = 1 : goto [saveMain]
    [dataLOADmode]
    MenuMode = 2
    [saveMain]
    if bruitage = 0 then playwave "music\hit.wav", async
    if saveMain=0 then goto [saveMain2]
    if saveMain=1 then close #saveMain
    [saveMain2]
    saveMain=1
    if MenuMode = 1 then dataloadNAME$ = "TEMP.sys" : gosub [savedataTEMP]

    loadbmp"save", "bmp\interface\save.bmp"
    loadbmp"close", "bmp\interface\closeSave.bmp"
    loadbmp"load", "bmp\interface\reload.bmp"

    WindowWidth = 600 : WindowHeight = 420
    UpperLeftX=int((DisplayWidth-WindowWidth)/2)
    UpperLeftY=int((DisplayHeight-WindowHeight)/2)
    BackgroundColor$ = "black" : ForegroundColor$ = "white"
    graphicbox #saveMain.map, 0, 0, 1100, 630

    Open "" for window_nf As #saveMain
    #saveMain, "trapclose [Qsave]"
    #saveMain.map, "down; fill black"
    print #saveMain, "font times_new_roman 11"
    print #saveMain.map, "font times_new_roman 16"
    if language = 0  then print #saveMain.map, "backcolor black; place 125 40 ;\"; "SELECTIONNEZ UNE SAUVEGARDE"
    if language = 1  then print #saveMain.map, "backcolor black; place 170 40 ;\"; "SELECT A SAVED GAME"
    print #saveMain.map, "font times_new_roman 9"
    #saveMain.map, "drawbmp save 50 80"
    if MenuMode = 1 then #saveMain.map, "drawbmp load 35 105"
    #saveMain.map, "drawbmp close 35 85"
    #saveMain.map, "drawbmp save 50 140"
    if MenuMode = 1 then #saveMain.map, "drawbmp load 35 165"
    #saveMain.map, "drawbmp close 35 145"
    #saveMain.map, "drawbmp save 50 200"
    if MenuMode = 1 then #saveMain.map, "drawbmp load 35 225"
    #saveMain.map, "drawbmp close 35 205"
    #saveMain.map, "drawbmp save 50 260"
    if MenuMode = 1 then #saveMain.map, "drawbmp load 35 285"
    #saveMain.map, "drawbmp close 35 265"
    #saveMain.map, "drawbmp save 50 320"
    if MenuMode = 1 then #saveMain.map, "drawbmp load 35 345"
    #saveMain.map, "drawbmp close 35 325"
    #saveMain.map, "drawbmp save 320 80"
    if MenuMode = 1 then #saveMain.map, "drawbmp load 305 105"
    #saveMain.map, "drawbmp close 305 85"
    #saveMain.map, "drawbmp save 320 140"
    if MenuMode = 1 then #saveMain.map, "drawbmp load 305 165"
    #saveMain.map, "drawbmp close 305 145"
    #saveMain.map, "drawbmp save 320 200"
    if MenuMode = 1 then #saveMain.map, "drawbmp load 305 225"
    #saveMain.map, "drawbmp close 305 205"
    #saveMain.map, "drawbmp save 320 260"
    if MenuMode = 1 then #saveMain.map, "drawbmp load 305 285"
    #saveMain.map, "drawbmp close 305 265"
    #saveMain.map, "drawbmp save 320 320"
    if MenuMode = 1 then #saveMain.map, "drawbmp load 305 345"
    #saveMain.map, "drawbmp close 305 325"

    perso1sxSAVED = perso1sx : perso1sySAVED = perso1sy : perso1dxSAVED = perso1dx : perso1dySAVED = perso1dy : perso1zxSAVED = perso1zx : perso1zySAVED = perso1zy : perso1qxSAVED = perso1qx : perso1qySAVED = perso1qy

    dir$ = "" : file$ = "save1.ini"
    if fileExist(dir$,file$) = 0 then goto [Z1]
    dataloadNAME$ = "save1.ini" : gosub [dataloadSECURITYingame]
    if version = 1 then print #saveMain.map, "backcolor black ; place 110 90 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Niveau "; SAVlvlHero;"\Acte : "; SAVact ; "  - "; " Carte ";SAVmap;"\Santé : "; SAVPV; " / ";SAVPVTotal; "   - Argent : "; SAVgold
    if version = 2 then print #saveMain.map, "backcolor black ; place 110 90 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Level "; SAVlvlHero;"\Act : "; SAVact ; "  - "; " Map ";SAVmap;"\Heal : "; SAVPV; " / ";SAVPVTotal; "   - Money : "; SAVgold

    [Z1]
    file$ = "save2.ini"
    if fileExist(dir$,file$) = 0 then goto [Z2]
    dataloadNAME$ = "save2.ini" : gosub [dataloadSECURITYingame]
    if version = 1 then print #saveMain.map, "backcolor black ; place 110 150 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Niveau "; SAVlvlHero;"\Acte : "; SAVact ; "  - "; " Carte ";SAVmap;"\Santé : "; SAVPV; " / ";SAVPVTotal; "   - Argent : "; SAVgold
    if version = 2 then print #saveMain.map, "backcolor black ; place 110 150 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Level "; SAVlvlHero;"\Act : "; SAVact ; "  - "; " Map ";SAVmap;"\Heal : "; SAVPV; " / ";SAVPVTotal; "   - Money : "; SAVgold

    [Z2]
    file$ = "save3.ini"
    if fileExist(dir$,file$) = 0 then goto [Z3]
    dataloadNAME$ = "save3.ini" : gosub [dataloadSECURITYingame]
    if version = 1 then print #saveMain.map, "backcolor black ; place 110 210 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Niveau "; SAVlvlHero;"\Acte : "; SAVact ; "  - "; " Carte ";SAVmap;"\Santé : "; SAVPV; " / ";SAVPVTotal; "   - Argent : "; SAVgold
    if version = 2 then print #saveMain.map, "backcolor black ; place 110 210 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Level "; SAVlvlHero;"\Act : "; SAVact ; "  - "; " Map ";SAVmap;"\Heal : "; SAVPV; " / ";SAVPVTotal; "   - Money : "; SAVgold

    [Z3]
    file$ = "save4.ini"
    if fileExist(dir$,file$) = 0 then goto [Z4]
    dataloadNAME$ = "save4.ini" : gosub [dataloadSECURITYingame]
    if version = 1 then print #saveMain.map, "backcolor black ; place 110 270 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Niveau "; SAVlvlHero;"\Acte : "; SAVact ; "  - "; " Carte ";SAVmap;"\Santé : "; SAVPV; " / ";SAVPVTotal; "   - Argent : "; SAVgold
    if version = 2 then print #saveMain.map, "backcolor black ; place 110 270 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Level "; SAVlvlHero;"\Act : "; SAVact ; "  - "; " Map ";SAVmap;"\Heal : "; SAVPV; " / ";SAVPVTotal; "   - Money : "; SAVgold

    [Z4]
    file$ = "save5.ini"
    if fileExist(dir$,file$) = 0 then goto [Z5]
    dataloadNAME$ = "save5.ini" : gosub [dataloadSECURITYingame]
    if version = 1 then print #saveMain.map, "backcolor black ; place 110 330 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Niveau "; SAVlvlHero;"\Acte : "; SAVact ; "  - "; " Carte ";SAVmap;"\Santé : "; SAVPV; " / ";SAVPVTotal; "   - Argent : "; SAVgold
    if version = 2 then print #saveMain.map, "backcolor black ; place 110 330 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Level "; SAVlvlHero;"\Act : "; SAVact ; "  - "; " Map ";SAVmap;"\Heal : "; SAVPV; " / ";SAVPVTotal; "   - Money : "; SAVgold

    [Z5]
    file$ = "save6.ini"
    if fileExist(dir$,file$) = 0 then goto [Z6]
    dataloadNAME$ = "save6.ini" : gosub [dataloadSECURITYingame]
    if version = 1 then print #saveMain.map, "backcolor black ; place 380 90 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Niveau "; SAVlvlHero;"\Acte : "; SAVact ; "  - "; " Carte ";SAVmap;"\Santé : "; SAVPV; " / ";SAVPVTotal; "   - Argent : "; SAVgold
    if version = 2 then print #saveMain.map, "backcolor black ; place 380 90 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Level "; SAVlvlHero;"\Act : "; SAVact ; "  - "; " Map ";SAVmap;"\Heal : "; SAVPV; " / ";SAVPVTotal; "   - Money : "; SAVgold

    [Z6]
    file$ = "save7.ini"
    if fileExist(dir$,file$) = 0 then goto [Z7]
    dataloadNAME$ = "save7.ini" : gosub [dataloadSECURITYingame]
    if version = 1 then print #saveMain.map, "backcolor black ; place 380 150 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Niveau "; SAVlvlHero;"\Acte : "; SAVact ; "  - "; " Carte ";SAVmap;"\Santé : "; SAVPV; " / ";SAVPVTotal; "   - Argent : "; SAVgold
    if version = 2 then print #saveMain.map, "backcolor black ; place 380 150 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Level "; SAVlvlHero;"\Act : "; SAVact ; "  - "; " Map ";SAVmap;"\Heal : "; SAVPV; " / ";SAVPVTotal; "   - Money : "; SAVgold

    [Z7]
    file$ = "save8.ini"
    if fileExist(dir$,file$) = 0 then goto [Z8]
    dataloadNAME$ = "save8.ini" : gosub [dataloadSECURITYingame]
    if version = 1 then print #saveMain.map, "backcolor black ; place 380 210 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Niveau "; SAVlvlHero;"\Acte : "; SAVact ; "  - "; " Carte ";SAVmap;"\Santé : "; SAVPV; " / ";SAVPVTotal; "   - Argent : "; SAVgold
    if version = 2 then print #saveMain.map, "backcolor black ; place 380 210 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Level "; SAVlvlHero;"\Act : "; SAVact ; "  - "; " Map ";SAVmap;"\Heal : "; SAVPV; " / ";SAVPVTotal; "   - Money : "; SAVgold

    [Z8]
    file$ = "save9.ini"
    if fileExist(dir$,file$) = 0 then goto [Z9]
    dataloadNAME$ = "save9.ini" : gosub [dataloadSECURITYingame]
    if version = 1 then print #saveMain.map, "backcolor black ; place 380 270 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Niveau "; SAVlvlHero;"\Acte : "; SAVact ; "  - "; " Carte ";SAVmap;"\Santé : "; SAVPV; " / ";SAVPVTotal; "   - Argent : "; SAVgold
    if version = 2 then print #saveMain.map, "backcolor black ; place 380 270 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Level "; SAVlvlHero;"\Act : "; SAVact ; "  - "; " Map ";SAVmap;"\Heal : "; SAVPV; " / ";SAVPVTotal; "   - Money : "; SAVgold

    [Z9]
    file$ = "save10.ini"
    if fileExist(dir$,file$) = 0 then goto [Z10]
    dataloadNAME$ = "save10.ini" : gosub [dataloadSECURITYingame]
    if version = 1 then print #saveMain.map, "backcolor black ; place 380 330 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Niveau "; SAVlvlHero;"\Acte : "; SAVact ; "  - "; " Carte ";SAVmap;"\Santé : "; SAVPV; " / ";SAVPVTotal; "   - Argent : "; SAVgold
    if version = 2 then print #saveMain.map, "backcolor black ; place 380 330 ;\"; SAVnameCampagne$ ;" (";SAVsexe$;")"; " - Level "; SAVlvlHero;"\Act : "; SAVact ; "  - "; " Map ";SAVmap;"\Heal : "; SAVPV; " / ";SAVPVTotal; "   - Money : "; SAVgold

    [Z10]
    #saveMain.map, "setfocus; when leftButtonDown [SimpleClickSAVE]"
    if MenuMode = 3 then game$ = "off" : MenuMode = 2
    wait

    [Qsave]
    close #saveMain
    saveMain = 0 : MenuMode = 3
    if game$ = "on" then
        perso1sx = perso1sxSAVED : perso1sy = perso1sySAVED : perso1dx = perso1dxSAVED : perso1dy = perso1dySAVED : perso1zx = perso1zxSAVED : perso1zy = perso1zySAVED : perso1qx = perso1qxSAVED : perso1qy = perso1qySAVED
        timer 100, [deplacementBOUCLE]
    end if
    wait

    [securNAmeLoadFile]
    if map < 22 then act = 1
    if sex = 1 then sexe$ = "Homme"
    if sex = 2 then sexe$ = "Femme"
    if campagne = 1 then nameCampagne$ = "Guerrier"
    if campagne = 2 then nameCampagne$ = "Archer"
    if campagne = 3 then nameCampagne$ = "Mage"
    if campagne = 4 then nameCampagne$ = "Necrom"
    if campagne = 5 then nameCampagne$ = "Marchand"
    return


    [SimpleClickSAVE]
    mX = MouseX
    mY = MouseY

    if mX>30 and mX<45 and mY>85 and mY<100 then
        dir$ = "" : file$ = "save1.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Ete-vous sûre de vouloir supprimer cette sauvegarde ?";quit$
        if version = 2 then confirm "Are you sure that you want to delete this saved game ?";quit$
        if quit$ = "no" then wait
        kill "save1.ini" : close #saveMain : saveMain = 0 : goto [saveMain]
    end if
    if mX>30 and mX<45 and mY>105 and mY<120 and MenuMode = 1 then
        dir$ = "" : file$ = "save1.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Voulez vous charger la dernière sauvegarde de cette partie ?";quit$
        if version = 2 then confirm "Do you really want to load the last saved game?";quit$
        if quit$ = "no" then wait
        dataloadNAME$ = "save1.ini"
        if game$ = "on" then reloadBUG = 1
        gosub [dataloadSECURITY]
        goto [load]
    end if

    if mX>30 and mX<45 and mY>145 and mY<160 then
        dir$ = "" : file$ = "save2.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Ete-vous sûre de vouloir supprimer cette sauvegarde ?";quit$
        if version = 2 then confirm "Are you sure that you want to delete this saved game ?";quit$
        if quit$ = "no" then wait
        kill "save2.ini" : close #saveMain : saveMain = 0 : goto [saveMain]
    end if
    if mX>30 and mX<45 and mY>165 and mY<180 and MenuMode = 1 then
        dir$ = "" : file$ = "save2.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Voulez vous charger la dernière sauvegarde de cette partie ?";quit$
        if version = 2 then confirm "Do you really want to load the last saved game?";quit$
        if quit$ = "no" then wait
        if game$ = "on" then reloadBUG = 1
        dataloadNAME$ = "save2.ini"
        gosub [dataloadSECURITY]
        goto [load]
    end if

    if mX>30 and mX<45 and mY>205 and mY<220 then
        dir$ = "" : file$ = "save3.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Ete-vous sûre de vouloir supprimer cette sauvegarde ?";quit$
        if version = 2 then confirm "Are you sure that you want to delete this saved game ?";quit$
        if quit$ = "no" then wait
        kill "save3.ini" : close #saveMain : saveMain = 0 : goto [saveMain]
    end if
    if mX>30 and mX<45 and mY>225 and mY<240 and MenuMode = 1 then
        dir$ = "" : file$ = "save3.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Voulez vous charger la dernière sauvegarde de cette partie ?";quit$
        if version = 2 then confirm "Do you really want to load the last saved game?";quit$
        if quit$ = "no" then wait
        if game$ = "on" then reloadBUG = 1
        dataloadNAME$ = "save3.ini"
        gosub [dataloadSECURITY]
        goto [load]
    end if

    if mX>30 and mX<45 and mY>265 and mY<280 then
        dir$ = "" : file$ = "save4.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Ete-vous sûre de vouloir supprimer cette sauvegarde ?";quit$
        if version = 2 then confirm "Are you sure that you want to delete this saved game ?";quit$
        if quit$ = "no" then wait
        kill "save4.ini" : close #saveMain : saveMain = 0 : goto [saveMain]
    end if
    if mX>30 and mX<45 and mY>285 and mY<300 and MenuMode = 1 then
        dir$ = "" : file$ = "save4.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Voulez vous charger la dernière sauvegarde de cette partie ?";quit$
        if version = 2 then confirm "Do you really want to load the last saved game?";quit$
        if quit$ = "no" then wait
        dataloadNAME$ = "save4.ini"
        if game$ = "on" then reloadBUG = 1
        gosub [dataloadSECURITY]
        goto [load]
    end if

    if mX>30 and mX<45 and mY>325 and mY<340 then
        dir$ = "" : file$ = "save5.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Ete-vous sûre de vouloir supprimer cette sauvegarde ?";quit$
        if version = 2 then confirm "Are you sure that you want to delete this saved game ?";quit$
        if quit$ = "no" then wait
        kill "save5.ini" : close #saveMain : saveMain = 0 : goto [saveMain]
    end if
    if mX>30 and mX<45 and mY>345 and mY<360 and MenuMode = 1 then
        dir$ = "" : file$ = "save5.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Voulez vous charger la dernière sauvegarde de cette partie ?";quit$
        if version = 2 then confirm "Do you really want to load the last saved game?";quit$
        if quit$ = "no" then wait
        dataloadNAME$ = "save5.ini"
        if game$ = "on" then reloadBUG = 1
        gosub [dataloadSECURITY]
        goto [load]
    end if

    if mX>300 and mX<315 and mY>85 and mY<100 then
        dir$ = "" : file$ = "save6.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Ete-vous sûre de vouloir supprimer cette sauvegarde ?";quit$
        if version = 2 then confirm "Are you sure that you want to delete this saved game ?";quit$
        if quit$ = "no" then wait
        kill "save6.ini" : close #saveMain : saveMain = 0 : goto [saveMain]
    end if
    if mX>300 and mX<315 and mY>105 and mY<120 and MenuMode = 1 then
        dir$ = "" : file$ = "save6.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Voulez vous charger la dernière sauvegarde de cette partie ?";quit$
        if version = 2 then confirm "Do you really want to load the last saved game?";quit$
        if quit$ = "no" then wait
        dataloadNAME$ = "save6.ini"
        if game$ = "on" then reloadBUG = 1
        gosub [dataloadSECURITY]
        goto [load]
    end if

    if mX>300 and mX<315 and mY>145 and mY<160 then
        dir$ = "" : file$ = "save7.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Ete-vous sûre de vouloir supprimer cette sauvegarde ?";quit$
        if version = 2 then confirm "Are you sure that you want to delete this saved game ?";quit$
        if quit$ = "no" then wait
        kill "save7.ini" : close #saveMain : saveMain = 0 : goto [saveMain]
    end if
    if mX>300 and mX<315 and mY>165 and mY<180 and MenuMode = 1 then
        dir$ = "" : file$ = "save7.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Voulez vous charger la dernière sauvegarde de cette partie ?";quit$
        if version = 2 then confirm "Do you really want to load the last saved game?";quit$
        if quit$ = "no" then wait
        dataloadNAME$ = "save7.ini"
        if game$ = "on" then reloadBUG = 1
        gosub [dataloadSECURITY]
        goto [load]
    end if

    if mX>300 and mX<315 and mY>205 and mY<220 then
        dir$ = "" : file$ = "save8.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Ete-vous sûre de vouloir supprimer cette sauvegarde ?";quit$
        if version = 2 then confirm "Are you sure that you want to delete this saved game ?";quit$
        if quit$ = "no" then wait
        kill "save8.ini" : close #saveMain : saveMain = 0 : goto [saveMain]
    end if
    if mX>300 and mX<315 and mY>225 and mY<240 and MenuMode = 1 then
        dir$ = "" : file$ = "save8.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Voulez vous charger la dernière sauvegarde de cette partie ?";quit$
        if version = 2 then confirm "Do you really want to load the last saved game?";quit$
        if quit$ = "no" then wait
        dataloadNAME$ = "save8.ini"
        if game$ = "on" then reloadBUG = 1
        gosub [dataloadSECURITY]
        goto [load]
    end if

    if mX>300 and mX<315 and mY>265 and mY<280 then
        dir$ = "" : file$ = "save9.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Ete-vous sûre de vouloir supprimer cette sauvegarde ?";quit$
        if version = 2 then confirm "Are you sure that you want to delete this saved game ?";quit$
        if quit$ = "no" then wait
        kill "save9.ini" : close #saveMain : saveMain = 0 : goto [saveMain]
    end if
    if mX>300 and mX<315 and mY>285 and mY<300 and MenuMode = 1 then
        dir$ = "" : file$ = "save9.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Voulez vous charger la dernière sauvegarde de cette partie ?";quit$
        if version = 2 then confirm "Do you really want to load the last saved game?";quit$
        if quit$ = "no" then wait
        dataloadNAME$ = "save9.ini"
        if game$ = "on" then reloadBUG = 1
        gosub [dataloadSECURITY]
        goto [load]
    end if

    if mX>300 and mX<315 and mY>325 and mY<340 then
        dir$ = "" : file$ = "save10.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Ete-vous sûre de vouloir supprimer cette sauvegarde ?";quit$
        if version = 2 then confirm "Are you sure that you want to delete this saved game ?";quit$
        if quit$ = "no" then wait
        kill "save10.ini" : close #saveMain : saveMain = 0 : goto [saveMain]
    end if
    if mX>300 and mX<315 and mY>345 and mY<360 and MenuMode = 1 then
        dir$ = "" : file$ = "save10.ini"
        if fileExist(dir$,file$) = 0 then wait
        if version = 1 then confirm "Voulez vous charger la dernière sauvegarde de cette partie ?";quit$
        if version = 2 then confirm "Do you really want to load the last saved game?";quit$
        if quit$ = "no" then wait
        dataloadNAME$ = "save10.ini"
        if game$ = "on" then reloadBUG = 1
        gosub [dataloadSECURITY]
        goto [load]
    end if

    if mX>50 and mX<90 and mY>80 and mY<120 then
        if MenuMode = 2 then
            dir$ = "" : file$ = "save1.ini"
            if fileExist(dir$,file$) = 0 then wait
            dataloadNAME$ = "save1.ini" : game$ = "off" : goto [load]
        end if
        if MenuMode = 1 then datamenusav = 1 : dataloadNAME$ = "TEMP.sys" : gosub [dataload] : dataloadNAME$ = "save1.ini" : goto [save]
    end if
    if mX>50 and mX<90 and mY>140 and mY<180 then
        if MenuMode = 2 then
            dir$ = "" : file$ = "save2.ini"
            if fileExist(dir$,file$) = 0 then wait
            dataloadNAME$ = "save2.ini" : game$ = "off" : goto [load]
        end if
        if MenuMode = 1 then datamenusav = 1 : dataloadNAME$ = "TEMP.sys" : gosub [dataload] : dataloadNAME$ = "save2.ini" : goto [save]
    end if
    if mX>50 and mX<90 and mY>200 and mY<240 then
        if MenuMode = 2 then
            dir$ = "" : file$ = "save3.ini"
            if fileExist(dir$,file$) = 0 then wait
            dataloadNAME$ = "save3.ini" : game$ = "off" : goto [load]
        end if
        if MenuMode = 1 then datamenusav = 1 : dataloadNAME$ = "TEMP.sys" : gosub [dataload] : dataloadNAME$ = "save3.ini" : goto [save]
    end if
    if mX>50 and mX<90 and mY>260 and mY<300 then
        if MenuMode = 2 then
            dir$ = "" : file$ = "save4.ini"
            if fileExist(dir$,file$) = 0 then wait
            dataloadNAME$ = "save4.ini" : game$ = "off" : goto [load]
        end if
        if MenuMode = 1 then datamenusav = 1 : dataloadNAME$ = "TEMP.sys" : gosub [dataload] : dataloadNAME$ = "save4.ini" : goto [save]
    end if
    if mX>50 and mX<90 and mY>320 and mY<360 then
        if MenuMode = 2 then
            dir$ = "" : file$ = "save5.ini"
            if fileExist(dir$,file$) = 0 then wait
            dataloadNAME$ = "save5.ini" : game$ = "off" : goto [load]
        end if
        if MenuMode = 1 then datamenusav = 1 : dataloadNAME$ = "TEMP.sys" : gosub [dataload] : dataloadNAME$ = "save5.ini" : goto [save]
    end if
    if mX>315 and mX<355 and mY>80 and mY<120 then
        if MenuMode = 2 then
            dir$ = "" : file$ = "save6.ini"
            if fileExist(dir$,file$) = 0 then wait
            dataloadNAME$ = "save6.ini" : game$ = "off" : goto [load]
        end if
        if MenuMode = 1 then datamenusav = 1 : dataloadNAME$ = "TEMP.sys" : gosub [dataload] : dataloadNAME$ = "save6.ini" : goto [save]
    end if
    if mX>315 and mX<355 and mY>140 and mY<180 then
        if MenuMode = 2 then
            dir$ = "" : file$ = "save7.ini"
            if fileExist(dir$,file$) = 0 then wait
            dataloadNAME$ = "save7.ini" : game$ = "off" : goto [load]
        end if
        if MenuMode = 1 then datamenusav = 1 : dataloadNAME$ = "TEMP.sys" : gosub [dataload] : dataloadNAME$ = "save7.ini" : goto [save]
    end if
    if mX>315 and mX<355 and mY>200 and mY<240 then
        if MenuMode = 2 then
            dir$ = "" : file$ = "save8.ini"
            if fileExist(dir$,file$) = 0 then wait
            dataloadNAME$ = "save8.ini" : game$ = "off" : goto [load]
        end if
        if MenuMode = 1 then datamenusav = 1 : dataloadNAME$ = "TEMP.sys" : gosub [dataload] : dataloadNAME$ = "save8.ini" : goto [save]
    end if
    if mX>315 and mX<355 and mY>260 and mY<300 then
        if MenuMode = 2 then
            dir$ = "" : file$ = "save9.ini"
            if fileExist(dir$,file$) = 0 then wait
            dataloadNAME$ = "save9.ini" : game$ = "off" : goto [load]
        end if
        if MenuMode = 1 then datamenusav = 1 : dataloadNAME$ = "TEMP.sys" : gosub [dataload] : dataloadNAME$ = "save9.ini" : goto [save]
    end if
    if mX>315 and mX<355 and mY>320 and mY<360 then
        if MenuMode = 2 then
            dir$ = "" : file$ = "save10.ini"
            if fileExist(dir$,file$) = 0 then wait
            dataloadNAME$ = "save10.ini" : game$ = "off" : goto [load]
        end if
        if MenuMode = 1 then datamenusav = 1 : dataloadNAME$ = "TEMP.sys" : gosub [dataload] : dataloadNAME$ = "save10.ini" : goto [save]
    end if
    print #saveMain.map, "flush"
    wait

    [iniMUSIC2]
    MusicSELECT = 0 : gosub [stopMusic2]
    if game$ = "off" then print #2b.son2, "enable"
    if game$ = "off" then print #2b.son1, "disable"
    music = 1
    wait
    [iniMUSIC]
    MusicSELECT = 1 : gosub [startMusic]
    if game$ = "off" then print #2b.son1, "enable"
    if game$ = "off" then print #2b.son2, "disable"
    music = 0
    wait

    [MusicSELECT]
    if MusicSELECT = 1 then MusicSELECT = 0 : gosub [stopMusic2] : wait
    MusicSELECT = 1 : wait
    [stopMusic]
    MusicSELECT = 0 : gosub [stopMusic2] : wait

    [startMusic]
    if game$ = "on" then mus$ = "music\music1.mp3"
    if game$ = "off" then mus$ = "music\menu.mp3"
    ext$ = upper$(right$(mus$,3))
    mp3$ = "open "+mus$+" type MpegVideo alias fictoplay"
    if ext$ = "MID" then a$ = mid$ else a$ = mp3$
    calldll #winmm,"mciSendStringA",a$ as ptr,_
        i1 as ulong,_
        i2 as long,_
        i3 as long,_
        r as long
    a$="play fictoplay"
    calldll #winmm,"mciSendStringA",_
        a$ as ptr,_
        i1 as ulong,_
        i2 as long,_
        i3 as long,_
        r as long
    return

    [stopMusic2]
    a$="close fictoplay"
    calldll #winmm,"mciSendStringA",_
        a$ as ptr,_
        i1 as ulong,_
        i2 as long,_
        i3 as long,_
        r as long
    return

    function fileExist(dir$,file$)
        dim info$(100, 100)
        files dir$,file$, info$(
        if val(info$(0, 0)) > 0 then
            fileExist = 1
        else
            fileExist = 0
        end if
    end function

    sub SimpleClick handle$, MouseX, MouseY
        #3b.map "SetFocus; DrawSprites"
    end sub
