• 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!

GML Visual Drawing Ending Score - Help

M

Micnasr

Guest
Hey guys. I've been developing a small game and managed to get it to work with the "built in variable" "score".
I did powerups and all of these things. But when you die in game, I want the score to appear on the death screen. The score is in the player object and I created another obj_score for the ending one. I managed to make it draw when you die but it keeps showing: Score: 0 instead of actually showing the score. Please tell me how to make it work.

Please leave constructive feedback.
Regards,
Micnasr
 

jobjorgos

Member
what object has influence on the value of 'score'?

don't forget score is a local variable.

In case u have multiple objects that have influence on score there are two ways to solve this.

1. reprogram it on a way everthing that has to do with score is done in obj_score and no else where.
Then you can choose for example that obj_score only draws the score once there is no instance of obj_player anymore.

2. use a global variable for score. Then there are not seperate scores for each instance but 1 shared score variable.
This can be done by executing scripts like these for example:
Code:
global.score = 0;
Code:
global.score += 1;
Code:
global.score -= 1;
Code:
draw_text(20,20,global.score);
 
M

Micnasr

Guest
what object has influence on the value of 'score'?

don't forget score is a local variable.

In case u have multiple objects that have influence on score there are two ways to solve this.

1. reprogram it on a way everthing that has to do with score is done in obj_score and no else where.
Then you can choose for example that obj_score only draws the score once there is no instance of obj_player anymore.

2. use a global variable for score. Then there are not seperate scores for each instance but 1 shared score variable.
This can be done by executing scripts like these for example:
Code:
global.score = 0;
Code:
global.score += 1;
Code:
global.score -= 1;
Code:
draw_text(20,20,global.score);
is it possible to translate in Drag and Drop language pls?
 

Perseus

Not Medusa
Forum Staff
Moderator
don't forget score is a local variable.
No, it's not. score is a global variable that gets used when working with the corresponding D&D actions.

is it possible to translate in Drag and Drop language pls?
Please post what you've already got, so that we know how things are being handled. Nobody would like to throw random suggestions at you.

Also, please wait for at least 48 hours before posting twice in a row and use the Edit button to add more information.
 

jobjorgos

Member
I guess you are using game maker studio 2.
In drag and drop u have to go to 'Common' and then select 'Assign Variable'. U can choose now to fill in a name and number.

If you want the score to increase with 1, you can fill in the name as global.score and the value as +1

if you want to draw a score you can make a draw event and give it the action 'draw value' in the drawing section. dont fill any number as value, just fill in global.score.

Dont forget to set the value of global.score to 0 (or whatever your default score is) in a create event in the start of the game to prevent errors.

EDIT: oh my bad I didnot know score is a global variable. Then just ignore what I said.
 
Top