Game Development Reference
In-Depth Information
The Draw GUI event draws to the GUI layer of the screen. The GUI layer is drawn after
everything else on the screen, which means it will always be on top. Therefore, other in-
stances won't overlap or go on top of the text that we've drawn unless they too have a
draw GUI event and lower depth value. The GUI layer is also independent of views,
which means, even if a view moves, everything drawn to the GUI layer will appear in the
same position on the screen.
We are going to use the draw_text function to draw text to the screen. We are also go-
ing to use the string function to convert our score variable into a string so we can add it
to the text we've drawn.
Here is the code:
draw_text(64,64,"Score: "+string(S));
We start off with the function's name, draw_text . Next, we have our x and y positions
from where we want to draw the text on the GUI layer. For this, set 64 on the x axis and
Search WWH ::




Custom Search