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.

instance_activate_all();<br />

instance_deactivate_region(view_xview[0],view_yview[0],<br />

view_wview[0],view_hview[0],false,true);<br />

}<br />

In practice you might want to use a region slightly larger than the view.<br />

Timing<br />

Good games require careful timing of things happening. Fortunately <strong>Game</strong> <strong>Maker</strong> does most of<br />

the timing for you. It makes sure things happen at a constant rate. This rate is defined when<br />

defining the rooms. But you can change it using the global variable room_speed. So for<br />

example, you can slowly increase the speed of the game, making it more difficult, by adding a<br />

very small amount (like 0.001) to room_speed in every step. If your machine is slow the game<br />

speed might not be achieved. This can be checked using the variable fps that constantly<br />

monitors the actual number of frames per second. Finally, for some advanced timing you can<br />

use the variable current_time that gives the number of milliseconds since the computer was<br />

started. Here is the total collection of variables available (only the first one can be changed):<br />

room_speed Speed of the game in the current room (in steps per second).<br />

fps* Number of frames that are actually drawn per second.<br />

current_time* Number of milliseconds that have passed since the system<br />

was started.<br />

current_year* The current year.<br />

current_month* The current month.<br />

current_day* The current day.<br />

current_weekday* The current day of the week (1=sunday, ...,<br />

7=saturday).<br />

current_hour* The current hour.<br />

current_minute* The current minute.<br />

current_second* The current second.<br />

Sometimes you might want to stop the game for a short while. For this, use the sleep<br />

function.<br />

sleep(numb) Sleeps numb milliseconds.

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

Saved successfully!

Ooh no, something went wrong!