//method to update the player within the game loop void Application::updatePlayer() { player.playerPos = {player.posX, player.posY, 100, 100}; player.playerAnim = {player.frame_x*W, player.frame_y*H, W, H}; cameraPos = {player.posX-500,0, 1100, 700}; checkShots();//decides whether to set the shotFlag }
bool Diving::play(uint16 playerCount, bool hasPearlLocation) { init(); initScreen(); initCursor(); _vm->_draw->blitInvalidated(); _vm->_video->retrace(); while (!_vm->shouldQuit()) { evilFishEnter(); checkShots(); updateAnims(); _vm->_draw->animateCursor(1); _vm->_draw->blitInvalidated(); _vm->_util->waitEndFrame(); _vm->_util->processInput(); int16 mouseX, mouseY; MouseButtons mouseButtons; int16 key = checkInput(mouseX, mouseY, mouseButtons); if (key == kKeyEscape) break; if (mouseButtons == kMouseButtonsLeft) shoot(mouseX, mouseY); if ((_whitePearlCount >= 20) || (_blackPearlCount >= 2)) break; } deinit(); return _blackPearlCount >= 2; }