本文整理汇总了C++中MapObject::GetYPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ MapObject::GetYPosition方法的具体用法?C++ MapObject::GetYPosition怎么用?C++ MapObject::GetYPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapObject
的用法示例。
在下文中一共展示了MapObject::GetYPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _UpdateExplore
void MapMode::_UpdateExplore()
{
// First go to menu mode if the user requested it
if(_menu_enabled && InputManager->MenuPress()) {
MenuMode *MM = new MenuMode();
ModeManager->Push(MM);
return;
}
// Only update the status effect supervisor in Exploration mode
// and if they are allowed.
if (_status_effects_enabled)
_status_effect_supervisor.UpdateEffects();
// Update the running state of the camera object. Check if the character is running and if so,
// update the stamina value if the operation is permitted
_camera->is_running = false;
if(_camera->moved_position && !_running_disabled && InputManager->CancelState() &&
(InputManager->UpState() || InputManager->DownState() || InputManager->LeftState() || InputManager->RightState())) {
if(_unlimited_stamina) {
_camera->is_running = true;
} else if(_run_stamina > SystemManager->GetUpdateTime() * 2) {
_run_stamina -= (SystemManager->GetUpdateTime() * 2);
_camera->is_running = true;
} else {
_run_stamina = 0;
}
}
// Regenerate the stamina at 1/2 the consumption rate
else if(_run_stamina < 10000) {
_run_stamina += SystemManager->GetUpdateTime();
if(_run_stamina > 10000)
_run_stamina = 10000;
}
// If the user requested a confirm event, check if there is a nearby object that the player may interact with
// Interactions are currently limited to dialogue with sprites and opening of treasures
if(InputManager->ConfirmPress()) {
MapObject *obj = _object_supervisor->FindNearestInteractionObject(_camera);
if(obj != NULL) {
if(obj->GetType() == PHYSICAL_TYPE) {
PhysicalObject *phs = reinterpret_cast<PhysicalObject *>(obj);
if(!phs->GetEventIdWhenTalking().empty()) {
_camera->moving = false;
_camera->is_running = false;
if (!_event_supervisor->IsEventActive(phs->GetEventIdWhenTalking()))
_event_supervisor->StartEvent(phs->GetEventIdWhenTalking());
return;
}
}
else if(obj->GetType() == SPRITE_TYPE) {
MapSprite *sp = reinterpret_cast<MapSprite *>(obj);
if(sp->HasAvailableDialogue()) {
_camera->moving = false;
_camera->is_running = false;
sp->InitiateDialogue();
return;
}
} else if(obj->GetType() == TREASURE_TYPE) {
TreasureObject *treasure_object = reinterpret_cast<TreasureObject *>(obj);
if(!treasure_object->GetTreasure()->IsTaken()) {
_camera->moving = false;
treasure_object->Open();
}
} else if(obj->GetType() == SAVE_TYPE && _save_points_enabled) {
// Make sure the character will be centered in the save point
SaveMode *save_mode = new SaveMode(true, obj->GetXPosition(), obj->GetYPosition() - 1.0f);
ModeManager->Push(save_mode, false, false);
}
}
}
// Detect movement input from the user
if(InputManager->UpState() || InputManager->DownState() || InputManager->LeftState() || InputManager->RightState()) {
_camera->moving = true;
} else {
_camera->moving = false;
}
// Determine the direction of movement. Priority of movement is given to: up, down, left, right.
// In the case of diagonal movement, the direction that the sprite should face also needs to be deduced.
if(_camera->moving == true) {
if(InputManager->UpState()) {
if(InputManager->LeftState())
_camera->SetDirection(MOVING_NORTHWEST);
else if(InputManager->RightState())
_camera->SetDirection(MOVING_NORTHEAST);
else
_camera->SetDirection(NORTH);
} else if(InputManager->DownState()) {
if(InputManager->LeftState())
_camera->SetDirection(MOVING_SOUTHWEST);
else if(InputManager->RightState())
_camera->SetDirection(MOVING_SOUTHEAST);
else
_camera->SetDirection(SOUTH);
//.........这里部分代码省略.........