0
\$\begingroup\$

Image of the game on a mobile phone:

enter image description here

As you can see the maze (draw event) has been resized correctly.

But the yellow post-it (draw GUI event) has not been scaled or displayed in the correct location (center of the screen). Same thing with GUI layout (draw GUI event).

Because this is a small stage/room (size) I do not use the artifice of views, I thought that could be because of that the problem, but I enabled the views and did not get any different result.

enter image description here

Picture of the game on a computer (like it should be on the phone):

enter image description here

OBS - One information that can help you to help me solve the problem, is that to draw the post- it I use the following code: draw GUI event draw_sprite(spr_Post,0,640,360);.

640 is the half screen width of the game and also the room, 360 is half the height of the game screen and also the room.

It seems that somehow the room on the cell phone is different size than 1280x720.

I do not put the following code: draw GUI event draw_sprite(spr_Post,0,room_width/2,room_height/2), because there are much larger phases that need views, so the post-it needs to be in the center of the screen of the player, and with this code it ends up being in the center of the phase.

I tested the game on Bluestacks and it did not happen the same as on the phone.

\$\endgroup\$
1
  • \$\begingroup\$ This sounds like a game maker bug. I would send an email to yoyogames asking for more details. \$\endgroup\$
    – user64742
    Commented Dec 28, 2018 at 4:42

2 Answers 2

0
\$\begingroup\$

Here I am again to the rescue XD

Instead of using room_width or room_height that are the size of the room, use the size of the view, the variables are view_xview, view_yview, view_wview and view_hview that are related to the current view so use the index [0] with the number of the view on all variables.

draw_sprite(sprite_index, view_xview[0]+view_wview[0]/2, view_yview[0]+view_hview[0]/2);

It will make the object origin to be in the center of the screen/view.

Edit: The Draw_GUI event is relative to the view coordinate system. Edit2: added some code to try

Check them in the manual to see examples.

\$\endgroup\$
5
  • \$\begingroup\$ I changed the code to draw_sprite(spr_Post,0,view_wview[view_object]/2,view_hview[view_object]/2); and did not change the result. \$\endgroup\$ Commented Feb 18, 2019 at 13:47
  • \$\begingroup\$ Before I tried with the number of the vision, but also with no result. \$\endgroup\$ Commented Feb 18, 2019 at 13:48
  • \$\begingroup\$ I've added some code, it is typically used to fix healthbars to the view \$\endgroup\$
    – Juanpa
    Commented Feb 18, 2019 at 15:41
  • \$\begingroup\$ For me it worked as follows: display_set_gui_size(1280,720);. In the next line just put: draw_sprite(spr_Post,0,640,360); \$\endgroup\$ Commented Feb 19, 2019 at 12:35
  • \$\begingroup\$ @BonecoSinforoso If that worked for you, please consider sharing it as an answer that you can mark Accepted. \$\endgroup\$
    – DMGregory
    Commented Mar 20, 2019 at 16:56
0
\$\begingroup\$

What worked for me was this:

(Draw GUI Event)

display_set_gui_size(1280,720);
draw_sprite(spr_Post,0,640,360);

Reference:

https://docs.yoyogames.com/source/dadiospice/002_reference/windows%20and%20views/display_set_gui_size.html

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .