GameMaker Instance Create based on Viewpoints

This seems simple and yet I can't find anything about it. Is there a way to create an instance based on coordinates of a viewpoint? Say I have a room a few screens wide yet no matter where I am I want to create an object in the middle of my viewpoint? Is this possible or can I only draw things this way using draw GUI?

Thanks!
 

samspade

Member
Yes, you just want to add your view's x and y position to your other coordinates. So for example, if your view is 500 x 500 and you want it to be in the center of your view, you would create it at view x + 250 and view y + 250. How you get your view x and y changes based on whether you are using GM 1 or 2. In 2 it is: camera_get_view_x(camera_id) and camera_get_view_y(camera_id). See the manual for more details of course.
 
Yes, you just want to add your view's x and y position to your other coordinates. So for example, if your view is 500 x 500 and you want it to be in the center of your view, you would create it at view x + 250 and view y + 250. How you get your view x and y changes based on whether you are using GM 1 or 2. In 2 it is: camera_get_view_x(camera_id) and camera_get_view_y(camera_id). See the manual for more details of course.
So what would the camera id be? All I have right now is a viewpoint enabled so I can test things
 
Top