Difference between revisions of "AGIWiki/Creating an AGI Game"

Jump to navigation Jump to search
m
no edit summary
m (syntax -> source)
m
Line 15: Line 15:
=== Resources ===
=== Resources ===


AGI games consist of 4 file types, or resources, all combined together into one file called vol.0 (or vol.x for multi-disk games).  These file types are PICTURE, VIEW, SOUND, and LOGIC. The maximum amount of these in any AGI game is 256.
AGI games consist of 4 file types, or resources, all combined together into one file called vol.0 (or vol.x for multi-disk games). These file types are PICTURE, VIEW, SOUND, and LOGIC. The maximum amount of these in any AGI game is 256.


==== PICTURE ====
==== PICTURE ====
Line 39: Line 39:
''' Variables ''' '' (example ''<tt>v234</tt> '')''
''' Variables ''' '' (example ''<tt>v234</tt> '')''


Variables may store a number up to 255.  Variables v0 up to v26 are reserved.
Variables may store a number up to 255. Variables v0 up to v26 are reserved.


''' Flags ''' '' (example ''<tt>f56</tt> '')''
''' Flags ''' '' (example ''<tt>f56</tt> '')''


Flags can have two states, set or not set.  To set a flag, use the command <tt>set(flag number)</tt>.
Flags can have two states, set or not set. To set a flag, use the command <tt>set(flag number)</tt>.


''' Objects ''' '' (example ''<tt>o2</tt> '')''
''' Objects ''' '' (example ''<tt>o2</tt> '')''
Line 53: Line 53:
Over the years I have followed AGI editing, a lot of the so-called demos that have been released have just been rehashes of the Template Game.  They would only have one room, and one view - the player.  This I believe is because it is very easy to work out how to print text, but these people couldn’t work out how to create a new room.  Well, it is actually quite simple.
Over the years I have followed AGI editing, a lot of the so-called demos that have been released have just been rehashes of the Template Game.  They would only have one room, and one view - the player.  This I believe is because it is very easy to work out how to print text, but these people couldn’t work out how to create a new room.  Well, it is actually quite simple.


* First you will have to create the PICTURE resource for the room.  Once created, add this to the game using the menu RESOURCE-ADD.  Browse to the PICTURE and press OK.  Set the resource number to 3 and make sure that the resource type is PICTURE.
* First you will have to create the PICTURE resource for the room. Once created, add this to the game using the menu RESOURCE-ADD.  Browse to the PICTURE and press OK.  Set the resource number to 3 and make sure that the resource type is PICTURE.


* Now that this is done, all that we have to do is create the logic.  The best thing to do is just copy and paste from LOGIC.002.  So, double click on LOGIC.002 in AGI Studio. An editing screen will appear with the source code for room 2. Drag the mouse button from the top of the file to the bottom to select all of the text. From the edit menu, select COPY.  Now close this file, and start a new one, by clicking on the button labeled Logic editor on the toolbar. Select PASTE from the edit menu.
* Now that this is done, all that we have to do is create the logic. The best thing to do is just copy and paste from LOGIC.002.  So, double click on LOGIC.002 in AGI Studio. An editing screen will appear with the source code for room 2. Drag the mouse button from the top of the file to the bottom to select all of the text. From the edit menu, select COPY. Now close this file, and start a new one, by clicking on the button labeled Logic editor on the toolbar. Select PASTE from the edit menu.


* At the top of the file are 5 comment lines. All comment lines begin with "//". You may delete these or change it to suit this new room(3).
* At the top of the file are 5 comment lines. All comment lines begin with "//". You may delete these or change it to suit this new room(3).


* Next, comes an if statement. This statement checks if we just entered the room.  The flag new_room will be set if we did.  Everything after the brace( { ) will be done until we get to the closing brace for the if statement ( } ).
* Next, comes an if statement. This statement checks if we just entered the room. The flag new_room will be set if we did.  Everything after the brace( { ) will be done until we get to the closing brace for the if statement ( } ).


*  First the picture of the room number is loaded into memory, using the load.pic(room_no) command. Keep in mind that every command has either a semi-colon(;) at the end or an opening brace.&nbsp; In this case, it’s a semi-colon.&nbsp; If you wish to change the number of the PICTURE resource which is loaded, you must first set a variable(say, v200)&nbsp; to that value and invoke the command like this:
*  First the picture of the room number is loaded into memory, using the load.pic(room_no) command. Keep in mind that every command has either a semi-colon(;) at the end or an opening brace.&nbsp; In this case, it’s a semi-colon.&nbsp; If you wish to change the number of the PICTURE resource which is loaded, you must first set a variable(say, v200)&nbsp; to that value and invoke the command like this:
Line 250: Line 250:
  if (obj.in.room("object name",v255)) { draw(your item name); }
  if (obj.in.room("object name",v255)) { draw(your item name); }
</source>
</source>
[[Category:AGIWiki/Tutorials]]
[[Category:AGIWiki/Tutorials]]
885

edits

Navigation menu