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.

ehavior we must define events for the object. You can only add code actions<br />

to events. You need to specify the object, the event type, the event number<br />

(use the constants that have been specified before for the event_perform()<br />

function). Finally you provide the code string that must be executed. You can<br />

add multiple code actions to each event.<br />

object_event_clear(ind,evtype,evnumb) You can use this function to<br />

clear all the actions for a particular event.<br />

Creating objects is in particular useful when you are designing scripts or action libraries. For<br />

example, an initialization script can create an object to display a text and another script can<br />

add such an object <strong>with</strong> a particular text. In this way you have a simple mechanism to display<br />

texts <strong>with</strong>out the need to create objects using the standard interface.<br />

Rooms<br />

Manipulating rooms on the fly is a dangerous thing to do. You have to realize that rooms<br />

change all the time due to what is happening in the game. This normally only involves the<br />

currently active room and there are many routines described in previous sections to<br />

manipulate the instances, backgrounds, and tiles in the active room. But changes in the active<br />

room will last if the room is persistent. Hence, you should never manipulate aspects of the<br />

currently active room or any room that is persistent and that has already been visited before.<br />

Such changes in general won't be noticed but might sometimes even lead to unexpected<br />

errors. Due to the fact that rooms are linked in a complicated way there is also no routine to<br />

delete a room.<br />

The following routines are available<br />

room_set_width(ind,w) Sets the width for the room <strong>with</strong> the indicated<br />

index.<br />

room_set_height(ind,h) Sets the height for the room <strong>with</strong> the indicated<br />

index.<br />

room_set_caption(ind,str) Sets the caption for the room <strong>with</strong> the<br />

indicated index.<br />

room_set_persistent(ind,val) Sets whether the room <strong>with</strong> the indicated<br />

index is persistent or not.<br />

room_set_code(ind,str) Sets the initialization code string for the room

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

Saved successfully!

Ooh no, something went wrong!