885
edits
m (→Data types) |
|||
Line 11: | Line 11: | ||
Before you can use a screen object, it must be initialized. Initialization involves the following steps: | Before you can use a screen object, it must be initialized. Initialization involves the following steps: | ||
# '''Animate the object.''' This is done using the '''[[AGIWiki/ | # '''Animate the object.''' This is done using the '''[[AGIWiki/animate.obj|animate.obj]]''' command. This tells the [[AGIWiki/Interpreter|interpreter]] that you want to use this object. There are a limited number of objects that the interpreter can use at any one time. This is set by a certain byte in the [[AGIWiki/OBJECT file|OBJECT file]]. [[AGIWiki/WinAGI|WinAGI]] allows you to easily edit the maximum number of screen objects. The more objects you use the slower the interpreter will run, but today's computer have less of a problem with this. | ||
# '''Assign a view to the object.''' This is done using the '''[[AGIWiki/ | # '''Assign a view to the object.''' This is done using the '''[[AGIWiki/set.view|set.view]]''' command. Each object must have a view assigned to it, and this is the view that is displayed on the screen wherever the object is. One view can be assigned to multiple screen objects. You must have the view loaded into memory before you assign it, using the '''[[AGIWiki/load.view|load.view]]''' command. It is possible to assign the same view to more than one object. This can be used to create 'herds' of objects. The alligators in the King's Quest I moat are a good example. | ||
# '''Position the object on screen.''' The default values for the object's coordinates are (0,0). Set the initial position of the object with the '''[[AGIWiki/ | # '''Position the object on screen.''' The default values for the object's coordinates are (0,0). Set the initial position of the object with the '''[[AGIWiki/position|position]]''' or '''[[AGIWiki/position.v|position.v]]''' commands. | ||
# '''Draw the object.''' This is done using the '''[[AGIWiki/ | # '''Draw the object.''' This is done using the '''[[AGIWiki/draw|draw]]''' command. The object is not visible on the screen until this command is issued.If you later need to remove it from the screen, use the erase command. When drawing objects, the object's location (set by '''[[AGIWiki/position|position]]''' or '''[[AGIWiki/position.v|position.v]]''') is validated using a method called '[[AGIWiki/Animated object#shuffling|shuffling]]' to ensure the object is not drawn outside the playable area, on a control line or on another object (if the object is not ignoring other objects). | ||
=== Example === | === Example === |
edits