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.

When you deactivate instances they are in some sense removed from the game. They are not<br />

visible anymore nor are any events executed for them. So for all actions and functions they<br />

don't exist anymore. This saves a lot of time but you have to be careful. For example, when<br />

you delete all instances of a particular type, deactivated instances are not deleted (because<br />

they don't exist). So don't think that a key a player picks up can unlock a deactivated door.<br />

The most crucial mistake you can make is to deactivate the instance that is responsible for the<br />

activation. To avoid this some of the routines below allow you to insist that the calling instance<br />

should not be deactivated itself.<br />

Here are the available routines:<br />

instance_deactivate_all(notme) Deactivates all instances in the room.<br />

If notme is true the calling instance is not deactivated (which is normally what<br />

you want).<br />

instance_deactivate_object(obj) Deactivates all instances in the room<br />

of the given object. You can also use all to indicate that all instances must be<br />

deactivated or the id of an instance to deactivate an individual instance.<br />

instance_deactivate_region(left,top,width,height,inside,not<br />

me) Deactivates all instances in the indicated region (that is, those whose<br />

bounding box lies partially inside the region). If inside is false the instances<br />

completely outside the region are deactivated. If notme is true the calling<br />

instance is not deactivated (which is normally what you want).<br />

instance_activate_all() Activates all instances in the room.<br />

instance_activate_object(obj) Activates all instances in the room of<br />

the given object. You can also use all to indicate that all instances must be<br />

activated or the id of an instance to activate an individual instance.<br />

instance_activate_region(left,top,width,height,inside)<br />

Activates all instances in the indicated region. If inside is false the instances<br />

completely outside the region are activated.<br />

For example, to deactivate all instances outside the view and activate the ones inside the<br />

view, you could place the following code in the step event of the moving character:<br />

{

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

Saved successfully!

Ooh no, something went wrong!