Legacy GM Creating an object that will lock to a room window (similar to draw_sprite)?

R

RATInteractive

Guest
I have a pause menu which pops up creating a bunch of object when triggered. although no my rooms move and this will no longer work.

how can i create an object thatll stay centered in a room no matter where the player is in the room
 

Mornedil

Member
does this work for objects?
Yes. basically, instead of this:
Code:
instance_create(200, 100, object);
you would do this:
Code:
instance_create(view_xview[0]+200, view_yview[0]+100, object);
assuming your view is not moving while paused, otherwise you'll need to update the X and Y position continuously.
 

TheouAegis

Member
If the view is moving automatically (you're letting GM handle it), then set the object's position to (view_xview + a, view_yview + b) in the Begin Draw event.
If you are controlling the view yourself (using code to move the view), then set the object's position to (view_xview + a, view_yview + b) in the End Step event.
 
Top