Welcome to the Creatures Wiki! Log in and join the community.

HGHT

From Creatures Wiki
Revision as of 22:38, 25 September 2016 by ScoobyGambit (talk | contribs) (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

HGHT is a CAOS function that returns an object's height in pixels.

Usage[edit]

Syntax: HGHT

Returns the object's height in pixels (the height of its current sprite).

Example[edit]

HGHT can be used to modify positioning when dealing with agents that have differently-sized sprites. This is usually something like correctly positioning a plant being created from a seed.

Example of positioning from the C3 grass:

setv va04 wdth
**va02 is the width of the seed
subv va04 va02
divv va04 2
setv va05 hght
**va03 is the height of the seed
subv va05 va03
**va00 is the left position (posl) of the seed
subv va00 va04
**va01 is the top position (post) of the seed
subv va01 va05

doif tmvt va00 va01 eq 1
	mvto va00 va01
else
	mvsf va00 va01
endi

See also[edit]