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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Objects<br />

does not exist it is created. So you can add multiple code actions for the same<br />

moment.<br />

timeline_moment_clear(ind,step) You can use this function to clear all<br />

the actions for a particular moment.<br />

Also objects can be manipulated and created during the game play. NEVER change or delete<br />

an object for which there are instances. This can lead to unexpected effects as certain object<br />

properties are stored <strong>with</strong> the instance and, hence, changing them in the object will not have<br />

the desired effect.<br />

object_set_sprite(ind,spr) Sets the sprite of the object <strong>with</strong> the given<br />

index. Use -1 to remove the current sprite from the object.<br />

object_set_solid(ind,solid) Sets whether instances created of the<br />

object must default be solid (true or false).<br />

object_set_visible(ind,vis) Sets whether instances created of the<br />

object must default be visible (true or false).<br />

object_set_depth(ind,depth) Sets the default depth of instances<br />

created of the object.<br />

object_set_persistent(ind,pers) Sets whether instances created of<br />

the object must default be persistent (true or false).<br />

object_set_mask(ind,spr) Sets the sprite mask of the object <strong>with</strong> the<br />

given index. Use -1 to set the mask to be the sprite of the object.<br />

object_set_parent(ind,obj) Sets the parent of the object. Use -1 to not<br />

have a parent. Changing the parent changes the behavior of instances of the<br />

object.<br />

The following routines are useful for creating objects on the fly. As <strong>with</strong> all resource changing<br />

routines, be very careful that you don't create new objects all the time.<br />

object_add() Adds a new object. It returns the index of the object. You can<br />

now use this index in the routines above to set certain properties of the object<br />

and then you can use the index to create instances of the object.<br />

object_delete(ind) Deletes the object <strong>with</strong> the given index. Make sure no<br />

instances of the object exist in any of the rooms.<br />

object_event_add(ind,evtype,evnumb,codestr) To give the object a

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

Saved successfully!

Ooh no, something went wrong!