I recently recieved a question about how to draw the score on the screen. I'd like to make it a little more general though, how do you draw a variable? Because the score, that most of the new beginners know only as score, is a so called built-in variable. It is initialized at the start of the program no matter what, and that is why it will be marked in blue in your code editor. Drawing this value is the same as drawing a variable. That is what I will show...
Yet again, this is the same as drawing a variable, therefore;
draw_text(x,y,string(score));
draw_text is a function, and x, y, and string are the arguments. When you use a function there are a few things to consider, but most important of them all is the event. If your intention is to draw something on the screen, then draw event should be used. No matter what. You should also consider variables, constants and settings related to the function, but this is no problem in this case.
draw_text however do need to be placed in draw event. Read more about the function itself in the Game Maker manual.
Why string(score)? Look here:
http://gmtutorials.com/article/easy/cannot-compare-arguments/1/
.
Users logged in:
Comments
Loading comments...