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


From Creatures Wiki
Jump to navigation Jump to search

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


Syntax: HGHT

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


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
	mvsf va00 va01

See also[edit]