void PlayerHandler::TeleportPlayer(int playerid, WorldPositionObject pos) { SetPlayerVirtualWorld(playerid, pos.virtualWorld_); SetPlayerInterior(playerid, pos.sampInteriorId_); SetPlayerPos(playerid, pos.x_, pos.y_, pos.z_); if (GetPlayerState(playerid) == 2) { int vehicleId = GetPlayerVehicleID(playerid); LinkVehicleToInterior(vehicleId, pos.sampInteriorId_); SetVehicleVirtualWorld(vehicleId, pos.virtualWorld_); SetVehiclePos(vehicleId, pos.x_, pos.y_, pos.z_); PutPlayerInVehicle(playerid, vehicleId, 0); } SetPVarInt(playerid, "oldinterior", GetPVarInt(playerid, "currentinterior")); SetPVarInt(playerid, "currentinterior", pos.interiorId_); }
static void SetPlayerRandomSpawn(int playerid) { if (iSpawnSet[playerid] == 1) { int r = rand() % arraysize(gCopPlayerSpawns); SetPlayerPos(playerid, gCopPlayerSpawns[r][0], gCopPlayerSpawns[r][1], gCopPlayerSpawns[r][2]); // Warp the player SetPlayerFacingAngle(playerid, 270.0f); } else if (iSpawnSet[playerid] == 0) { int r = rand() % arraysize(gRandomPlayerSpawns); SetPlayerPos(playerid, gRandomPlayerSpawns[r][0], gRandomPlayerSpawns[r][1], gRandomPlayerSpawns[r][2]); // Warp the player } }
PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerRequestClass(int playerid, int classid) { SetPlayerPos(playerid, 1958.3783f, 1343.1572f, 15.3746f); SetPlayerCameraPos(playerid, 1958.3783f, 1343.1572f, 15.3746f); SetPlayerCameraLookAt(playerid, 1958.3783f, 1343.1572f, 15.3746f, CAMERA_CUT); return true; }
void HelloWorld::initmapdata() { CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); CCSize mapsize = m_mapSprite->getContentSize(); //计算场景的边界 m_border = (visibleSize.height - mapsize.height) / UnitY; m_border = (int)m_border /2 * UnitY; //设定当前的地图宽高 m_Mapsize = CCSize(19, 6); //屏幕绘制为逻辑地图的第几列开始 m_CurrentMapStartPos = CCPoint(0,0); //当前自己再地图中的位置 m_CurrentPos = CCPoint(0,0); //根据当前的地图算绘制。。19 //根据当前的位置计算绘制坐标 //逻辑地图的位置继续按屏幕坐标 CCPoint pos; pos.x = m_CurrentMapStartPos.x * 64; pos.y = m_CurrentMapStartPos.y * 64+m_border; m_mapSprite->setPosition(pos); //设置当前的位置 m_pSprite->setAnchorPoint(ccp(0,0)); SetPlayerPos(m_CurrentPos.x, m_CurrentPos.y); }
static void SetupPlayerForClassSelection(int playerid) { SetPlayerInterior(playerid,14); SetPlayerPos(playerid,258.4893f,-41.4008f,1002.0234f); SetPlayerFacingAngle(playerid, 270.0f); SetPlayerCameraPos(playerid,256.0815f,-43.0475f,1004.0234f); SetPlayerCameraLookAt(playerid,258.4893f,-41.4008f,1002.0234f,CAMERA_CUT); }
void Player::SetPlayer(cocos2d::Layer *layer) { CCLOG("POWER"); //COCOS BUG: WONT ALWAYS SHOW IN OUTPUT paddle = Sprite::create("Paddle.png"); // May not need the auto auto paddleBounding = PhysicsBody::createBox(paddle->getContentSize());// CHANGE TO CIRCLE PhysicsShapeCircle paddleBounding->setDynamic(false); paddleBounding->setGravityEnable(false); paddleBounding->setContactTestBitmask(Paddle_Bitmask); paddleBounding->setCollisionBitmask(Paddle_Bitmask); paddle->setPhysicsBody(paddleBounding); //sets a bounding box around brick. SetPlayerPos(WinSize.width / 2, WinSize.height / 6); layer->addChild(paddle,1); paddle->setTag(1); }