Object.on.water

From AGI Wiki
Jump to: navigation, search

The object.on.water command restricts a screen object to water (areas with priority of 3).

Syntax

object.on.water(obj oA);

Remarks

Screen object oA is restricted to water (i.e. it's entire baseline must be on priority pixels equal to 3). At the start of the next interpreter cycle after object.on.water is executed, AGI will shuffle the position of the object if any pixel of its baseline is NOT on water.

The object.on.water and object.on.land commands do not work on the ego object. Although ego will be repositioned if not on water by shuffling as described above, at the end of each interpreter cycle AGI automatically clears any land or water restriction.

Possible Errors

AGI does not check that screen object number oA is a valid screen object. If it is not, this command will overwrite other data on the memory heap, which may cause unexpected results, including possibly crashing AGI.

DO NOT use the object.on.water and object.on.land commands on a screen object at the same time; they do not cancel each other out. If both commands are active on the same object, AGI will lock up, because it will enter a never ending loop trying to find a position. Make sure you use the object.on.anything command before switching between object.on.water and object.on.land.

Example

Code:
#define fish o1
...  [ initialize object
object.on.water(fish); [ of course!

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 64 (0x40 hex)

See Also

object.on.anything
object.on.land