Designing Games with Game Maker - YoYo Games
Designing Games with Game Maker - YoYo Games
Designing Games with Game Maker - YoYo Games
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
instance_position(x,y,obj) Returns the id of the instance of type obj at<br />
position (x,y). When multiple instances are at that position the first is<br />
returned. obj can be an object or the keyword all. If it does not exist, the<br />
special object noone is returned.<br />
instance_nearest(x,y,obj) Returns the id of the instance of type obj<br />
nearest to (x,y). obj can be an object or the keyword all.<br />
instance_furthest(x,y,obj) Returns the id of the instance of type obj<br />
furthest away from (x,y). obj can be an object or the keyword all.<br />
instance_place(x,y,obj) Returns the id of the instance of type obj met<br />
when the current instance is placed at position (x,y). obj can be an object or<br />
the keyword all. If it does not exist, the special object noone is returned.<br />
The following functions can be used for creating and destroying instances.<br />
instance_create(x,y,obj) Creates an instance of obj at position (x,y).<br />
The function returns the id of the new instance.<br />
instance_copy(performevent) Creates a copy of the current instance.<br />
The argument indicates whether the creation event must be executed for the<br />
copy. The function returns the id of the new copy.<br />
instance_destroy() Destroys the current instance.<br />
instance_change(obj,perf) Changes the instance into obj. perf indicates<br />
whether to perform the destroy and creation events.<br />
position_destroy(x,y) Destroys all instances whose sprite contains<br />
position (x,y).<br />
position_change(x,y,obj,perf) Changes all instances at (x,y) into obj.<br />
perf indicates whether to perform the destroy and creation events.<br />
Deactivating instances<br />
When you create large room, for example in platform games, <strong>with</strong> a small view, many<br />
instances lie outside the view. Such instances though are still active and will execute their<br />
events. Also when performing collision checks these instances are taken into account. This can<br />
cost a lot of time, which is often not necessary. (For example, often it is not important<br />
whether instances outside the view move.) To solve this problem <strong>Game</strong> <strong>Maker</strong> contains some<br />
functions to deactivate and activate instances. Before using them you must though clearly<br />
understand how they work.