Sign up ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have drawn everything needed to the screen including a HUD for the score, but I have my room set to follow my player: When the camera follows the player, the score HUD stays doesn't scroll with him!

How do I make the score display follow along with the player also?

share|improve this question

migrated from Apr 26 '13 at 1:55

This question came from our site for passionate videogamers on all platforms.

3 Answers 3

You'll have to set the score position relative to the view position every update event.

Some basic pseudo code from what I remember of GML.

    score.x = view[0].x + 15;
    score.y = view[0].y + 15;

You can do something similar with the drag and drop interface, but I haven't touched GameMaker for years so I can't help you with that.

share|improve this answer
I think there is an option "relative to view" when you inspect the object in the room. Not sure though, been a few years for me as well (even before YoYo took over). – Kevin Apr 26 '13 at 12:48
There's a new Draw GUI event that would be worth looking into: It would take care of doing all that relative stuff for you – Jeff May 21 '13 at 23:33

I added this to event draw, of the object Score and it worked for me

x= view_xview[0] + 320;
y= view_yview[0];
draw_text(x, y, (score));
share|improve this answer
Welcome to GD.SE, Simon! Looking at your code, it's not obvious what everything actually does - for example, why is 320 added to view_xview[0]? It'd be great if you could edit your answer to explain your code. – Polar May 23 '14 at 18:33

@Simon was pretty close.

If you are trying to draw relative to the View that is Enabled you can use view_xview[view_current], view_yview[view_current].

For most situations you can get away with using view_xview[0] because most games do not utilize multiple views.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.