Set.horizon

From AGI Wiki
Jump to navigationJump to search

The set.horizon command adjusts the position of the horizon line.

Syntax

set.horizon(byt HORIZON);

Remarks

The horizon's value is set to HORIZON. The horizon is an invisible horizontal line that limits a screen object's vertical position near the top of the screen. This helps create the 3D feel of AGI games.

AGI sets the horizon to a default value of 36 every time a new.room or new.room.v command is encountered. Depending on the geometry and perspective of a given room, you can use set.horizon to set a horizon value that looks more natural.

Normally, screen objects cannot go above the horizon. Use the ignore.horizon command to allow an object to ignore the horizon and move to the top of the screen. The observe.horizon command restores normal behavior, and prevents an object from going above the horizon.

Possible Errors

Setting a value for horizon >=167 will cause AGI to crash when any screen object that is observing the horizon is placed on the screen. The shuffle function will go into an infinite loop trying to place the object.

Example

Code:
if(isset(newRoom))
  {
  set.horizon(42);      [ adjust horizon for this room
  }
...
ignore.horizon(o1);   [ object 1 is now allowed above horizon
...
observe.horizon(o1);  [ object 1 is NOT allowed above horizon

Technical Information

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

See Also

ignore.horizon
observe.horizon