RPG Maker Forums

hi


am try to understand a basic notion in JavaScript.
If somebody has some clarification.


if i has this.


//example: i have storing a default permanente array value with a constructor in: $gameSystem.huds.hudsSlot.default = [10,5];
console.log($gameSystem.huds.hudsSlot.default); // return me [10,5]; is nice

//now in a context, i need to store this value in temps var to do some stuff
var test = $gameSystem.huds.hudsSlot.default;
console.log(test): // return me [10,5]; is nice

// but after, if i do
test[0]++;
// or
test[0]+=1;

console.log(test[0]); // return me 11 ( is ok ) !
//But why
console.log($gameSystem.huds.hudsSlot.default) // return me 11 ??????
// why test[0]++; or test[0]+=1; increase my objets $gameSystem.huds.hudsSlot.default ???
// why increase my var test[0] increase $gameSystem.huds.hudsSlot.default[0] in same time ?


thanks a lot for help me


my full context is thats 

my call constructor at boot game



$gameSystem.huds = new huds(); // build the $gameSystem +


and


the builder function call



/*=============================================================================
* BUILD HUDS INTEGRER (not the menue)
=============================================================================*/
// parrent call from $gameSystem.huds = new HUDS();
function huds() {
this.status = false; // tous les huds visible ou non ? supprime tous image
this.modeCine = false // function qui passe en mode cinema
this.hudstates = new hudstates();
this.hudsSlot = new hudsSlot();
}
//sub from parent
//-----------------------------------------------------------------------------
// le huds des stats -----------------
function hudstates() {
this.status = false; // si visible ou non ?
}
// le huds des itemdice.. hudsSlot -------------------
// $gameSystem.huds.hudsSlot
function hudsSlot() {
this.PIDdebug = [15,47]; // static
this.status = false; // si visible ou non ?
this.XY = [25,0]; // default x y screen // change selon les mode de this.movemode
this.easing = []; // store ici tous les processus de easing
this.SlotXY = [[this.XY[0]+37,this.XY[1]+101],[this.XY[0]+37,this.XY[1]+207],[this.XY[0]+37,this.XY[1]+313],[this.XY[0]+37,this.XY[1]+420],[this.XY[0]+37,this.XY[1]+530],
[this.XY[0]+147,this.XY[1]+101],[this.XY[0]+147,this.XY[1]+207],[this.XY[0]+147,this.XY[1]+313],[this.XY[0]+147,this.XY[1]+420],[this.XY[0]+147,this.XY[1]+530]]; // position des 10 slot item,dice default
this.movemode = function(mode) { if (mode==='default') {this.XY = [25,0]; return this.XY}else if (mode==='tuto') {this.XY = [150,20]; return this.XY}else if (mode==='combat') {this.XY = [25,50]; return this.XY}else if (mode==='hide') {this.XY = [-200,0]; return this.XY} } // defeni this.XY sur le bon mode et return linformation
this.slots = []; // initialise build .slot
for (var s =0; s<10; s++) { this.slots = new slots() } // les sub slot du jeux, 10 max
}
// $gameSystem.huds.hudsSlot.slots[]
function slots(id) {
this.pintype = null; // un slot est piner ? si oui quel type ?
this.idcontent = 1; // si contient un id item ?

}


_______________________________________________________________________


After if i try stuff ex:

Code:
var x = $gameSystem.huds.hudsSlot.PIDdebug //
console.log(x); // return me [25,0];

// but if i do after 
x[0]++;

// the  $gameSystem.huds.hudsSlot.PIDdebug[0]  are increase
//but $gameSystem.huds.hudsSlot.PIDdebug[0] are supose to be static ?!

//What I would like. Did I get it wrong?











Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top