示例#1
0
// x, y, w, h = .GetRect(entity) - Where x, y are coordinates of the top left our our avatar on the map. w, h are avatar dimensions.
int entity_GetRect(lua_State* ls)
{
	DEBUGOUT("entity_GetRect");
	luaCountArgs(ls, 1);

	Entity* e = _getReferencedEntity(ls);

	rect r = e->GetBoundingRect();
	lua_pushnumber(ls, r.x);
	lua_pushnumber(ls, r.y);
	lua_pushnumber(ls, r.w);
	lua_pushnumber(ls, r.h);

	return 4;
}
示例#2
0
// .Explode(ent) - Will create an explosion entity at ent's position
// 		This will not remove ent from the map!
int entity_Explode(lua_State* ls)
{
	Image* img;
	rect r;
	Entity* e = _getReferencedEntity(ls);

	if (e)
	{
		img = e->GetImage();
		if (img)
		{
			r = e->GetBoundingRect();
			new ExplodingEntity(e->mMap, img, point2d(r.x, r.y));
		}
	}

	return 0;
}