MartinK12
Member
Hi guys,
I'm playing with the tutorial for GMS2 and I added to the game obj_pausemenu with this code:
1. In the CREATE event:
2. In the DRAW event:
That is the only code in this object and it does what is suppose to do except draw_sprite. When I don’t move the camera view it is drawn perfectly, but when I move camera to the right it looks like it's still at 0,0 coordinates of the room. But this code works fine with:
draw_text
or even with every sprite from game ie.:
draw_sprite(spr_player
They are drawn regardless of the camera view exactly in the view where I want them. What am I doing wrong with this pausebackground sprite?
I think I’ve tried everything: different codes from net, step event, draw GUI events etc. And every time the same - I can draw text and normal game sprites wherever I want them but I can’t draw this pausebackground sprite in the wanted location.
I appreciate any help bcs after few hours of tries I’m really tired with this code
EDIT:
I managed to do this another way.
I'm playing with the tutorial for GMS2 and I added to the game obj_pausemenu with this code:
1. In the CREATE event:
Code:
pause = 0;
Code:
var camx = camera_get_view_x(view_camera[0]);
var camy = camera_get_view_y(view_camera[0]);
var camw = camera_get_view_width(view_camera[0])
var camh = camera_get_view_height(view_camera[0])
if ((keyboard_check_pressed(ord("P")))) and pause=0
{
pausebackground = sprite_create_from_surface(application_surface,camx,camy,camw,camh,false,false,0,0);
pause = 1;
instance_deactivate_all(true);
}
else if ((keyboard_check_pressed(ord("P")))) and pause=1
{
sprite_delete(pausebackground);
pause = 0;
instance_activate_all();
}
if (pause=1)
{
var cam2x = camera_get_view_x(view_camera[0])
var cam2y = camera_get_view_y(view_camera[0])
draw_sprite(pausebackground,1,cam2x,cam2y);
draw_text(camx,camy,"PAUSE MENU");
}
draw_text
or even with every sprite from game ie.:
draw_sprite(spr_player
They are drawn regardless of the camera view exactly in the view where I want them. What am I doing wrong with this pausebackground sprite?
I think I’ve tried everything: different codes from net, step event, draw GUI events etc. And every time the same - I can draw text and normal game sprites wherever I want them but I can’t draw this pausebackground sprite in the wanted location.
I appreciate any help bcs after few hours of tries I’m really tired with this code
EDIT:
I managed to do this another way.
Last edited: