本文整理汇总了C++中Door::getPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Door::getPosition方法的具体用法?C++ Door::getPosition怎么用?C++ Door::getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Door
的用法示例。
在下文中一共展示了Door::getPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openDoor
// open a door
int Script::openDoor(lua_State* L){
short x = (short)luaL_checknumber(L, 1);
short y = (short)luaL_checknumber(L, 2);
Vector2D pos = Vector2D(x,y);
string direction = string(luaL_checkstring(L, 3));
Direction dir = TOP;
if (direction == "TOP")
dir = TOP;
else if (direction == "RIGHT")
dir = RIGHT;
else if (direction == "BOTTOM")
dir = BOTTOM;
else if (direction == "LEFT")
dir = LEFT;
else
cerr << "openDoor: wrong direction";
Door* d = wrld.getDoor(Vector2D(x,y), dir);
if (d == NULL){
cerr << "openDoor: No Door!";
return 0;
}
d->setType(0);
if(d->getScript() != NULL){
scr.call(OnOpen, d->getScript(), Vector2D(x,y));
}
d->setClosed(false);
//update visibility
wrld.update_visibility(d->getPosition());
wrld.update_visibility(d->getPosition2());
return 0;
}