[solved] Help! Making Score Follow View Vertically

D

deadant88

Guest
Hi all,

I have been searching for hours, tried 3 or 4 diff tutorials, scoured the forums/reddit/stack exchange, the GMS 2 manual and the GMS tutorials.

I am trying to program the score object to remain on screen while the player object moves upwards on a level but it always remains static.

Here is my code draw event code for my score object:

var cx = camera_get_view_x(view_camera[0]);
var cy = camera_get_view_y(view_camera[0]);
var cw = camera_get_view_width(view_camera[0]);

draw_text(cx + (cw / 2), cy + 1950, string(thescore));

Here is my create event for obj_score

thescore = 0

Can anyone help me achieve this?

Thanks you!
 

Alexx

Member
It would be easier to place this in a Draw GUI Event.
Just use:
Code:
draw_text(x,y,thescore);
where are x and y are the locations you wish to draw at.
This will draw independent of any view.
 
D

deadant88

Guest
It would be easier to place this in a Draw GUI Event.
Just use:
Code:
draw_text(x,y,thescore);
where are x and y are the locations you wish to draw at.
This will draw independent of any view.
Thanks so much for your reply Alexx. I have done what you suggested but the score is now not showing up at all on the view. I have copied the code and tried it as a draw event and it showed up, but when I tried again in draw gui ... no dice. I have tried putting in a range of different x, y coordinates but it still doesn't show up.

If it makes any difference the dimensions of the room are 1024 x 2000, I am trying to make a tall game. This may not be the most optimal way to structure my level, so am happy to get feedback on that as well.

Cheers
 
You Are Using The Room Width And Hight ... Big OOPS.

use The View Width And Height in the " Draw Gui Event."

Code:
draw_text(32,32, "TEXT GOES HERE");
 
D

deadant88

Guest
Omg NightOwlGame
You Are Using The Room Width And Hight ... Big OOPS.

use The View Width And Height in the " Draw Gui Event."

Code:
draw_text(32,32, "TEXT GOES HERE");
You sir, are my absolute hero. Thank you very much for your help.
 
Top