08.11.2012 Views

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

can also assign an instance id to this variable. In that case the particular<br />

instance is followed.<br />

Note that the size of the image on the screen is decided based on the visible views at the<br />

beginning of the room. If you change views during the game, they might no longer fit on the<br />

screen. The screen size though is not adapted automatically. So if you need this you have to<br />

do it yourself, using the following functions:<br />

window_set_region_size(w,h,adaptwindow) Set the width and height<br />

of the drawing region in the window. adaptwindow indicates whether the<br />

window size must be adapted if the region does not fit in. The window size will<br />

always be adapted if you use fixed scaling. (See the function<br />

window_set_region_scale().)<br />

window_get_region_width() Returns the current width of the drawing<br />

region.<br />

window_get_region_height() Returns the current height of the drawing<br />

region.<br />

In a game you often need the position of the mouse cursor. Normally you use for this the<br />

variables mouse_x and mouse_y. When there are multiple views, these variables give the<br />

mouse position <strong>with</strong> respect to the view the mouse is in. Sometimes though, you might need<br />

the mouse position <strong>with</strong> respect to a particular view, also when it is outside that view. For this<br />

the following functions exist.<br />

window_view_mouse_get_x(id) Returns the x-coordinate of the mouse<br />

<strong>with</strong> respect to the view <strong>with</strong> index id.<br />

window_view_mouse_get_y(id) Returns the y-coordinate of the mouse<br />

<strong>with</strong> respect to the view <strong>with</strong> index id.<br />

window_view_mouse_set(id,x,y) Sets the position of the mouse <strong>with</strong><br />

respect to the view <strong>with</strong> index id.<br />

window_views_mouse_get_x() Returns the x-coordinate of the mouse <strong>with</strong><br />

respect to the view it is in (same as mouse_x).<br />

window_views_mouse_get_y() Returns the y-coordinate of the mouse <strong>with</strong><br />

respect to the view it is in (same as mouse_y).<br />

window_views_mouse_set(x,y) Sets the position of the mouse <strong>with</strong><br />

respect to the first view that is visible.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!