vx.Entity

From vx
Jump to: navigation, search

Contents

[edit] vx.Entity

An entity handle, which interacts with the map it is placed in, and has a CHR spritesheet.

[edit] Constructors

vx.Entity(handle_index)

  • For referencing map-defined entities by their index.

vx.Entity(x, y, filename)

  • Opens a chr sprite and spawns an entity at (x, y).

[edit] Attributes

vx.Entity.x -> number (read/write) vx.Entity.y -> number (read/write)

  • The map position of the entity in pixels

vx.Entity.special_frame -> number (read/write)

  • A special animation frame to use, overrides normal frame drawing if this is non-zero.

vx.Entity.hotspot_x -> number (read) vx.Entity.hotspot_y -> number (read) vx.Entity.hotspot_width -> number (read) vx.Entity.hotspot_height -> number (read)

  • The rectangular area defined to be the entity's hotspot. Used for checking obstructions, and y-sorting rendering. The entity's (x, y) already have (hotspot_x, hotspot_y) added to them.

vx.Entity.direction -> number (read/write)

  • The direction the entity is facing.
  • NOTE: Setting it to an invalid number can crash verge.
	      (up) 1
	           |
	(left) 3 --+-- 4 (right)
        	   |
	           2 (down)

vx.Entity.speed -> number (read/write)

  • The speed of movement in pixels/sec. Defaults to 100.

vx.Entity.visible -> boolean (read/write)

  • Whether or not this entity is drawn on the map.

vx.Entity.is_obstruction -> boolean (read/write)

  • Whether or not this entity will be an obstruction to others.

vx.Entity.obstructable -> boolean (read/write)

  • Whether or not this entity will obey obstructions, or just walk through things instead.

vx.Entity.filename -> string (read/write)

  • The sprite filename for this entity. Changing this will load in the new filename specified.

vx.Entity.lucent -> number (read/write)

  • The translucency of the entity.

vx.Entity.frame_width -> number (read/write) vx.Entity.frame_height -> number (read/write)

  • The actual dimensions of the sprite's each frame in pixels.

vx.Entity.description -> string (read/write)

  • Information about this sprite, usually used in MapEd, to help you figure out which entity is which.

[edit] Methods

vx.Entity:SetSprite(filename)

  • Changes the entity's sprite file.

vx.Entity:Move(movescript)

  • Move the entity according to a movescript.

vx.Entity:SetWanderDelay(delay)

  • Sets the pause between each step when wandering.

vx.Entity:WanderRect(x, y, x2, y2)

  • Causes the entity to wander in a rectangular region.

vx.Entity:WanderZone(x, y, x2, y2)

  • Causes the entity to wander within the confines of the zone it is currently standing in. All other types of zone are treated as obstructions.

vx.Entity:HookRender(func)

  • Overrides the entity's rendering method to the specified global function.

vx.Entity:Stalk(target)

  • Makes the entity follow another entity.

vx.Entity:StopStalking()

  • Makes the entity stop following another entity around.

vx.Entity:Stop()

  • Forces the entity to stop moving.

vx.Entity:BecomePlayer()

  • Makes this entity become the "player" entity, which the user input moves around, and which the camera follows by default.
Personal tools