Good Idea Games‎ > ‎

Dev Journal: Time Throttle 8, Drawing the HUD

posted Oct 10, 2017, 12:13 AM by Good Idea Games
There is no shortage of tutorials for Game Maker, but every project is different, so not all tutorials will work.

I'm working off of This lovely tutorial, which mostly worked, except I am also using NAL's Multiple-Object-Camera, which means my view window is always changing.
So fortunately I found this post on Reddit, which described my situation, without giving me a solution.

Long story short, my game has a view window of 1024x768, so I can hard-code my GUI elements to fit that screen.

//Player 1 HUD Data
draw_sprite(ui_top_left_spr, 1,0,0);

//Player 2 HUD Data
draw_sprite(ui_top_right_spr, 1,1024,0);

//Player 3 HUD Data
draw_sprite(ui_bottom_left_spr, 1,0,768);

//Player 4 HUD Data
draw_sprite(ui_bottom_right_spr, 1,1024,768);

//Top Center HUD
draw_sprite(ui_top_center_spr, 1,(512),0);

//Bottom Center HUD
draw_sprite(ui_bottom_center_spr, 1,512,768);

Next Step is to draw player score data in a layer on top of the UI elements...
A little bit of Trial and Error, and I found the x,y positions of the little screens on my UI elements, and I could place my score text...

//Draw Player 1 score

... use your imagination for the other player scores.

This worked out perfectly, bringing me to my next step: Tracking player scores.

I have a player_parent object, that contains a set of score and statistics variables that the player_objects inherit. 

I went to the cannon_ball object, and created a step to handle what happens when the cannonball touches a player object. This did not go smoothly, but once again, Google saves the day. And this one helped too...

But then I hit a snag, and spent about 2 hours just trying to get the scores to display on the screen.
Now it's bed time, but I got a lot done today.