Difference between revisions of "AGIWiki/New room section"
< AGIWiki
Jump to navigation
Jump to search
(Created page with "{{AGIWiki}} The '''new room section''' of a logic is a section of code that runs during the first interpreter cycle in a new [[AG...") |
(No difference)
|
Latest revision as of 13:49, 20 April 2013
The new room section of a logic is a section of code that runs during the first interpreter cycle in a new room and does not run again unless the player leaves the room and re-enters it. This section is used to perform initialization of the variables, flags, objects, and other data used by the room - in other words, the new room section contains code that you would only want to run once in a room.
The new room section is controlled by the special flag f5
(or new_room
, in the AGI Studio Template Game). This flag is set during the first cycle through a new room and is reset after that cycle has completed.
A typical new room section will contain code like the following:
<syntax type="C++">
#define new_room f5 #define room_no v0 #define ego o0
if (new_room) { /* new room section */
load.pic(room_no); draw.pic(room_no); discard.pic(room_no);
draw(ego); show.pic(); }
</syntax>