Пример #1
0
void checkForMove(ubyte data){
	switch(data){
	case turnRight:
		nxtDisplayTextLine(7, "RIGHT");
		moveRight();
		break;
	case turnLeft:
		nxtDisplayTextLine(7, "LEFT");
		moveLeft();
		break;
	case moveForward:
		nxtDisplayTextLine(7, "FORWARD");
		moveF();
		break;
	case moveBackward:
		nxtDisplayTextLine(7, "BACKWARD");
		moveBack();
		break;
	case goBack:
		comeBack();
		break;
	case stopMoving:
		nxtDisplayTextLine(7, "!!!!!!STOP!!!!!!!!");
		stopAll();
		break;
	default:
		stopAll();
		break;
	}
}
Пример #2
0
void Ship::fly(float& dt, wstring rozkaz, int counterLimit)
{
	
	//int mnoznik = 100;
	movementCounter++;

		vx = vy = 0;
		if (rozkaz == L"lewo" && isStuck == false && isStuckv2 == false) 
			vx += -10;
	
		if (rozkaz == L"prawo" && isStuck == false && isStuckv2 == false) 
			vx += 165;
		
		if (rozkaz == L"gór" && isStuck == false && isStuckv2 == false) 
			vy += -10;
		
		if (rozkaz == L"dół" && isStuck == false && isStuckv2 == false) 
			vy += 165;
		
		if (movementCounter <= counterLimit)
		{
			comeBack();

			x += vx * dt;
			y += vy * dt;
		}
		
		if (movementCounter == counterLimit)
		{
			movementCounter = 0;
			isStuckv2 = true;
		}




}