Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,634
Reaction score
1,457
First Language
French
Primarily Uses
RMMV
I started learning there around two months the javascript .
I'm still at the beginning but I learned rather quickly.


I was rather specialized in html5 and css.


For now my custom plugin works fine for my needs, however, I remain skeptical of some techniques that I use in my javascript code.


Only if someone is interested to study fast improvements to do on my structure javascript, be for performance,or because my code are obsolete and not good.


Thank you for your free time, I like to know if overall there would have some simply change has helped to make me learn more from my mistakes and improve.


here is my beginner custom plugin (NOOB), which contributes to the function and fx of my games.
Thank you for helping :)


Show plugin

Code:
/*:
*
*@plugindesc this is my first
*
*
@author Djmisterjon
*
*@help
*My Alpha beta custom plugin  ZZZZZZZZZZZ test, test 
*
*
*/
(function() {
    //Function list in game
    //befor all, Scene need switch(13) = gen random ressource 
    Scene_Map.prototype.create = function() {
        Scene_Base.prototype.create.call(this);
        this._transfer = $gamePlayer.isTransferring();
        var mapId = this._transfer ? $gamePlayer.newMapId() : $gameMap.mapId();
        $gameSwitches.setValue(13, true);
        DataManager.loadMapData(mapId);

    };
    //plugin start for calling command in game 
    console.log('plugin menue jon');
    var jon_interpreterCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        jon_interpreterCommand.call(this, command, args);
        // call the menu item multi page and fx
        if (command === 'menuobj') {
            var Pid = 100; // picture ID for clic, 100 + max 36 Max 200
            var ItemtotalDB = 119; // Maximum item dans le DB rpgmaker $dataItems.length (custom max item in game)
            var Itemtotalposs = 0; // Nombre objet posseder, on int, car ont veut faire un calcul eatch/pass plugin called
            var Objetposseder = []; // creer une variable poru chaque item avec valeur
            var i = 1; // représente page pour listi
            $gameVariables.setValue(38, i); // Int la VAr38 car i doi avoir page 1 initial. (bug corr)
            var Pagevar = $gameVariables.value(34);
            var Listi = 0;
            var ListiP = []; // ou doi commencer le listi a chaque page
            for (Listi = 1; Listi < ItemtotalDB; Listi++) {
                $gameScreen.erasePicture(Pid);
                $gameScreen.erasePicture(Pid + (36 * 2));
                $gameScreen.erasePicture(Pid + (36 * 3));
                Pid++;
                if ($gameParty.hasItem($dataItems[Listi]) == true) {
                    Objetposseder[Listi] = Listi; //create variable based on DB Objetposseder1=2,Objetposseder2=2,Objetposseder3=3...
                    Itemtotalposs++; //calcul global total objet poseder
                    if (Itemtotalposs == 37 || Itemtotalposs == 73 || Itemtotalposs == 108 || Itemtotalposs == 144 || Itemtotalposs == 180) { //a chaque +1 que 36 Itemtotalposs = 1 nouvelle page
                        i++;
                        $gameVariables.setValue(38, i); // NB de page total
                        ListiP[i] = Listi; // pour page 2,3,4..., on sait que on doi comment la list a cette endroit .
                    }
                }
            }
            var Pid = 100; // picture ID for clic, 100 + max 36 Max 200
            $gameVariables.setValue(42, Itemtotalposs);
            if (Itemtotalposs == 0) {
                console.log('le joueur na pas objet');
            } // stop because no objet !!}
            else {
                //page1
                var Xitem = 0; // X coor for the item + picturesize+ marge
                var Yitem = 0; // Y coor for the item + picturesize+ marge
                var InpicX = 88; // Initial X of menue item list
                var InpicY = 226; // Initial Y of menue item list
                var MargeX = 7; // Marge bettwenn 2 picture X
                var MargeY = 6; // Marge bettwenn 2 picture Y
                var ISIZEX = 82; // X size of picture
                var ISIZEY = 82; // X size of picture
                var NBitempagemenu = 0;
                Itemdescr = [];

                if (Pagevar == 1) {
                    Listi = 1; // si sur page 1 , listi restart le scan a 1
                } else {
                    Listi = ListiP[Pagevar]; // si sur page 2 ou autre , listi recommence le scan a Listi[Pagevar]...[pagevariable dans jeux]
                }
                console.log('ItemtotalDB =   ' + ItemtotalDB + ' zzzzzzzzzz ');
                for (; Listi < ItemtotalDB; Listi++) {
                    console.log(Listi);
                    if (Objetposseder[Listi] == Listi) {
                        //afficher objet
                        Listi = String(Listi);
                        console.log('Detien objet ' + Objetposseder[Listi] + ' Listi est a ' + Listi);
                        $gameScreen.showPicture(Pid, Listi, 1, InpicX + Xitem, InpicY + Yitem, 150, 150, 255, 0);
                        $gameScreen.movePicture(Pid, 1, InpicX + Xitem, InpicY + Yitem, 100, 100, 255, 0, 18);
                        Listi = Number(Listi);
                        $gameScreen.setPictureCallCommon(Pid, 21, 1); // si clique sur item renvoi vers event.commun
                        Textitems = String($dataItems[Listi].name); // on va chercher le nom fichier
                        Textitems = Textitems.split(' - '); // on le découpe en 2 le text nom
                        $gameScreen.setDTextPicture('\\OW[5] ' + Textitems[0] + '', 20); //plugincall dtext
                        $gameScreen.setFont('GameFont');
                        $gameScreen.showPicture(Pid + (36 * 1), '', 0, InpicX + Xitem - 45, InpicY + Yitem - 80, 100, 160, 50, 0); // affiche image a PID+36 (max72)
                        $gameScreen.setDTextPicture('\\OW[4] ' + Textitems[1] + '', 19); //plugincall dtext
                        $gameScreen.setFont('GameFont');
                        $gameScreen.showPicture(Pid + (36 * 2), '', 0, InpicX + Xitem - 41, InpicY + Yitem - 80, 100, 20, 50, 0); // affiche D_text titre objet
                        Textitems = $gameParty._items[Listi]; // Obtien le nombre objet posseder
                        $gameScreen.setDTextPicture('\\OW[5] ' + Textitems + ' ', 17); //plugincall dtext
                        $gameScreen.setFont('GameFont');
                        $gameScreen.dTextBackColor = 'rgba(0, 0, 0, 0.5)';
                        $gameScreen.showPicture(Pid + (36 * 3), '', 0, InpicX + Xitem + 21, InpicY + Yitem + 15, 100, 100, 255, 0); // affiche image a PID+36 (max72)
                        $gameScreen.movePicture(Pid + (36 * 1), 0, InpicX + Xitem - 45, InpicY + Yitem - 46, 100, 100, 255, 0, 27);
                        $gameScreen.movePicture(Pid + (36 * 2), 0, InpicX + Xitem - 41, InpicY + Yitem - 30, 100, 100, 255, 0, 20);
                        NBitempagemenu++
                        Itemdescr[Pid] = Listi; // pour les click item description (click item show description)
                        Pid++
                        Xitem += ISIZEX + MargeX;


                    }
                    if (NBitempagemenu == 38) {
                        console.log('On break  ligne 74 car NBitempagemenu= ' + NBitempagemenu); //afficher objet
                        break;
                    } else if (NBitempagemenu == 12 || NBitempagemenu == 25) {
                        //Saut de ligne ( for new item line)
                        console.log('On saut ligne caR ON EST A ' + NBitempagemenu);
                        Xitem = 0;
                        Yitem += ISIZEY + MargeY;
                        NBitempagemenu++;
                    }
                }
                console.log('fin scan');
            }
        } //___________________________________________________________________________________________________
        else if (command === 'lootitem') {
            // Ex: dans event monstre   ItemMonster[1] = [1,99,3,0]; arr0=IDitem,arr1=chance%,arr2=Nbmax
            NBitemLoot = []; //le nombre objet identique looté
            NBitemLoot[1] = 0, NBitemLoot[2] = 0, NBitemLoot[3] = 0, NBitemLoot[4] = 0, NBitemLoot[5] = 0, NBitemLoot[6] = 0;
            ItemPass = ItemMonster.length - 1; // dapret le nombre de (item) ItemMonster[] diferent que le evenmonstre a initialisé
            var Pidloot = 200; // on défénit la base des Pid a afficher
            var MaxItemLine = 0; // maximum de item par ligne


            var x = 830;
            var y = 465;
            for (I = 1; I <= ItemPass; I++) { // nombre de passe global tout les items du monstre
                for (i = 1; i <= ItemMonster[I][2]; i++) { //nombre de passe = Nb item maximum que peut loot le monstre voir eventmonster

                    var itemChance = 1 + Math.floor(Math.random() * 100); //genere un nombre entre 1 et 100 pour comparer avec la valeur dans eventmonstre ItemMonster[]
                    if (itemChance < ItemMonster[I][1]) { //Si vrai ces que le monstre loot x1 de ce item sur cette pass
                        ItemMonster[I][3]++; // on augment la quantité du item gagner de 1 le 3 ieme array de ItemMonster[]
                        $gameScreen.showPicture(Pidloot, String(ItemMonster[I][0]), 1, x, y, 100, 100, 255, 0); //affiche image icon
                        $gameScreen.setPictureCallCommon(Pidloot, 22, 4); // lorsque click sur image prendra tous
                        $gameScreen.setDTextPicture(' ' + ItemMonster[I][3] + ' ', 30); //on affiche la valeur quantité dans ce item
                        $gameScreen.setFont('GameFont');
                        $gameScreen.dTextBackColor = 'rgba(0, 0, 0, 0.6)';
                        $gameScreen.showPicture(Pidloot + ItemPass, '', 1, x + 25, y + 25, 100, 100, 255, 0); //affiche quantité le id est calculer avec le Nb de ItemMonster[] trouvé

                    }

                }
                if (ItemMonster[I][3] != 0) { // test item obtenue pour le pid actuell, si oui , ajouter max item par ligne
                    MaxItemLine++;
                    if (MaxItemLine > 4) {
                        var MaxItemLine = 0;
                        var x = 830;
                        var y = (y + 82) + 10; // augment distance hauteur
                    } else {
                        var x = (x + 82) + 10; // position absolut+taille image+marge
                    }

                }
                Pidloot++;

            }
			//other item menu for action
        } else if (command === 'Actionitem') {
            function enelvestate() {
                console.log('enevestate');
                ParHP = $dataWeapons[OldNewactionID].params[0] //hp represente array 0
                ParMP = $dataWeapons[OldNewactionID].params[1] //hp represente array 0
                ParATT = $dataWeapons[OldNewactionID].params[2] //hp represente array 0
                ParDEF = $dataWeapons[OldNewactionID].params[3] //hp represente array 0
                ParAGI = $dataWeapons[OldNewactionID].params[6] //hp represente array 0
                ParLUCK = $dataWeapons[OldNewactionID].params[7] //hp represente array 0
                $gameActors.actor(1).addParam(0, -ParHP);
                $gameActors.actor(1).addParam(1, -ParMP);
                $gameActors.actor(1).addParam(2, -ParATT);
                $gameActors.actor(1).addParam(3, -ParDEF);
                $gameActors.actor(1).addParam(6, -ParAGI);
                $gameActors.actor(1).addParam(7, -ParLUCK);

            }

            function ajoutestate() {
                console.log('addstate');
                ParHP = $dataWeapons[OldNewactionID].params[0] //hp represente array 0
                ParMP = $dataWeapons[OldNewactionID].params[1] //hp represente array 0
                ParATT = $dataWeapons[OldNewactionID].params[2] //hp represente array 0
                ParDEF = $dataWeapons[OldNewactionID].params[3] //hp represente array 0
                ParAGI = $dataWeapons[OldNewactionID].params[6] //hp represente array 0
                ParLUCK = $dataWeapons[OldNewactionID].params[7] //hp represente array 0
                $gameActors.actor(1).addParam(0, +ParHP);
                $gameActors.actor(1).addParam(1, +ParMP);
                $gameActors.actor(1).addParam(2, +ParATT);
                $gameActors.actor(1).addParam(3, +ParDEF);
                $gameActors.actor(1).addParam(6, +ParAGI);
                $gameActors.actor(1).addParam(7, +ParLUCK);

            }
            //_____________________________________________________________
            //Test si Armeactionid est deja existant dans un des 3 action
            if ($gameVariables.value(58) == Armeactionid) {
                console.log('bug1');
                OldNewactionID = $gameVariables.value(58);
                $gameScreen.erasePicture(9);
                $gameVariables.setValue(58, 0);
                enelvestate(); // enleve les stats de arme id Armeactionid
            } else if ($gameVariables.value(59) == Armeactionid) {
                OldNewactionID = $gameVariables.value(59);
                console.log('bug2');
                $gameScreen.erasePicture(10);
                $gameVariables.setValue(59, 0);
                enelvestate(); // enleve les stats de arme id Armeactionid
            } else if ($gameVariables.value(60) == Armeactionid) {
                OldNewactionID = $gameVariables.value(60);
                console.log('bug3');
                $gameScreen.erasePicture(11);
                $gameVariables.setValue(60, 0);
                enelvestate(); // enleve les stats de arme id Armeactionid
            }
            //Ensuite si la mosue Y est plus petit que 288 = action hub 1 _______________________________
            if ($gameVariables.value(4) < 288) {
                if ($gameVariables.value(58) > 0) { // esceque action contenait un autre objet ?
                    OldNewactionID = $gameVariables.value(58);
                    enelvestate() // ont enleve les states de cette ancien objet
                    $gameScreen.erasePicture(9);
                    $gameVariables.setValue(58, 0);
                }
            }
            //Ensuite si la mosue Y est plus petit que 401 = action hub 2 _______________________________
            else if ($gameVariables.value(4) < 401) {
                if ($gameVariables.value(59) > 0) { // esceque action contenait un autre objet ?
                    OldNewactionID = $gameVariables.value(59);
                    enelvestate() // ont enleve les states de cette ancien objet
                    $gameScreen.erasePicture(10);
                    $gameVariables.setValue(59, 0);
                }
            }
            //ou sinon la mouse Y est plus GRAND que 401 = action hub 3 _______________________________
            else if ($gameVariables.value(4) > 401) {
                if ($gameVariables.value(60) > 0) { // esceque action contenait un autre objet ?
                    OldNewactionID = $gameVariables.value(60);
                    enelvestate() // ont enleve les states de cette ancien objet
                    $gameScreen.erasePicture(11);
                    $gameVariables.setValue(60, 0);
                }
            }
            OldNewactionID = Armeactionid;
            ajoutestate();

        } // afiche les dé de choix a lecrant visible_________________________________________________________
        else if (command === 'diceobj') {
            diceQT = 43; // id qui affiche quantité de dé
            DPID = 31; // id item affiche dé
            Xmargin = 21; // margin pour x a partir du centre
            Ymargin = 16; // margin pour y a partir du centre
            diceQTvar = 18; // variable utilisé pour quantité
            for (i = 1; i <= 12; i++) {
                XXX = $gameScreen._pictures[DPID]._x; // on va cherche pos x,y objet dé
                YYY = $gameScreen._pictures[DPID]._y;
                $gameScreen.setDTextPicture('\\OW[5] ' + '\\v[' + diceQTvar + ']' + ' ', 16); //plugincall dtext
                $gameScreen.setFont('GameFont');
                $gameScreen.dTextBackColor = 'rgba(0, 0, 0, 0.6)';
                $gameScreen.showPicture(diceQT, '', 0, XXX + Xmargin, YYY + Ymargin, 100, 100, 255, 0);
                $gameScreen.setPictureCallCommon(DPID, 8, 1);
                diceQT++;
                DPID++;
                diceQTvar++;
                console.log(DPID + '  ' + diceQT);
            }
            diceQT = 0;

        } else if (command === 'diceobjcombat') {
            diceQT = 43; // id qui affiche quantité de dé
            DPID = 31; // id item affiche dé
            Xmargin = 21; // margin pour x a partir du centre
            Ymargin = 16; // margin pour y a partir du centre
            diceQTvar = 18; // variable utilisé pour quantité
            for (i = 1; i <= 8; i++) {
                XXX = $gameScreen._pictures[DPID]._x; // on va cherche pos x,y objet dé
                YYY = $gameScreen._pictures[DPID]._y;
                $gameScreen.setDTextPicture('\\OW[5] ' + '\\v[' + diceQTvar + ']' + ' ', 16); //plugincall dtext
                $gameScreen.setFont('GameFont');
                $gameScreen.dTextBackColor = 'rgba(0, 0, 0, 0.6)';
                $gameScreen.showPicture(diceQT, '', 0, XXX + Xmargin, YYY + Ymargin, 100, 100, 255, 0);
                $gameScreen.setPictureCallCommon(DPID, 8, 1);
                diceQT++;
                DPID++;
                diceQTvar++;
                console.log(DPID + '  ' + diceQT);
            }
            diceQT = 0;

        } else if (command === 'diceobjhoverclick') {
            if (!diceQT == 0) { // remet pas nombre du centre, en bas a droite si premiere fois
                $gameScreen.setDTextPicture('\\OW[5] ' + '\\v[' + diceQTvar + ']' + ' ', 16); //plugincall dtext
                $gameScreen.setFont('GameFont');
                $gameScreen.dTextBackColor = 'rgba(0, 0, 0, 0.6)';
                $gameScreen.showPicture(diceQT, '', 0, XXX + Xmargin, YYY + Ymargin, 100, 100, 255, 0); // replace ancien valeur
            }

            DPIDExit = $gameVariables.value(2); // Stock le pid du dé selection pour quitté a partir du mouseout
            DPID = $gameVariables.value(2); // id item affiche dé
            diceQT = DPID + 12; // id qui affiche quantité de dé
            diceQTvar = DPID - 13; // variable utilisé pour quantité
            XXX = $gameScreen._pictures[DPID]._x; // on va cherche pos x,y objet dé
            YYY = $gameScreen._pictures[DPID]._y;
            //___________
            $gameScreen.setDTextPicture('\\OW[6] ' + '\\v[' + diceQTvar + ']' + ' ', 28); //plugincall dtext nom dé centre
            $gameScreen.setFont('GameFont');
            $gameScreen.dTextBackColor = 'rgba(0, 0, 0, 0.4)';
            $gameScreen.showPicture(diceQT, '', 1, XXX, YYY, 100, 100, 255, 0);


        } else if (command === 'diceobjminimise') { //minimise affiche dé favorite


        } else if (command === 'GeneratebattleATT') {
            PID = 150;
            MarginY = 0;

            function MonsterAttGenerator() {
                switch (AttakTypes) { // store Les type attaque 
                    case 1:
                        //Cost 1xD4
                        ATTlv = 1; // lv néssesaire
                        Attmp = 5; // mp nessesaire
                        AttDice = []; // 
                        AttDice[1] = [1, 1]; // Dice [NB cost, Type dice 1-8] (D4,1)(D6,2)(D12,3)(D20,4)(D30,5)(D50,6)(D100,7)(D500,8)
                        //Description
                        Attname = 'Peck tacle';
                        AttformD = '\\OW[6] (\\i[216]+ Att ) +5% (S.HP) ';
                        Attdescr = 'Attaque avec le beck \n (1D4+Att) + (5%HP) DMG';
                        AttBonus = '\\i[210]';
                        //Dammage
                        Attform = ((1 + Math.floor(Math.random() * 4)) + MonsterAtt);
                        console.log('generation de laction case' + AttakTypes);
                        break;
                    case 2:
                        //Cost 1xD4
                        ATTlv = 5;
                        Attmp = 2;
                        AttDice = [];
                        AttDice[1] = [1, 2]; // Dice [total dice cost, Type dice 1-8] (D4,1)(D6,2)(D12,3)(D20,4)(D30,5)(D50,6)(D100,7)(D500,8)
                        //Description
                        Attname = 'Torpedo wine';
                        AttformD = '\\OW[6] (\\i[216]+ Att ) +5% (S.HP) ';
                        Attdescr = 'Attaque avec le beck \n (1D6+Att) + (5%HP) DMG';
                        AttBonus = '\\i[210]';
                        //Dammage
                        Attform = ((1 + Math.floor(Math.random() * 4)) + MonsterAtt);
                        console.log('generation de laction case' + AttakTypes);
                        break;
                }
            }

            function AttaquePidGenerator() { // funtion qui affiche les image par rapport au donné du haut MonsterAttGenerator (case)
                $gameScreen.showPicture(PID, 'combat-att', 0, 795, MarginY + 125, 100, 100, 255, 0);
                console.log(5);
                XXX = $gameScreen._pictures[PID]._x; // on va cherche pos x,y image
                YYY = $gameScreen._pictures[PID]._y;
                // Level requis pour cette attaque
                $gameScreen.setDTextPicture('\\OW[8]\\c[0] ' + ATTlv + ' ', 46);
                $gameScreen.setFont('GameFont');
                $gameScreen.showPicture(PID + 1, '', 1, XXX + 38, YYY + 44, 100, 100, 255, 0);
                // Nom de l'attaque
                $gameScreen.setDTextPicture('\\OW[6]\\c[0] ' + Attname + ' ', 38);
                $gameScreen.setFont('GameFont');
                $gameScreen.showPicture(PID + 2, '', 0, XXX + 65, YYY - 8, 100, 100, 255, 0);
                // Nom de l'attaque
                $gameScreen.setDTextPicture('\\OW[5]\\c[0] ' + AttformD + ' ', 26);
                $gameScreen.setFont('GameFont');
                $gameScreen.showPicture(PID + 3, '', 0, XXX + 65, YYY + 30, 100, 100, 255, 0);
                // Cout du MP
                $gameScreen.setDTextPicture('\\OW[6]\\c[0] COST: ' + Attmp + 'MP ', 24);
                $gameScreen.setFont('GameFont');
                $gameScreen.showPicture(PID + 4, '', 0, XXX + 345, YYY - 5, 100, 100, 255, 0);
                // ORB Bonus de l'attaque
                $gameScreen.setDTextPicture('\\OW[6]\\c[0] ' + AttBonus + ' ', 32);
                $gameScreen.setFont('GameFont');
                $gameScreen.showPicture(PID + 5, '', 0, XXX + 375, YYY + 30, 100, 100, 255, 0);
                $gameScreen.setPictureCallCommon(PID, 46, 1); // mouse over
            }
            //------------------ Generate ------------------------------
            if ($gameSwitches.value(5) == true) { // affiche bubble aide information
                console.log('affiche buuble de ' + $gameVariables.value(2));
                // attribu les donné du monstre entre les 6 type de action, les pid par base de 6, 150, 156, 162
                switch ($gameVariables.value(2)) { // Les type attaque de LV 1 a 5 defenir dans le even du monstre
                    case 150:
                        AttakTypes = MonsterAttT[1];
                        break;
                    case 156:
                        AttakTypes = MonsterAttT[2];
                        break;
                    case 162:
                        AttakTypes = MonsterAttT[3];
                        break;
                    case 168:
                        AttakTypes = MonsterAttT[4];
                        break;
                    case 174:
                        AttakTypes = MonsterAttT[5];
                        break;
                    case 180:
                        AttakTypes = MonsterAttT[6];
                        break;
                }
                MonsterAttGenerator(); // initialise la bubble avec le AttakTypes qui a pris la valeur de MonsterAttT[1,2,3,4,5,6] du event monstre
                $gameScreen.setDTextPicture('\\OW[6]\\c[0] ' + Attname + ' ', 30);
                $gameScreen.setDTextPicture('\\OW[6]\\c[0] ' + Attdescr + ' ', 30);
                $gameScreen.setDTextPicture('\\OW[6]\\c[0] ' + AttformD + ' ', 30);
                $gameScreen.setDTextPicture('\\OW[6]\\c[0] ' + AttBonus + ' ', 30);
                $gameScreen.setDTextPicture('\\OW[6]\\c[0] ' + AttBonus + AttBonus + ' ', 30);
                $gameScreen.setFont('GameFont');
                $gameScreen.dTextBackColor = 'rgba(0, 0, 0, 0.75)';
                $gameScreen.showPicture(200, '', 0, $gameVariables.value(3), $gameVariables.value(4), 100, 100, 255, 0);
                $gameScreen.setPictureCallCommon($gameVariables.value(2), 46, 5);
            } else {
                console.log('Le game stitch est a fasle');
                for (i = 1; i <= 6; i++) {
                    if (MonsterAttT[i] >= 0) { // créer les attaque du monstre possible Ex: MonsterAttT[1] qui est defenir au demarage du combat
                        AttakTypes = MonsterAttT[i];
                        MonsterAttGenerator();
                        AttaquePidGenerator();
                        MarginY = MarginY + 96; // cre les distance entre les option att
                        PID = PID + 6; // Image de base 150 ensuite 6 img pour afficher les stat de laction , Saut de ligne prend 6 pid
                    }
                }

            }
        } else if (command === 'GenerateMap') {

            for (g = 1; g <= MapNBMaxRock; g++) {
                // mapid, eventid, regionid, respawn after map transfer (le random generete des modele aléatoir, voir map 0004)
                //modele roche 1 a 6
                $gameMap.copyEventFromMapToRegion(4, 1 + Math.floor(Math.random() * 6), 2, true);
                console.log('G= ' + g);
            }
        } else if (command === 'MonsterMover') { // on créer une fiche objet pour chaque monstre touver sur map tmpMonster[0][1][2][...]
            tmpMonster = $gameMap._events.filter(function(event) {
                return event._characterName.includes('monster');
            });
            $gameVariables.setValue(43, tmpMonster.length); // on donne a la var 43 le nombre de monstre trouver -1
            console.log('tmpMonster ' + tmpMonster + ' tmpMonster.length ' + tmpMonster.length);
        } else if (command === 'Spaceinitialise') {
            GalaxiWaitD = [1, 1, 1, 1, 1, 1, 1]; // ex: GalaxiWaitD[0] est = au speed de zoom des planets
            // Get all coor of all Galaxi planet and sub picture FX for Binding and zoom
            NumImageSpace = 10; // comptabilise le NB of picture(start PID 10) for define what Pid use (good if add more galaxi or planet later)
            // get all event galaxi in map and return the number in array NumGalaxi (5)
            NumGalaxi = $dataMap.events.filter(function(event) {
                return event && event.name === "Galaxi";
            });
            //NB galaxi = 7 for now , maybe more in futur
            for (i = 0; i < NumGalaxi.length; i++) {

                NGx = NumGalaxi[i].x * 48;
                NGy = NumGalaxi[i].y * 48;
                $gameScreen.showPicture((i + NumImageSpace), 'bgspace', 1, NGx, NGy, 40, 40, 150, 0);
                console.log('i = ' + i + ' NumImageSpace= ' + NumImageSpace + ' pid= ' + (NumImageSpace + i));
                this.bindPictureToMap((i + NumImageSpace), 1, 'above_characters'); // bind= pid, false or true, layer
                NumImageSpace++;
                $gameScreen.showPicture((i + NumImageSpace), 'galax-' + (i + 1), 1, NGx, NGy, 20, 20, 255, 0);
                console.log('i = ' + i + ' NumImageSpace= ' + NumImageSpace + ' pid= ' + (NumImageSpace + i));
                this.bindPictureToMap((i + NumImageSpace), 1, 'above_characters'); // bind= pid, false or true, layer
                NumImageSpace++;
                $gameScreen.showPicture((i + NumImageSpace), 'suny-' + (i + 1), 1, NGx, NGy, 5, 5, 150, 0);
                console.log('i = ' + i + ' NumImageSpace= ' + NumImageSpace + ' pid= ' + (NumImageSpace + i));
                this.bindPictureToMap((i + NumImageSpace), 1, 'above_characters'); // bind= pid, false or true, layer
                $gameScreen.rotatePicture(i + NumImageSpace, 0.1 + (Math.random() * 0.4));
                $gameScreen.setPictureCallCommon(i + NumImageSpace, 76, 1); // delette me affiche un console du id seulement sur clic

            }
            console.log('_______________');
            console.log('i = ' + i + ' NumImageSpace= ' + NumImageSpace + ' pid= ' + (NumImageSpace + i));
            //Affiche les planet de chaque galaxi manuel + multipli par nb image afficher avant NumImageSpace++
            NumImageSpace = 10 + (NumGalaxi.length * 3);
            console.log(' Total de planet NumImageSpace= ' + NumImageSpace);

            //Galaxi 1 = soleil pid 12        $gameScreen._pictures[12] = picture 'suny-1'*****************************************
            SoleilG1 = 12; // le soleil pid 12
            g1p1radius = 28; // Galaxi, planet, radius (distance)
            g1p1HL = 4; // Galaxi, planet Hauteur , largeur
            g1p1angle = 0; // galaxi, planet, start angle
            g1p1angleSP = 0.01;
            g1p1x = ($gameScreen._pictures[SoleilG1]._x) + Math.cos(g1p1angle) * g1p1radius; // galaxi, planet, posX
            g1p1y = ($gameScreen._pictures[SoleilG1]._y) + Math.sin(g1p1angle) * g1p1radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-4', 1, g1p1x, g1p1y, g1p1HL, g1p1HL, 255, 0);
            Planet1PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            g1p2radius = 32;
            g1p2HL = 4;
            g1p2angle = 1;
            g1p2angleSP = 0.01;
            g1p2x = ($gameScreen._pictures[SoleilG1]._x) + Math.cos(g1p2angle) * g1p2radius; // galaxi, planet, posX
            g1p2y = ($gameScreen._pictures[SoleilG1]._y) + Math.sin(g1p2angle) * g1p2radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-9', 1, g1p2x, g1p2y, g1p2HL, g1p2HL, 255, 0);
            Planet2PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            //Galaxi 2 = soleil pid 15        $gameScreen._pictures[15] = picture 'suny-2'*****************************************
            SoleilG2 = 15; // le soleil pid 15
            g2p1radius = 28; // Galaxi, planet, radius (distance)
            g2p1HL = 4; // Galaxi, planet Hauteur , largeur
            g2p1angle = 0; // galaxi, planet, start angle
            g2p1angleSP = 0.01;
            g2p1x = ($gameScreen._pictures[SoleilG2]._x) + Math.cos(g2p1angle) * g2p1radius; // galaxi, planet, posX
            g2p1y = ($gameScreen._pictures[SoleilG2]._y) + Math.sin(g2p1angle) * g2p1radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-5', 1, g2p1x, g2p1y, g2p1HL, g2p1HL, 255, 0);
            Planet3PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            g2p2radius = 60; // Galaxi, planet, radius (distance)
            g2p2HL = 4; // Galaxi, planet Hauteur , largeur
            g2p2angle = 0; // galaxi, planet, start angle
            g2p2angleSP = 0.01;
            g2p2x = ($gameScreen._pictures[SoleilG2]._x) + Math.cos(g2p2angle) * g2p2radius; // galaxi, planet, posX
            g2p2y = ($gameScreen._pictures[SoleilG2]._y) + Math.sin(g2p2angle) * g2p2radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-7', 1, g2p2x, g2p2y, g2p2HL, g2p2HL, 255, 0);
            Planet4PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            //Galaxi 3 = soleil pid 18        $gameScreen._pictures[18] = picture 'suny-3'*****************************************
            SoleilG3 = 18; // le soleil pid 18
            g3p1radius = 14; // Galaxi, planet, radius (distance)
            g3p1HL = 2; // Galaxi, planet Hauteur , largeur
            g3p1angle = 2; // galaxi, planet, start angle
            g3p1angleSP = 0.02; // defenie ?
            g3p1x = ($gameScreen._pictures[SoleilG3]._x) + Math.cos(g3p1angle) * g3p1radius; // galaxi, planet, posX
            g3p1y = ($gameScreen._pictures[SoleilG3]._y) + Math.sin(g3p1angle) * g3p1radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-10', 1, g3p1x, g3p1y, g3p1HL, g3p1HL, 255, 0);
            $gameScreen.rotatePicture(NumImageSpace, (Math.random() * 0.90) - 0.45);
            Planet5PID = NumImageSpace; // store ID to Pid picture*
            BindG3 = ($gameScreen._pictures[SoleilG3]._x); // pendant le zoom, ont doi metre = ($dataMap.events[3].x*48)
            NumImageSpace++;
            //------------------------------------- 
            g3p2radius = 40; // Galaxi, planet, radius (distance)
            g3p2HL = 2; // Galaxi, planet Hauteur , largeur
            g3p2angle = 0; // galaxi, planet, start angle
            g3p2angleSP = 0.015;
            g3p2x = ($gameScreen._pictures[SoleilG3]._x) + Math.cos(g3p2angle) * g3p2radius; // galaxi, planet, posX
            g3p2y = ($gameScreen._pictures[SoleilG3]._y) + Math.sin(g3p2angle) * g3p2radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-2', 1, g3p2x, g3p2y, g3p2HL, g3p2HL, 255, 0);
            $gameScreen.rotatePicture(NumImageSpace, (Math.random() * 0.90) - 0.45);
            Planet6PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            LuneG3p2 = NumImageSpace - 1; // LUNE de planette 2 
            g3p3radius = 6; // Galaxi, planet, radius (distance) LUNE
            g3p3HL = 1.5; // Galaxi, planet Hauteur , largeur
            g3p3angle = 0; // galaxi, planet, start angle
            g3p3angleSP = 0.027;
            g3p3x = ($gameScreen._pictures[LuneG3p2]._x) + Math.cos(g3p3angle) * g3p3radius; // galaxi, planet, posX
            g3p3y = ($gameScreen._pictures[LuneG3p2]._y) + Math.sin(g3p3angle) * g3p3radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-11', 1, g3p3x, g3p3y, g3p3HL, g3p3HL, 255, 0);
            $gameScreen.rotatePicture(NumImageSpace, (Math.random() * 0.90) - 0.45);
            Planet7PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            g3p4radius = 50; // Galaxi, planet, radius (distance)
            g3p4HL = 2; // Galaxi, planet Hauteur , largeur
            g3p4angle = 3; // galaxi, planet, start angle
            g3p4angleSP = 0.008;
            g3p4x = ($gameScreen._pictures[SoleilG3]._x) + Math.cos(g3p4angle) * g3p4radius; // galaxi, planet, posX
            g3p4y = ($gameScreen._pictures[SoleilG3]._y) + Math.sin(g3p4angle) * g3p4radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-3', 1, g3p4x, g3p4y, g3p4HL, g3p4HL, 255, 0);
            $gameScreen.rotatePicture(NumImageSpace, (Math.random() * 0.90) - 0.45);
            Planet8PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            //Galaxi 4 = soleil pid 21        $gameScreen._pictures[21] = picture 'suny-4'*****************************************
            SoleilG4 = 21; // le soleil pid 21
            g4p1radius = 25; // Galaxi, planet, radius (distance)
            g4p1HL = 4; // Galaxi, planet Hauteur , largeur
            g4p1angle = 0; // galaxi, planet, start angle
            g4p1angleSP = 0.01;
            g4p1x = ($gameScreen._pictures[SoleilG4]._x) + Math.cos(g4p1angle) * g4p1radius; // galaxi, planet, posX
            g4p1y = ($gameScreen._pictures[SoleilG4]._y) + Math.sin(g4p1angle) * g4p1radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-1', 1, g4p1x, g4p1y, g4p1HL, g4p1HL, 255, 0);
            Planet9PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            g4p2radius = 40; // Galaxi, planet, radius (distance)
            g4p2HL = 4; // Galaxi, planet Hauteur , largeur
            g4p2angle = 0; // galaxi, planet, start angle
            g4p2angleSP = 0.01;
            g4p2x = ($gameScreen._pictures[SoleilG4]._x) + Math.cos(g4p2angle) * g4p2radius; // galaxi, planet, posX
            g4p2y = ($gameScreen._pictures[SoleilG4]._y) + Math.sin(g4p2angle) * g4p2radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-12', 1, g4p2x, g4p2y, g4p2HL, g4p2HL, 255, 0);
            Planet10PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            //Galaxi 5 = soleil pid 24        $gameScreen._pictures[21] = picture 'suny-5'*****************************************
            SoleilG5 = 24; // le soleil pid 24
            g5p1radius = 25; // Galaxi, planet, radius (distance)
            g5p1HL = 4; // Galaxi, planet Hauteur , largeur
            g5p1angle = 0; // galaxi, planet, start angle
            g5p1angleSP = 0.01;
            g5p1x = ($gameScreen._pictures[SoleilG5]._x) + Math.cos(g5p1angle) * g5p1radius; // galaxi, planet, posX
            g5p1y = ($gameScreen._pictures[SoleilG5]._y) + Math.sin(g5p1angle) * g5p1radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-6', 1, g5p1x, g5p1y, g5p1HL, g5p1HL, 255, 0);
            Planet11PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            g5p2radius = 65; // Galaxi, planet, radius (distance)
            g5p2HL = 4; // Galaxi, planet Hauteur , largeur
            g5p2angle = 1; // galaxi, planet, start angle
            g5p2angleSP = 0.01;
            g5p2x = ($gameScreen._pictures[SoleilG5]._x) + Math.cos(g5p2angle) * g5p2radius; // galaxi, planet, posX
            g5p2y = ($gameScreen._pictures[SoleilG5]._y) + Math.sin(g5p2angle) * g5p2radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-13', 1, g5p2x, g5p2y, g5p2HL, g5p2HL, 255, 0);
            Planet12PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            //Galaxi 6 = soleil pid 27        $gameScreen._pictures[27] = picture 'suny-6'*****************************************
            SoleilG6 = 27; // le soleil pid 27
            g6p1radius = 100; // Galaxi, planet, radius (distance)
            g6p1HL = 4; // Galaxi, planet Hauteur , largeur
            g6p1angle = 0; // galaxi, planet, start angle
            g6p1angleSP = 0.01;
            g6p1x = ($gameScreen._pictures[SoleilG6]._x) + Math.cos(g6p1angle) * g6p1radius; // galaxi, planet, posX
            g6p1y = ($gameScreen._pictures[SoleilG6]._y) + Math.sin(g6p1angle) * g6p1radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-14', 1, g6p1x, g6p1y, g6p1HL, g6p1HL, 255, 0);
            Planet13PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            g6p2radius = 130; // Galaxi, planet, radius (distance)
            g6p2HL = 4; // Galaxi, planet Hauteur , largeur
            g6p2angle = 0; // galaxi, planet, start angle
            g6p2angleSP = 0.01;
            g6p2x = ($gameScreen._pictures[SoleilG6]._x) + Math.cos(g6p2angle) * g6p2radius; // galaxi, planet, posX
            g6p2y = ($gameScreen._pictures[SoleilG6]._y) + Math.sin(g6p2angle) * g6p2radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-15', 1, g6p2x, g6p2y, g6p2HL, g6p2HL, 255, 0);
            Planet14PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            //Galaxi 7 = soleil pid 30        $gameScreen._pictures[30] = picture 'suny-7'*****************************************
            SoleilG7 = 30; // le soleil pid 30
            g7p1radius = 40; // Galaxi, planet, radius (distance)
            g7p1HL = 4; // Galaxi, planet Hauteur , largeur
            g7p1angle = 0; // galaxi, planet, start angle
            g7p1angleSP = 0.01;
            g7p1x = ($gameScreen._pictures[SoleilG7]._x) + Math.cos(g7p1angle) * g7p1radius; // galaxi, planet, posX
            g7p1y = ($gameScreen._pictures[SoleilG7]._y) + Math.sin(g7p1angle) * g7p1radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-16', 1, g7p1x, g7p1y, g7p1HL, g7p1HL, 255, 0);
            Planet15PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            g7p2radius = 50; // Galaxi, planet, radius (distance)
            g7p2HL = 4; // Galaxi, planet Hauteur , largeur
            g7p2angle = 0; // galaxi, planet, start angle
            g7p2angleSP = 0.01;
            g7p2x = ($gameScreen._pictures[SoleilG7]._x) + Math.cos(g7p2angle) * g7p2radius; // galaxi, planet, posX
            g7p2y = ($gameScreen._pictures[SoleilG7]._y) + Math.sin(g7p2angle) * g7p2radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-17', 1, g7p2x, g7p2y, g7p2HL, g7p2HL, 255, 0);
            Planet16PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            LuneG7p2 = NumImageSpace - 1; // LUNE de planette 2 
            g7p3radius = 10; // Galaxi, planet, radius (distance) MOON***
            g7p3HL = 4; // Galaxi, planet Hauteur , largeur
            g7p3angle = 0; // galaxi, planet, start angle
            g7p3angleSP = 0.01;
            g7p3x = ($gameScreen._pictures[LuneG7p2]._x) + Math.cos(g7p3angle) * g7p3radius; // galaxi, planet, posX
            g7p3y = ($gameScreen._pictures[LuneG7p2]._y) + Math.sin(g7p3angle) * g7p3radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-11', 1, g7p3x, g7p3y, g7p3HL, g7p3HL, 255, 0);
            Planet17PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 
            g7p4radius = 100; // Galaxi, planet, radius (distance)
            g7p4HL = 4; // Galaxi, planet Hauteur , largeur
            g7p4angle = 0; // galaxi, planet, start angle
            g7p4angleSP = 0.01;
            g7p4x = ($gameScreen._pictures[SoleilG7]._x) + Math.cos(g7p4angle) * g7p4radius; // galaxi, planet, posX
            g7p4y = ($gameScreen._pictures[SoleilG7]._y) + Math.sin(g7p4angle) * g7p4radius; // galaxi, planet, posY
            $gameScreen.showPicture(NumImageSpace, 'pln-18', 1, g7p4x, g7p4y, g7p4HL, g7p4HL, 255, 0);
            Planet18PID = NumImageSpace; // store ID to Pid picture*
            NumImageSpace++;
            //------------------------------------- 

        } else if (command === 'SpaceplanetRotation') {

            //Permet la rotation des planet
            g1p1x = ($gameScreen._pictures[SoleilG1]._x) + Math.cos(g1p1angle) * g1p1radius; // galaxi, planet, posX
            g1p1y = ($gameScreen._pictures[SoleilG1]._y) + Math.sin(g1p1angle) * g1p1radius; // galaxi, planet, posY	
            //------------------------------------- 
            g1p2x = ($gameScreen._pictures[SoleilG1]._x) + Math.cos(g1p2angle) * g1p2radius; // galaxi, planet, posX
            g1p2y = ($gameScreen._pictures[SoleilG1]._y) + Math.sin(g1p2angle) * g1p2radius; // galaxi, planet, posY
            //------------------------------------- 
            g2p1x = ($gameScreen._pictures[SoleilG2]._x) + Math.cos(g2p1angle) * g2p1radius; // galaxi, planet, posX
            g2p1y = ($gameScreen._pictures[SoleilG2]._y) + Math.sin(g2p1angle) * g2p1radius; // galaxi, planet, posY
            //------------------------------------- 
            g2p2x = ($gameScreen._pictures[SoleilG2]._x) + Math.cos(g2p2angle) * g2p2radius; // galaxi, planet, posX
            g2p2y = ($gameScreen._pictures[SoleilG2]._y) + Math.sin(g2p2angle) * g2p2radius; // galaxi, planet, posY
            //------------------------------------- 
            g3p1x = ($gameScreen._pictures[SoleilG3]._x) + Math.cos(g3p1angle) * (g3p1radius * 2.4); // galaxi, planet, posX
            g3p1y = ($gameScreen._pictures[SoleilG3]._y) + Math.sin(g3p1angle) * g3p1radius; // galaxi, planet, posY
            //------------------------------------- 
            g3p2x = ($gameScreen._pictures[SoleilG3]._x) + Math.cos(g3p2angle) * (g3p2radius * 1.8); // galaxi, planet, posX
            g3p2y = ($gameScreen._pictures[SoleilG3]._y) + Math.sin(g3p2angle) * g3p2radius; // galaxi, planet, posY
            //------------------------------------- 
            g3p3x = ($gameScreen._pictures[LuneG3p2]._x) + Math.cos(g3p3angle) * (g3p3radius * 1.5); // galaxi, planet, posX
            g3p3y = ($gameScreen._pictures[LuneG3p2]._y) + Math.sin(g3p3angle) * g3p3radius; // galaxi, planet, posY
            //------------------------------------- 
            g3p4x = ($gameScreen._pictures[SoleilG3]._x) + Math.cos(g3p4angle) * (g3p4radius * 2); // galaxi, planet, posX
            g3p4y = ($gameScreen._pictures[SoleilG3]._y) + Math.sin(g3p4angle) * g3p4radius; // galaxi, planet, posY
            //------------------------------------- 
            g4p1x = ($gameScreen._pictures[SoleilG4]._x) + Math.cos(g4p1angle) * g4p1radius; // galaxi, planet, posX
            g4p1y = ($gameScreen._pictures[SoleilG4]._y) + Math.sin(g4p1angle) * g4p1radius; // galaxi, planet, posY
            //------------------------------------- 
            g4p2x = ($gameScreen._pictures[SoleilG4]._x) + Math.cos(g4p2angle) * g4p2radius; // galaxi, planet, posX
            g4p2y = ($gameScreen._pictures[SoleilG4]._y) + Math.sin(g4p2angle) * g4p2radius; // galaxi, planet, posY
            //------------------------------------- 
            g5p1x = ($gameScreen._pictures[SoleilG5]._x) + Math.cos(g5p1angle) * g5p1radius; // galaxi, planet, posX
            g5p1y = ($gameScreen._pictures[SoleilG5]._y) + Math.sin(g5p1angle) * g5p1radius; // galaxi, planet, posY
            //------------------------------------- 
            g5p2x = ($gameScreen._pictures[SoleilG5]._x) + Math.cos(g5p2angle) * g5p2radius; // galaxi, planet, posX
            g5p2y = ($gameScreen._pictures[SoleilG5]._y) + Math.sin(g5p2angle) * g5p2radius; // galaxi, planet, posY
            //------------------------------------- 
            g6p1x = ($gameScreen._pictures[SoleilG6]._x) + Math.cos(g6p1angle) * g6p1radius; // galaxi, planet, posX
            g6p1y = ($gameScreen._pictures[SoleilG6]._y) + Math.sin(g6p1angle) * g6p1radius; // galaxi, planet, posY
            //------------------------------------- 
            g6p2x = ($gameScreen._pictures[SoleilG6]._x) + Math.cos(g6p2angle) * g6p2radius; // galaxi, planet, posX
            g6p2y = ($gameScreen._pictures[SoleilG6]._y) + Math.sin(g6p2angle) * g6p2radius; // galaxi, planet, posY
            //------------------------------------- 
            g7p1x = ($gameScreen._pictures[SoleilG7]._x) + Math.cos(g7p1angle) * g7p1radius; // galaxi, planet, posX
            g7p1y = ($gameScreen._pictures[SoleilG7]._y) + Math.sin(g7p1angle) * g7p1radius; // galaxi, planet, posY
            //------------------------------------- 
            g7p2x = ($gameScreen._pictures[SoleilG7]._x) + Math.cos(g7p2angle) * g7p2radius; // galaxi, planet, posX
            g7p2y = ($gameScreen._pictures[SoleilG7]._y) + Math.sin(g7p2angle) * g7p2radius; // galaxi, planet, posY
            //------------------------------------- 
            g7p3x = ($gameScreen._pictures[LuneG7p2]._x) + Math.cos(g7p3angle) * g7p3radius; // galaxi, planet, posX
            g7p3y = ($gameScreen._pictures[LuneG7p2]._y) + Math.sin(g7p3angle) * g7p3radius; // galaxi, planet, posY
            //------------------------------------- 
            g7p4x = ($gameScreen._pictures[SoleilG7]._x) + Math.cos(g7p4angle) * g7p4radius; // galaxi, planet, posX
            g7p4y = ($gameScreen._pictures[SoleilG7]._y) + Math.sin(g7p4angle) * g7p4radius; // galaxi, planet, posY
            //------------------------------------- 

            NumImageSpace = 10 + (NumGalaxi.length * 3);
            $gameScreen.movePicture(NumImageSpace, 1, g1p1x, g1p1y, g1p1HL, g1p1HL, 255, 0, GalaxiWaitD[0]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g1p2x, g1p2y, g1p2HL, g1p2HL, 255, 0, GalaxiWaitD[0]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g2p1x, g2p1y, g2p1HL, g2p1HL, 255, 0, GalaxiWaitD[1]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g2p2x, g2p2y, g2p2HL, g2p2HL, 255, 0, GalaxiWaitD[1]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g3p1x, g3p1y, g3p1HL, g3p1HL, 255, 0, GalaxiWaitD[2]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g3p2x, g3p2y, g3p2HL, g3p2HL, 255, 0, GalaxiWaitD[2]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g3p3x, g3p3y, g3p3HL, g3p3HL, 255, 0, GalaxiWaitD[2]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g3p4x, g3p4y, g3p4HL, g3p4HL, 255, 0, GalaxiWaitD[2]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g4p1x, g4p1y, g4p1HL, g4p1HL, 255, 0, GalaxiWaitD[3]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g4p2x, g4p2y, g4p2HL, g4p2HL, 255, 0, GalaxiWaitD[3]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g5p1x, g5p1y, g5p1HL, g5p1HL, 255, 0, GalaxiWaitD[4]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g5p2x, g5p2y, g5p2HL, g5p2HL, 255, 0, GalaxiWaitD[4]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g6p1x, g6p1y, g6p1HL, g6p1HL, 255, 0, GalaxiWaitD[5]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g6p2x, g6p2y, g6p2HL, g6p2HL, 255, 0, GalaxiWaitD[5]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g7p1x, g7p1y, g7p1HL, g7p1HL, 255, 0, GalaxiWaitD[6]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g7p2x, g7p2y, g7p2HL, g7p2HL, 255, 0, GalaxiWaitD[6]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g7p3x, g7p3y, g7p3HL, g7p3HL, 255, 0, GalaxiWaitD[6]);
            NumImageSpace++;
            $gameScreen.movePicture(NumImageSpace, 1, g7p4x, g7p4y, g7p4HL, g7p4HL, 255, 0, GalaxiWaitD[6]);
            NumImageSpace++;
            if (GalaxiWaitD[2] > 1) {
                GalaxiWaitD[2]--;
            } //diminu le wait time a modifier si plus grand que un et plsu petit que 25
            //Vitesse de rotation
            g1p1angle += g1p1angleSP;
            g1p2angle += g1p2angleSP;
            g2p1angle += g2p1angleSP;
            g2p2angle += g2p2angleSP;
            g3p1angle += g3p1angleSP;
            g3p2angle += g3p2angleSP;
            g3p3angle += g3p3angleSP;
            g3p4angle += g3p4angleSP;
            g4p1angle += g4p1angleSP;
            g4p2angle += g4p2angleSP;
            g5p1angle += g5p1angleSP;
            g5p2angle += g5p2angleSP;
            g6p1angle += g6p1angleSP;
            g6p2angle += g6p2angleSP;
            g7p1angle += g7p1angleSP;
            g7p2angle += g7p2angleSP;
            g7p3angle += g7p3angleSP;
            g7p4angle += g7p4angleSP;
        } else if (command === 'Bindspaceplanet') {
            //Bind les planet pendant zoom galaxi
            //  $gameScreen._pictures[Planet5PID] $gameScreen.picture(35)._originX =
            switch (args[0]) {
                case 'Galaxi1':
                    //code here
                    break;
                case 'Galaxi2':
                    //code here
                    break;
                case 'Galaxi3':
                    //Galaxi 3
                    this.bindPictureToMap(Planet5PID, 1, 'above_characters');
                    var TMp1x = (($dataMap.events[3].x) * 48) + Math.cos(g3p1angle) * (g3p1radius * 2.5); // galaxi, planet, posX
                    var TMp1y = (($dataMap.events[3].y) * 48) + Math.sin(g3p1angle) * g3p1radius; // galaxi, planet, posY
                    $gameScreen.picture(Planet5PID)._originX = TMp1x;
                    $gameScreen.picture(Planet5PID)._originY = TMp1y;
                    this.bindPictureToMap(Planet6PID, 1, 'above_characters');
                    var TMp2x = (($dataMap.events[3].x) * 48) + Math.cos(g3p2angle) * (g3p2radius * 1.1); // galaxi, planet, posX
                    var TMp2y = (($dataMap.events[3].y) * 48) + Math.sin(g3p2angle) * g3p2radius; // galaxi, planet, posY
                    $gameScreen.picture(Planet6PID)._originX = TMp2x;
                    $gameScreen.picture(Planet6PID)._originY = TMp2y;
                    this.bindPictureToMap(Planet7PID, 1, 'above_characters');
                    var TMp3x = (($dataMap.events[3].x) * 48) + Math.cos(g3p3angle) * (g3p3radius * 1.2); // galaxi, planet, posX
                    var TMp3y = (($dataMap.events[3].y) * 48) + Math.sin(g3p3angle) * g3p3radius; // galaxi, planet, posY
                    $gameScreen.picture(Planet7PID)._originX = TMp3x;
                    $gameScreen.picture(Planet7PID)._originY = TMp3y;
                    this.bindPictureToMap(Planet8PID, 1, 'above_characters');
                    var TMp4x = (($dataMap.events[3].x) * 48) + Math.cos(g3p4angle) * (g3p4radius * 2.2); // galaxi, planet, posX
                    var TMp4y = (($dataMap.events[3].y) * 48) + Math.sin(g3p4angle) * g3p4radius; // galaxi, planet, posY
                    $gameScreen.picture(Planet8PID)._originX = TMp4x;
                    $gameScreen.picture(Planet8PID)._originY = TMp4y;
                    break;
                case 'Galaxi4':
                    //code here
                    break;
                case 'Galaxi6':
                    //code here
                    break;

            }



        }



    }


})();
 
Last edited by a moderator:

Latest Threads

Latest Profile Posts

Climbing to the top #mapping
1638160732198.png
I've started the first steps of the final few maps that I need to make for B:ms. I haven't been able to say that in a really, really long time. It'd probably be a good idea to blog about this or something.
Question for the Mods: What am I supposed to do when I can't make a synopsis 350 words long? (for project recruitment thread) @Shaz @mlogan
The game is meant to be more on the simple side in order to be achievable so I'm a bit stuck...
Had a nice visit with our family. Dad grilled some burgers and mom made baked beans and fudge. We also watched Foul Play. Chevy Chase and Goldie Hawn make an awesome duo. I am surprised how much of the movie I forgot LOL. How did everyone else's holidays go?

Forum statistics

Threads
117,043
Messages
1,104,066
Members
152,981
Latest member
FromVillage
Top