NPC (class)

From Moondust Wiki
Revision as of 15:58, 27 October 2014 by Kevsoft (talk | contribs)
Jump to navigation Jump to search

This class provides fields/functions for managing NPCs in the current level.

NPC class
Type Function/Field Return values/Value type Description
Constructor myNPC = NPC(int internalIndex) NPC Construct a new NPC-Object. Only use this constructor with caution. Use npcs() or findnpcs() instead!
function NPC:mem(int offset, int fieldtype, object value) nil Sets a value of the NPC struct at a specific address-offset.
function NPC:mem(int offset, int fieldtype) object Returns a value of the NPC struct at a specific address-offset.
function NPC:kill() nil Kills the npc with the standard kill animation.
function NPC:kill(int killanimation) nil Kills the npc with the kill animation killanimation.
Field NPC.x double The x coordinate of the npc.
Field NPC.y double The y coordinate of the npc.
Field NPC.speedX double The x-speed of the npc.
Field NPC.speedY double The y-speed of the npc.
Field NPC.id int The npc-id of the npc.
Field NPC.direction int The direction of the npc. NOTE: Setting the direction of a npc, resets the monumentum of the npc. You can modify the speedX value if you want to set your own monumentum.