FeliX Games
Member
I have an object oController with:
-> Create Event:
-> Step Event:
I also have an object oButton with:
-> Create Event:
-> Step Event:
-> Left Released Event:
All oButton objects Creation Codes contain this:
NOTE: There is no Room Creation Code.
I created an object to display the values of global.level, global.exp, and global.exp_till_next_level to check and debug the values.
I noticed something extremely weird going on with the global.exp value. I have it set to 0, but when I run the program it displays its value as 206.
This is a huge problem because it's causing global.level to increase infinitely which I obviously don't want.
Any help is appreciated and I hope this is just a bug, and that it can be fixed!
Thanks for reading!
- FeliX
-> Create Event:
GML:
/// @description player stats
global.level = 1;
global.exp = 0;
global.exp_till_next_level = global.level * 10;
global.player_hp = global.level + 100;
global.player_dmg = global.level + 10;
GML:
/// @description control player stats
// level up player
if (global.exp >= global.exp_till_next_level)
{
var exp_remaining = global.exp % global.exp_till_next_level;
global.exp = exp_remaining;
global.level += 1;
}
-> Create Event:
GML:
/// @description
isEnemy = false;
enemy_hp = (global.level * 1.5) + 50;
// default button values
image_speed = 0;
image_index = 0;
action = noone;
text = "N/A";
GML:
/// @description
// if the button is considered an enemy and its below or at 0 hp, destory self.
if (self.isEnemy == true)
{
if (self.enemy_hp <= 0)
{
global.exp += 5;
instance_destroy(self);
}
}
GML:
/// @description button actions
switch (action)
{
case 0: // deal damage to the pressed button.
self.enemy_hp -= global.player_dmg;
break;
}
GML:
text = "Enemy";
action = 0;
isEnemy = true;
I created an object to display the values of global.level, global.exp, and global.exp_till_next_level to check and debug the values.
I noticed something extremely weird going on with the global.exp value. I have it set to 0, but when I run the program it displays its value as 206.
This is a huge problem because it's causing global.level to increase infinitely which I obviously don't want.
Any help is appreciated and I hope this is just a bug, and that it can be fixed!
Thanks for reading!
- FeliX