Meteor 2 Scripting Functions
Sprite
int createSprite(string spriteTypeName, vector2 pos, uint8 side)
Create a map sprite (server only).
int spriteID = createSprite("objects\\arrow.spr", getPos(PLAYER_OBJECT), 0, 0);
print("Created sprite ID " + spriteID);
void deleteSprite(int spriteID)
Delete a map sprite (server only).
int sprite = createSprite("objects\\arrow.spr", getPos(PLAYER_OBJECT), 0, 0);
deleteSprite(sprite);
vector2 getSpritePos(int spriteID)
Get a map sprite position (in pixels).
print(getSpritePos(1));
void setSpritePos(int spriteID, vector2 pos)
Set a map sprite position (server only).
setSpritePos(1, getPos(PLAYER_OBJECT));
float getSpriteAngle(int spriteID)
Get a map sprite angle (in degrees).
print(getSpriteAngle(1));
void setSpriteAngle(int spriteID, float angle)
Set a map sprite angle (server only).
setSpriteAngle(1, 45);
bool getSpriteHidden(int spriteID)
Get sprite hidden status.
print(getSpriteHidden(1));
void setSpriteHidden(int spriteID, bool hidden)
Show or hide a sprite.
setSpriteHidden(1, true);
float getSpriteLifetime(int spriteID)
Get a sprite's remaining lifetime (server only).
print(getSpriteLifetime(1));
lifetime is in seconds (0 for no lifetime specified).
void setSpriteLifetime(int spriteID, bool hidden)
Set a sprite's remaining lifetime in seconds (server only).
int sprite = createSprite("objects\\arrow.spr", getPos(PLAYER_OBJECT), 0, 0);
setSpriteLifetime(sprite, 5.25);
Set lifetime to 0 to not automatically delete.
Note that wrecks and corpses are deleted automatically once map limits are reached.
string getPaintColour(int spriteID)
Get the paint colour of a sprite.
print("Sprite ID 0 is " + getSpritePaintColour(0));
paintColour is specfified in HTML style ("#RRGGBB" hex values), colours may also contain 2 additional optional characters for alpha (e.g. "#FFFFFF80" is transparent white).
void setSpritePaintColour(int spriteID, string paintColour)
Set the paint colour of a sprite.
setSpritePaintColour(0, "#FF0000");
paintColour is specfified in HTML style ("#RRGGBB" hex values), colours may also contain 2 additional optional characters for alpha (e.g. "#FFFFFF80" is transparent white).
bool spriteExists(int spriteID)
Check if a map sprite exists.
if (spriteExists(1))
{
print("Sprite 1 exists");
}
else
{
print("Sprite 1 does not exist");
}
int getSpriteTypeNumber(int spriteID)
Get a sprite type number from a map sprite ID.
int spriteTypeNumber = getSpriteTypeNumber(1);
print("Map sprite ID 1 is sprite type number " + spriteTypeNumber);
Sprite type numbers are the index of a loaded sprite asset. They are local and can differ for each game session.
string getSpriteTypeName(int spriteID)
Get a sprite type name from a map sprite ID.
string spriteTypeName = getSpriteTypeName(1);
print("Sprite ID 1 type name is " + spriteTypeName);
uint getSpriteTypeNameLowerHash(int spriteID)
Get a sprite type name lower case hash from a map sprite ID.
uint spriteTypeNameHash = getSpriteTypeNameLowerHash(1);
print("Sprite ID 1 type name hash is " + spriteTypeNameHash);
string spriteTypeNumberToName(int spriteTypeNumber)
Resolve a sprite type number to a sprite type name.
string typeName = spriteTypeNumberToName(10);
print("Sprite type number 10 type name is " + typeName);
int spriteTypeNameToNumber(string spriteTypeName)
Get a sprite type number from a sprite type name.
int spriteTypeNumber = spriteTypeNameToNumber("objects\\arrow.spr");
print("Sprite type number " + spriteTypeNumber);
Index