For the corresponding entity functions go here
int entities; int entity.x[entity]; int entity.y[entity]; int entity.specframe[entity]; int entity.frame[entity]; int entity.hotx[entity]; int entity.hoty[entity]; int entity.hotw[entity]; int entity.hoth[entity]; int entity.movecode[entity]; int entity.face[entity]; int entity.speed[entity]; int entity.visible[entity]; int entity.obstruct[entity]; int entity.obstructable[entity]; string entity.script[entity]; string entity.chr[entity]; int entity.lucent[entity]; int entity.framew[entity], entity.frameh[entity]; string entity.description[entity];
entities - (read only) The number of entities currently on the map. Use this an the upper bound any time you need to loop through and check entites for something.
entity.x, entity.y - (read/write) The coordinates of the entity on the map. This is a pixel value from the top left corner of the map to the top left corner of the entity's hotspot. To get an x,y coord of the entity on the screen subtract xwin and ywin.
entity.specframe - (read/write) Similar to setting a z movecode, this sets a frame to display. Remember to set it back to 0 if you want movement animations.
entity.frame - (?read only?) ?Just stores the entities current frame?
entity.hot(x/y/w/h) - (read only) These four variables specify a rectangle on the entity's frame used for collision detection, x,y coords from the top left corner of the frame, width and height. They are read-only. Why, I don't know. You'll need to set them in the .mak when you create your .chr file.
entity.movecode - (read only) reflects the current wandermode of the entity. 0 is not moving, 1 is wander zone, 2 is wander rect, and 3 is movecode. Attempting to setting this variable manually will crash the system, so if you want to change the wandermode, please use one of the following functions: EntityStop(), EntitySetWanderZone(), EntitySetWanderRect(), or EntityMove().
entity.face - (read/write) Returns a number that corresponds to the direction the entity is facing. Changing this will change the direction the entity is facing. Setting it to an invalid value can crash the system.
(up) 1 | (left) 3 --+-- 4 (right) | 2 (down)
entity.speed - (read/write) how fast this entity will move, in pixels per second (PPS). If you want an entity to crawl aroud at a tile per second (really slow) set this to 16. We commonly set it to 100 or so, although 128 may be a better 'normal speed' for characters.
entity.visible - (read/write) [NEW!] Whether or not the entity will be drawn to the screen. A little testing seems to show it affects BlitEntityFrame() as well as Render() and 0 is invisible.
entity.obstruct - (read/write) 1 if the entity's hotspot is an obstruction, 0 if not.
entity.obstructable - (read/write) 1 if this entity cares about obstructions when moving, 0 if not.
entity.script - (read/write) The script event name used for handling activations, as set by onActivate in maped.
entity.chr - (read/write) Added to allow read/write access to the CHR for entities. Setting it is the same as ChangeCHR()
entity.lucent - (read/write) The lucency percentage of the entity, 0 is opaque, 100 is invisible.
entity.frame[w/h] - (read-only) The width/height of each frame in the CHR file.
entity.description (read/write) Information about this sprite, usually used in MapEd, to help you figure out which entity is which. You could possibly use the entity's description to locate specific entities on the map by their description instead of an arbitrary index number.