I'm currently making a type of simulator game for a school project but I just only realize a week ago that RPG MV doesn't use float but rather var data type. So, If anyone would like to help me advise on making a simple decimal display. (Percentage as well, hihihi ) It would be very much helpful
Game_Variables.prototype.setValue = function(variableId, value) {
if (variableId > 0 && variableId < $dataSystem.variables.length) {
if (typeof value === 'number') {
value = Math.floor(value);
}
this._data[variableId] = value;
this.onChange();
}
};
while the other is this;
Game_Variables.prototype.setValue = function(variableId, value) {
if (variableId > 0 && variableId < $dataSystem.variables.length) {
if (typeof value === 'number') {
value = value.toFixed(2);
}
this._data[variableId] = value;
this.onChange();
}
};
I tried using my variables and I observe that in value.toFixed(2) setting a choice that has a controlled variable like #0007 += 1 to choices that are correct they don't add up as 6 (assuming you've answered 6 questions correctly). It always goes 1.00111111. But in the original, the Math.floor(value); It displays 6 correct answers.
The thing is I really need to calculate for decimals and then turn it into percentages as well as display it properly but if the logic ain't matching up on the correct answers then my quiz game won't work well
P.S the attached image is just the concept on what the game my group is developing
Game_Variables.prototype.setValue = function(variableId, value) {
if (variableId > 0 && variableId < $dataSystem.variables.length) {
if (typeof value === 'number') {
value = Math.floor(value);
}
this._data[variableId] = value;
this.onChange();
}
};
while the other is this;
Game_Variables.prototype.setValue = function(variableId, value) {
if (variableId > 0 && variableId < $dataSystem.variables.length) {
if (typeof value === 'number') {
value = value.toFixed(2);
}
this._data[variableId] = value;
this.onChange();
}
};
I tried using my variables and I observe that in value.toFixed(2) setting a choice that has a controlled variable like #0007 += 1 to choices that are correct they don't add up as 6 (assuming you've answered 6 questions correctly). It always goes 1.00111111. But in the original, the Math.floor(value); It displays 6 correct answers.
The thing is I really need to calculate for decimals and then turn it into percentages as well as display it properly but if the logic ain't matching up on the correct answers then my quiz game won't work well
P.S the attached image is just the concept on what the game my group is developing