示例#1
0
	void CPlayer::update(float mFrameTime)
	{
		Vector2f lastPos{pos};
		float currentSpeed{speed}, lastAngle{angle}, radius{hexagonGame.getRadius()};
		int movement{hexagonGame.getInputMovement()};
		if(hexagonGame.getInputFocused()) currentSpeed = focusSpeed;
		angle += currentSpeed * movement * mFrameTime;

		Vector2f tempPos{getOrbitFromDegrees(startPos, angle, radius)};
		Vector2f pLeftCheck{getOrbitFromDegrees(tempPos, angle - 90, 0.01f)};
		Vector2f pRightCheck{getOrbitFromDegrees(tempPos, angle + 90, 0.01f)};

		for(const auto& wall : getManager().getComponents<CWall>("wall"))
		{
			if(movement == -1 && wall->isOverlapping(pLeftCheck)) angle = lastAngle;
			if(movement == 1 && wall->isOverlapping(pRightCheck)) angle = lastAngle;
			if(wall->isOverlapping(pos))
			{
				if(!getInvincible()) dead = true;
				lastPos = getMovedTowards(lastPos, {0, 0}, 5 * hexagonGame.getSpeedMultiplier());
				pos = lastPos; hexagonGame.death(); return;
			}
		}

		pos = getOrbitFromDegrees(startPos, angle, radius);
	}
示例#2
0
	void HexagonGame::checkAndSaveScore()
	{
		if(getInvincible()) return;

		string localValidator{getLocalValidator(levelData.getId(), difficultyMult)};
		if(getScore(localValidator) < status.currentTime) setScore(localValidator, status.currentTime);
		saveCurrentProfile();

		if(status.scoreInvalid || !isEligibleForScore()) return;

		string validator{Online::getValidator(levelData.getPackPath(), levelData.getId(), levelData.getLevelRootPath(), levelData.getStyleRootPath(), levelData.getLuaScriptPath())};
		Online::startSendScore(toLower(getCurrentProfile().getName()), validator, difficultyMult, status.currentTime);
	}
示例#3
0
		bool isEligibleForScore()
		{
			if(!getOfficial())								{ uneligibilityReason = "official mode off"; return false; }
			if(getDebug())									{ uneligibilityReason = "debug mode on"; return false; }
			if(!getAutoZoomFactor())						{ uneligibilityReason = "modified zoom factor"; return false; }
			if(getPlayerSpeed() != 9.45f)					{ uneligibilityReason = "player speed modified"; return false; }
			if(getPlayerFocusSpeed() != 4.625f)				{ uneligibilityReason = "player focus speed modified"; return false; }
			if(getPlayerSize() != 7.3f)						{ uneligibilityReason = "player size modified"; return false; }
			if(getInvincible())								{ uneligibilityReason = "invincibility on"; return false; }
			if(getNoRotation())								{ uneligibilityReason = "rotation off"; return false; }
			if(Online::getServerVersion() == -1)			{ uneligibilityReason = "connection error"; return false; }
			if(Online::getServerVersion() > getVersion())	{ uneligibilityReason = "version mismatch"; return false; }
			return true;
		}
示例#4
0
	void HexagonGame::death()
	{
		playSound("death.ogg");
		playSound("gameOver.ogg");

		if(getInvincible()) return;

		status.flashEffect = 255;
		shakeCamera(effectTimelineManager, overlayCamera);
		shakeCamera(effectTimelineManager, backgroundCamera);
		for(auto& depthCamera : depthCameras) shakeCamera(effectTimelineManager, depthCamera);
		status.hasDied = true;
		stopLevelMusic();
		checkAndSaveScore();

		if(getAutoRestart()) status.mustRestart = true;
	}