• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Points jump to 1640 at the start of a room?

J

Joshua Hotchin

Guest
Hey guys,
So I have a shop and points feature in my game.

When the player kills enemies he gets points depending on what type of enemy!
You get ** points per level which reset if you die or leave the level.
When you move to the next level is when the points from your current level get added to your points total.
However it doesn't work!
Your points get set to 1640 and I have no clue why, I have never written that in any of the code for this game.

Drawing the points
Code:
xval = 250;

if (global.points >= 1) and (room != rMenu) and (room != rControls) and (room != rUpdatesAndNotes) and (room != rShop) and (room != rEnding) and (room != rCredits)
{
    DrawSetText(c_black, fMenu, fa_right, fa_top)
    draw_text(xval+2,48+2,string(global.points) + string(" points"));
    draw_set_colour(c_white);
    draw_text(xval,48,string(global.points) + string(" points"));
}

if (global.pointsthisroom >= 1)
{
    DrawSetText(c_black, fMenu, fa_right, fa_top)
    draw_text(xval+2,12+2,string(global.pointsthisroom) + string(" points this level"));
    draw_set_colour(c_white);
    draw_text(xval,12,string(global.pointsthisroom) + string(" points this level"));
}
When the player moves to the next level
Code:
global.points = global.points + global.pointsthisroom
If the player dies during the level
Code:
global.pointsthisroom = 0;
When the room starts
Code:
global.pointsthisroom = 0;
 

TsukaYuriko

☄️
Forum Staff
Moderator
Please post all code, including the full context (object, event, script, script call in object and event), where points are added. I'd place my bets on something like points being added when an enemy is destroyed and destroying them at room end, but there's no way to tell for sure.
 
Top