示例#1
0
bool DBBitmapHelper::DeleteBitmapRange(int maxBitmapID)
{

	for(int i=minBitmapID; i<=maxBitmapID;  i++)
	{
		dbDeleteSprite(i);
	} 
	
	DBHelper::GetInstance()->SetBitmapNumber(minBitmapID);
	
	return true; 
}
示例#2
0
void pollo::setPos()
{
	
	float t;
	float y;
	float angle=calculoAngulo();
	float Vx=calculoVelocidad()*(cos(angle));
	float Vy=calculoVelocidad()*(sin(angle));

	if(calculoVelocidad()==0)
	{
		dbDeleteSprite(ID);
	}
	else{
		for(int pixel=0;pixel<1200;pixel+=4)
		{
			t=(pixel+POSXo)/(Vx);
			y=abs((Vy)*t-(5*t*t)-POSYo);
			dbSprite(ID,pixel+POSXo,(int) ceil(y+0.5),1);

			

			if (dbSpriteCollision(ID,enemigo)==1)
			{
				dbDeleteSprite(ID);
				dbDeleteSprite(enemigo);
				return;
			}
			if (dbSpriteCollision(ID,3)==1)
			{
				dbDeleteSprite(ID);
				dbDeleteSprite(3);
				return;
			}
			
			if (dbSpriteCollision(ID,4)==1)
			{
				dbDeleteSprite(ID);
				dbDeleteSprite(4);
				return;
			}

			dbSync();//refrescar la pantalla
						
		}
	}
}
示例#3
0
void world::passGuess(char triggerName[], void *classPointer) { 

	int *currentXCord = static_cast<world*>(classPointer)->currentX;
	int *currentYCord = static_cast<world*>(classPointer)->currentY;
	int numbers = 0;
	char messageTotal[150] = "Well you seem to have the\nurge to leave. Why not stay\nfor a bit though? If you\ntruly want to go, then\nsimply guess the password:"******"";
	int spaceBar = 0;
	int correctPassword = 0;

	dbSyncOn   ( );
	dbSyncRate ( 60 );

	dbLoadImage("textBackground.png",numberOfImages+1);
	dbLoadImage("passwordBackground.png",numberOfImages+2);

	while(LoopGDK() && numbers <= 6){ //Now we have to sustain our environment again.
		dbWait(10); //How quick the message is typed
		//dbCenterText(30,90,dbStr(dbMouseX()));
		//dbCenterText(30,120,dbStr(dbMouseY()));

		static_cast<world*>(classPointer)->updateWorld(*currentXCord,*currentYCord); //Let's send our xCord and yCord that we got to our class.
		dbPasteImage((numberOfImages+1),385,0);
		dbPasteImage((numberOfImages+2),405,200);


		if(messageCharLength < totalLength) { //Just like in our printText function
			messageTemp[messageCharLength] = messageTotal[messageCharLength];
			messageTemp[messageCharLength+1] = '\0';
			messageCharLength++;
		}

		if(dbMouseClick() == 1) {
			if((dbMouseX() >= 449) && (dbMouseX() <= 472) && (dbMouseY() >= 273) && (dbMouseY() <= 297)) { //If our mouse is over the 1 button
				strncat(passwordInput,"1",1);
				numbers++;
				dbPlaySound(12);
			}

			else if((dbMouseX() >= 500) && (dbMouseX() <= 523) && (dbMouseY() >= 273) && (dbMouseY() <= 297)) { //If our mouse is over the 2 button
				strncat(passwordInput,"2",1);
				numbers++;
				dbPlaySound(12);
			}

			else if((dbMouseX() >= 552) && (dbMouseX() <= 575) && (dbMouseY() >= 273) && (dbMouseY() <= 297)) { //If our mouse is over the 3 button
				strncat(passwordInput,"3",1);
				numbers++;
				dbPlaySound(12);
			}

			else if((dbMouseX() >= 449) && (dbMouseX() <= 472) && (dbMouseY() >= 306) && (dbMouseY() <= 330)) { //If our mouse is over the 4 button
				strncat(passwordInput,"4",1);
				numbers++;
				dbPlaySound(12);
			}

			else if((dbMouseX() >= 500) && (dbMouseX() <= 523) && (dbMouseY() >= 306) && (dbMouseY() <= 330)) { //If our mouse is over the 5 button
				strncat(passwordInput,"5",1);
				numbers++;
				dbPlaySound(12);
			}

			else if((dbMouseX() >= 552) && (dbMouseX() <= 575) && (dbMouseY() >= 306) && (dbMouseY() <= 330)) { //If our mouse is over the 6 button
				strncat(passwordInput,"6",1);
				numbers++;
				dbPlaySound(12);
			}

			else if((dbMouseX() >= 449) && (dbMouseX() <= 472) && (dbMouseY() >= 339) && (dbMouseY() <= 363)) { //If our mouse is over the 7 button
				strncat(passwordInput,"7",1);
				numbers++;
				dbPlaySound(12);
			}

			else if((dbMouseX() >= 500) && (dbMouseX() <= 523) && (dbMouseY() >= 339) && (dbMouseY() <= 363)) { //If our mouse is over the 8 button
				strncat(passwordInput,"8",1);
				numbers++;
				dbPlaySound(12);
			}

			else if((dbMouseX() >= 552) && (dbMouseX() <= 575) && (dbMouseY() >= 339) && (dbMouseY() <= 363)) { //If our mouse is over the 9 button
				strncat(passwordInput,"9",1);
				numbers++;
				dbPlaySound(12);
			}

			else if((dbMouseX() >= 500) && (dbMouseX() <= 523) && (dbMouseY() >= 372) && (dbMouseY() <= 396)) { //If our mouse is over the 0 button
				strncat(passwordInput,"0",1);
				numbers++;
				dbPlaySound(12);
			}
			dbWait(300);
		}

		if(numbers == 7) { //Now let's create a local instance of our world for the new mesage
			strcpy(messageTemp,"");
			if(strcmp(passwordInput,"1433434") == 0) {//Now let's check to see if they got the password correct
				strcpy(messageTotal,"Congratulations! That's\nthe right password!");
				correctPassword++;
				dbInk(dbRGB(0,255,0),dbRGB(0,0,0));
				dbPlaySound(14);
			}
			else {
				strcpy(messageTotal,"Sorry, but that's not the\npassword. Please try again.");
				dbInk(dbRGB(255,0,0),dbRGB(0,0,0));
				dbPlaySound(13);
			}
			totalLength = strlen(messageTotal);
			messageCharLength = 0;
			while(LoopGDK() && spaceBar == 0) {
				dbWait(10);
				static_cast<world*>(classPointer)->updateWorld(*currentXCord,*currentYCord); //Let's send our xCord and yCord that we got to our class.
				dbPasteImage((numberOfImages+1),385,0);
				dbPasteImage((numberOfImages+2),405,200);
				
				if(messageCharLength < totalLength) { //Lets loop through our message again.
					messageTemp[messageCharLength] = messageTotal[messageCharLength];
					messageTemp[messageCharLength+1] = '\0'; 
					messageCharLength++;
				}
				if(dbKeyState(57) == 1) {
					spaceBar++;
				}

				dbSetTextSize(36);
				if(correctPassword == 1) {
					dbCenterText(512,12,"Correct");
					dbCenterText(512,42,"Password!:");

				}
				else {
					dbCenterText(512,12,"Incorrect");
					dbCenterText(512,42,"Password:"******"Guess The");
			dbCenterText(512,42,"Password:");
			dbSetTextSize(12);
			dbText(395,85,messageTemp);
			dbSetTextSize(36);
			dbText(455,220,passwordInput);
			dbSync();
		}
	}
	if(correctPassword == 1){
		for(int i = 0; i <= 100; i++) {
			dbDeleteSprite(i);
			dbSync();
		}
		endingScreen(classPointer); //Go to the ending screen, since you won!

	}
	dbWait(300);	
}