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

Jump to navigation Jump to search
m
Text replacement - "</source>" to "</syntaxhighlight>"
m
m (Text replacement - "</source>" to "</syntaxhighlight>")
Line 66: Line 66:
v200 = 4;
v200 = 4;
load.pic(v200);
load.pic(v200);
</source>
</syntaxhighlight>


* discard.pic(room_no) just rids the PICTURE from memory once it is drawn.
* discard.pic(room_no) just rids the PICTURE from memory once it is drawn.
Line 99: Line 99:
<source lang="cpp">
<source lang="cpp">
#include "defines.txt"
#include "defines.txt"
</source>
</syntaxhighlight>


add
add
Line 105: Line 105:
<source lang="cpp">
<source lang="cpp">
#define your_object_name_with_no_spaces    o1
#define your_object_name_with_no_spaces    o1
</source>
</syntaxhighlight>


So it should read like this:
So it should read like this:
Line 112: Line 112:
#include "defines.txt"
#include "defines.txt"
#define your_object_name_with_no_spaces    o1
#define your_object_name_with_no_spaces    o1
</source>
</syntaxhighlight>


The reason we use o1, is because ego, is always o0.
The reason we use o1, is because ego, is always o0.
Line 121: Line 121:
<source lang="cpp">
<source lang="cpp">
if (new_room) {
if (new_room) {
</source>
</syntaxhighlight>
and
and


Line 129: Line 129:
<source lang="cpp">
<source lang="cpp">
draw(ego);
draw(ego);
</source>
</syntaxhighlight>
The code we will add here displays a view on the screen:
The code we will add here displays a view on the screen:
<source lang="cpp">
<source lang="cpp">
Line 141: Line 141:
ignore.objs(object name);
ignore.objs(object name);
draw(object name);              //finally, draw the view on the screen.
draw(object name);              //finally, draw the view on the screen.
</source>
</syntaxhighlight>
Set.loop, set.cel, and set.priority aren't really necessary, but can be useful, if they need to be changed later on. Ignore.objs makes the object oblivious to other objects. If this is not set, then another object may stop if it hits this object when moving.
Set.loop, set.cel, and set.priority aren't really necessary, but can be useful, if they need to be changed later on. Ignore.objs makes the object oblivious to other objects. If this is not set, then another object may stop if it hits this object when moving.


Line 182: Line 182:
stop.cycling(item name);
stop.cycling(item name);
draw(item name);
draw(item name);
</source>
</syntaxhighlight>
''' Modifying LOGIC.090 '''
''' Modifying LOGIC.090 '''


Line 196: Line 196:
   }
   }
}
}
</source>
</syntaxhighlight>
Also needing to be added is the code for getting the object:
Also needing to be added is the code for getting the object:
<source lang="cpp">
<source lang="cpp">
Line 207: Line 207:
   }
   }
}
}
</source>
</syntaxhighlight>
''' Getting the item from the room '''
''' Getting the item from the room '''


Line 228: Line 228:
   }
   }
}
}
</source>
</syntaxhighlight>
Of course, we don't necesarily have to use v255, we can use any available Variable. The posn(ego,x1,y1,x2,y2) command, requires that x1,y1 is the top left corner of an imaginary box, and x2,y2 the lower right corner. Don't forget to enter the words you use into the WORDS.TOK file! This code is for looking at the item:
Of course, we don't necesarily have to use v255, we can use any available Variable. The posn(ego,x1,y1,x2,y2) command, requires that x1,y1 is the top left corner of an imaginary box, and x2,y2 the lower right corner. Don't forget to enter the words you use into the WORDS.TOK file! This code is for looking at the item:
<source lang="cpp">
<source lang="cpp">
Line 240: Line 240:
   }
   }
  }
  }
</source>
</syntaxhighlight>
Finally, if you do not wish the item to be drawn when it isn't in the room(ie you have taken it), then replace the line above which said this:
Finally, if you do not wish the item to be drawn when it isn't in the room(ie you have taken it), then replace the line above which said this:
<source lang="cpp">
<source lang="cpp">
  draw(your item name);
  draw(your item name);
</source>
</syntaxhighlight>
to this:
to this:
<source lang="cpp">
<source lang="cpp">
  v255 = 2;
  v255 = 2;
  if (obj.in.room("object name",v255)) { draw(your item name); }
  if (obj.in.room("object name",v255)) { draw(your item name); }
</source>
</syntaxhighlight>


[[Category:AGIWiki/Tutorials]]
[[Category:AGIWiki/Tutorials]]
TrustedUser
2,112

edits

Navigation menu