void Robot::moveDown() { if (isFloating()) { pos.y -= step; if (isFloating()) { if (hasBaseColision()) pos.y += step; } else checkMovement(); } }
//Begins Text Input void getText(char *buffer) { int FINISHED = 0; clearScreen(); setupInterrupts(); initializeSprites(); drawKeyboard(); playBG = TRUE; while(!FINISHED) { if(playBG && !BGplaying) { // play the bg music DMA[2].cnt |= DMA_ON; REG_TM1CNT |= TM_ON; startBG = vblankcount; BGplaying = TRUE; DMA[2].src = flute; } checkMovement(); //Check Input and End Function if finished if(!endInput) { checkSelection(buffer); copyShadow(); waitForVblank(); moveSpriteToMem(); } else { DMA[2].cnt &= ~DMA_ON; REG_TM1CNT &= ~TM_ON; playBG = FALSE; waitForVblank(); FINISHED = 1; resetVariables(); endInput = 0; resetCursor(); } } clearScreen(); }
void CCharacter::UpdateCharacter(vfloat32 time) { if(_movementList[_indexMovement] != NULL){ _movementList[_indexMovement]->UpdateMovement(time); } if(_someProjActive){ _someProjActive = false; for(vu8 i = 0; i < _maxActiveMovement; ++i){ if(_activeProjMovements[i] != NULL){ if(_activeProjMovements[i]->isActivated()){ _activeProjMovements[i]->UpdateMovement(time); if(_activeProjMovements[i]->isActivated()){ _someProjActive = true; }else{ _activeProjMovements[i] = NULL; } } } // end if } } // some proj Activae if(isPNJ()){ checkMovementPNJ(); }else{ checkMovement(); } if(_jumping != CInputs::DirStand){ executeJump(); } if(_commands[0] != CInputs::Stand){ //printf("\n %d %d %s ",_indexMovement ,_commnads[0], CInputs::getInstance()->commandToString(_commnads[0]) ); } } // UpdateCharacter
void StepperControlAxis::checkTiming() { int i; moveTicks++; if (axisActive) { if (moveTicks >= stepOffTick) { // Negative flank for the steps resetMotorStep(); checkMovement(); } else { if (moveTicks == stepOnTick) { // Positive flank for the steps setStepAxis(); } } } }
//Begins Text Input void getText(char *buffer) { setRegister(); setupInterrupts(); initializeTiles(); initializeSprites(); drawKeyboard(); playBG = TRUE; while(1) { if(playBG && !BGplaying) { // play the bg music DMA[2].cnt |= DMA_ON; REG_TM1CNT |= TM_ON; startBG = vblankcount; BGplaying = TRUE; DMA[2].src = flute; } checkMovement(); if(!endInput) { checkSelection(buffer); } else { DMA[2].cnt &= ~DMA_ON; REG_TM1CNT &= ~TM_ON; playBG = FALSE; waitForVblank(); } copyShadow(); waitForVblank(); moveSpriteToMem(); } }
void Robot::setPosition(const Position& p) { pos.x = p.x; pos.y = p.y; pos.z = p.z; checkMovement(); }
void Player2::Update(double dt) { if (std::all_of(moveToDir.begin(), moveToDir.end(), [](bool v){return !v; })) // Check if all boolean in vector list are false { if (Application::IsKeyPressed(VK_UP) && !checkCollision(2)) checkMovement(2, dt); else if (Application::IsKeyPressed(VK_LEFT) && !checkCollision(0)) checkMovement(0, dt); else if (Application::IsKeyPressed(VK_DOWN) && !checkCollision(3)) checkMovement(3, dt); else if (Application::IsKeyPressed(VK_RIGHT) && !checkCollision(1)) checkMovement(1, dt); if (Application::IsKeyPressed(VK_UP) || Application::IsKeyPressed(VK_LEFT) || Application::IsKeyPressed(VK_DOWN) || Application::IsKeyPressed(VK_RIGHT)) { if (!SE_Engine.isSoundPlaying(SoundList[ST_FOOTSTEPS])) SE_Engine.playSound2D(SoundList[ST_FOOTSTEPS]); } if (Application::IsKeyPressed(VK_LBUTTON) && sonarTimer >= sonarCooldown) { LuaScript playerScript("character"); sonarTimer = 0; Sonar *SNR; SNR = new Sonar(); SNR->Init(playerScript.get<float>("player.sonar_radius"), playerScript.get<int>("player.sonar_sides"), playerScript.get<float>("player.sonar_speed")); SNR->GenerateSonar(position, 1); sonarList.push_back(SNR); } else if (Application::IsKeyPressed(VK_RBUTTON) && specialTimer >= specialCooldown && !isSpecial) { specialPos = position; specialTimer = 0; isSpecial = true; } } if (isSpecial && specialCounter < specialDuration) { if (specialTimer2 >= specialROF) { LuaScript playerScript("character"); specialTimer2 = 0; Sonar *SNR; SNR = new Sonar(); SNR->Init(playerScript.get<float>("player.special_radius"), playerScript.get<int>("player.special_sides"), playerScript.get<float>("player.special_speed")); SNR->GenerateSonar(specialPos, 2); sonarList.push_back(SNR); } } if (sonarTimer < sonarCooldown) sonarTimer += dt; if (specialTimer < specialCooldown) specialTimer += dt; if (specialTimer2 < specialROF && isSpecial) specialTimer2 += dt; if (isSpecial) specialCounter += dt; if (specialCounter >= specialDuration) { isSpecial = false; specialCounter = 0; specialTimer2 = 0; specialPos.SetZero(); } for (int i = 0; i < sonarList.size(); ++i) { sonarList[i]->Update(dt); if (sonarList[i]->segmentList.empty()) { delete sonarList[i]; sonarList.erase(sonarList.begin() + i); } } for (int i = 0; i < moveToDir.size(); ++i) { checkDirection(i, dt); } }