Following room view

From GMpedia.org Wiki

Jump to: navigation, search

[edit] The Question

The view of the room constantly changes, how can I get the x and y coordinates to be able to draw health bars in constantly changing views, or making objects follow the screen's view no matter where it goes to?

[edit] The Answer

For Game Maker 5.x you can use:

view_left[0]+# for the x-coordinate, # being the x value relative to the view position. view_top[0]+# for the y-coordinate, # being the y value relative to the view position.

For Game Maker 6.x you can use:

view_xview[0]+# for the x-coordinate, # being the x value relative to the view position. view_yview[0]+# for the y-coordinate, # being the y value realtive to the view position.

Please note that the [0] is used when the view used has the ID of 0, change the "0" to the view's id if isn't 0.

Personal tools