Example #1
0
// destroy all the sprites and clean up any memory
void destroyGame() {
	//DestroySprite(bgMenu);
	DestroySprite(bgImage);
	DestroySprite(player1.sprite);
	DestroySprite(player2.sprite);
	DestroySprite(ball.sprite);
}
void sub_8137538(void)
{
    if (!ewram17810[gActiveBattler].unk0_3 && !ewram17810[gActiveBattler].unk0_7)
        sub_8141828(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]);

    if (!ewram17810[gActiveBattler ^ 2].unk0_3 && !ewram17810[gActiveBattler ^ 2].unk0_7)
        sub_8141828(gActiveBattler ^ 2, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ 2]]);

    if (!ewram17810[gActiveBattler].unk0_3 && !ewram17810[gActiveBattler ^ 2].unk0_3)
    {
        if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
        {
            DestroySprite(&gSprites[gUnknown_0300434C[gActiveBattler ^ 2]]);
            sub_8045A5C(gHealthboxIDs[gActiveBattler ^ 2], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ 2]], 0);
            sub_804777C(gActiveBattler ^ 2);
            sub_8043DFC(gHealthboxIDs[gActiveBattler ^ 2]);
        }
        DestroySprite(&gSprites[gUnknown_0300434C[gActiveBattler]]);
        sub_8045A5C(gHealthboxIDs[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], 0);
        sub_804777C(gActiveBattler);
        sub_8043DFC(gHealthboxIDs[gActiveBattler]);
        ewram17840.unk9_0 = 0;
        gBattleBankFunc[gActiveBattler] = sub_81376B8;
    }
}
Example #3
0
void destroyTitle()
{
	DestroySprite(titlem);
	DestroySprite(titlepaddle.sprite);
	DestroySprite(titlewall.sprite);
	DestroySprite(titleball.sprite);
	DestroySprite(cursor.sprite);
}
Example #4
0
//destroy all sprites and clean up the memory
void destroyGame()
{
	//DestroySprite(g_uiBgImage);
	DestroySprite(g_player1.iSprite);
	DestroySprite(g_player2.iSprite);
	DestroySprite(g_ball.iSprite);
	DestroySprite(g_powerUp.iSprite);
}
void HermiteSpline::Destroy()
{
	DestroySprite(GetSprite("start")->ID);//little ones
	DestroySprite(GetSprite("player")->ID);//player

	for (int i = 0; i < objectList.size(); i++)
	{
		delete objectList[i];
	}

	for (int i = 0; i < curvePoints.size(); i++)
	{
		delete curvePoints[i];
	}
}
Example #6
0
void LERPState::Destroy()
{
	DestroySprite(objectList[0]->ID);
	DestroySprite(objectList[2]->ID);

	for (int i = 0; i < objectList.size(); i++)
	{
		delete objectList[i];
	}

	for (int i = 0; i < curvePoints.size(); i++)
	{
		delete curvePoints[i];
	}
}
Example #7
0
//draw each frame of the game
void drawGame()
{
	static char s_cOutScore1[15] = {'\n'};
	static char s_cOutScore2[15] = {'\n'};

	//DrawSprite(g_uiBgImage);

	DrawSprite(g_ball.iSprite);
	DrawSprite(g_player1.iSprite);
	DrawSprite(g_player2.iSprite);

	sprintf(s_cOutScore1, "Player 1: %d", g_iPlayer1Score);
	sprintf(s_cOutScore2, "Player 2: %d", g_iPlayer2Score);
	//draw the scores
	DrawString(s_cOutScore1, 50, 50, SColour(255,0,0,255));
	DrawString(s_cOutScore2, 1000, 50, SColour(0,255,0,255));

	if(g_iFrameCounter >= 20 && g_bPowerUpVis != true )
	{
		g_bPowerUpVis = true;
	}

	if( g_bPowerUpVis = true )
	{
		if( updatePowerUp(g_powerUp,g_ball,g_player1,g_bPowerUpVis) )
		{
			DrawSprite(g_powerUp.iSprite);
		}
	}

	if(g_bGameOver == true)
	{
		DrawString("Game Over", SCREEN_X / 2, 300);

		char acScore[15];
		int iY = 350;
		for(int i = 0; i < 5; i++)
		{
			if(g_aiHighScores[i] != 0 )
			{
				sprintf(acScore, "player %d: %d", i+1, g_aiHighScores[i]);
				DrawString(acScore, SCREEN_X / 2, iY);
				iY += 30;
			}
		}

		vector2 v2BallPosition = {SCREEN_X / 2, 300};
		g_ball.v2Position = v2BallPosition;
		DestroySprite(g_ball.iSprite);
		DrawSprite(g_ball.iSprite);
		g_ball.v2Speed.fX = 0;
		g_ball.v2Speed.fY = 0;

	}

	
}
Assets::~Assets()
{
	for (int i = 0; i < g_maxSprites; ++i)
		if (sprites[i])	// check for  a max number of sprtes
		{
			DestroySprite(*sprites[i]);						
			delete sprites[i];
		}
}
void sub_813789C(void)
{
    if (!ewram17810[gActiveBattler].unk0_6)
    {
        FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]);
        DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]);
        sub_8043DB0(gHealthboxIDs[gActiveBattler]);
        WallyBufferExecCompleted();
    }
}
Example #10
0
void sub_80DD87C(struct Sprite *sprite)
{
    if (TranslateAnimArc(sprite))
    {
        u8 taskId = FindTaskIdByFunc(sub_80DD604);
        if (taskId != 0xFF)
            gTasks[taskId].data[11]--;

        DestroySprite(sprite);
    }
}
Example #11
0
PyObject* AIE_DestroySprite(PyObject *self, PyObject *args)
{
	unsigned int iSpriteID;
	if (!PyArg_ParseTuple( args, "i", &iSpriteID ) ) 
	{
		ParsePyTupleError( __func__, __LINE__ );
		return nullptr;
	}
	DestroySprite( iSpriteID );
	Py_RETURN_NONE;
}
Example #12
0
void SpriteCB_ResetRtcCusor0(struct Sprite *sprite)
{
    int state = gTasks[sprite->data[0]].data[2];
    if (state != sprite->data[1])
    {
        sprite->data[1] = state;
        switch (state)
        {
        case 1:
            sprite->invisible = FALSE;
            sprite->animNum = 1;
            sprite->animDelayCounter = 0;
            sprite->pos1.x = 53;
            sprite->pos1.y = 68;
            break;
        case 2:
            sprite->invisible = FALSE;
            sprite->animNum = 1;
            sprite->animDelayCounter = 0;
            sprite->pos1.x = 86;
            sprite->pos1.y = 68;
            break;
        case 3:
            sprite->invisible = FALSE;
            sprite->animNum = 1;
            sprite->animDelayCounter = 0;
            sprite->pos1.x = 107;
            sprite->pos1.y = 68;
            break;
        case 4:
            sprite->invisible = FALSE;
            sprite->animNum = 1;
            sprite->animDelayCounter = 0;
            sprite->pos1.x = 128;
            sprite->pos1.y = 68;
            break;
        case 5:
            sprite->invisible = FALSE;
            sprite->animNum = 2;
            sprite->animDelayCounter = 0;
            sprite->pos1.x = 155;
            sprite->pos1.y = 80;
            break;
        case 6:
            DestroySprite(sprite);
            break;
        }
    }
}
Example #13
0
static void sub_80CC408(struct Sprite* sprite)
{
    sprite->data[0]++;
    if (sprite->data[0] > 1)
    {
        sprite->data[0] = 0;
        sprite->invisible ^= 1;
        sprite->data[1]++;
        if (sprite->data[1] > 8)
        {
            gTasks[sprite->data[6]].data[sprite->data[7]]--;
            DestroySprite(sprite);
        }
    }
}
void WallyHandleReturnPokeToBall(void)
{
    if (gBattleBufferA[gActiveBattler][1] == 0)
    {
        move_anim_start_t4(gActiveBattler, gActiveBattler, gActiveBattler, 1);
        gBattleBankFunc[gActiveBattler] = sub_813789C;
    }
    else
    {
        FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]);
        DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]);
        sub_8043DB0(gHealthboxIDs[gActiveBattler]);
        WallyBufferExecCompleted();
    }
}
Example #15
0
static void sub_80C60CC(struct Sprite *sprite)
{
    sprite->pos1.x += sprite->data[0];
    if (sprite->pos1.x < -0x08 || sprite->pos1.x > 0xf8)
    {
        DestroySprite(sprite);
        gUnknown_020387EC->unk0A++;
        if (gUnknown_020387EC->unk0A == 8)
        {
            FreeSpriteTilesByTag(gUnknown_020387EC->tileTag);
            FreeSpritePaletteByTag(gUnknown_020387EC->paletteTag);
            BlendPalettes(gUnknown_020387EC->selectedPalettes, 0, FADE_COLOR_WHITE);
            SetHBlankCallback(sub_80C6078);
        }
    }
}
Example #16
0
static void sub_80CA8B4(struct Sprite* sprite)
{
    if (TranslateAnimSpriteByDeltas(sprite))
    {
        DestroySprite(sprite);
    }
    else
    {
        if (sprite->data[5] > 0x7F)
        {
            sprite->subpriority = sub_8079E90(gAnimBankTarget) + 1;
        }
        else
        {
            sprite->subpriority = sub_8079E90(gAnimBankTarget) + 6;
        }
        sprite->pos2.x += Sin(sprite->data[5], 5);
        sprite->pos2.y += Cos(sprite->data[5], 14);
        sprite->data[5] = (sprite->data[5] + 15) & 0xFF;
    }
}
Example #17
0
//update the power-up's status: Is it activated or not?
bool updatePowerUp(movableObject &objPowerUp, movableObject &objBall, movableObject &objPlayer, bool bPowerUpVisible)
{
	g_bPowerUp = bPowerUpVisible;

	if( g_bPowerUpON == true )
	{
		g_iPlayerSpeed = 8;
		g_iPowerUpCount++;
	}
	else
	{
		g_iPlayerSpeed = 5;
	}

	//is the ball and powerup colliding?
	if( checkCollision(objPowerUp, objBall, true) && g_bPowerUp == true )
	{
		//we've collided, so get rid of it
		DestroySprite(objPowerUp.iSprite);
		//powerup is currently running
		g_bPowerUpON = true;
		//powerup is not visible
		g_bPowerUp = false;
	}

	if( g_iPowerUpCount >= 20000 )
	{
		//turn off the powerup
		g_bPowerUpON = false;
		//reset the counter
		g_iPowerUpCount = 0;
	}

	//return whether the powerup is visible or not so we know whether to draw it
	return g_bPowerUp;
}
Example #18
0
void iGameObjectVis::OnDestroy()
{
    DestroySprite();
}
Example #19
0
void Powerup::destroySprites() {
	DestroySprite(texture);
}
Example #20
0
static void sub_80CBF5C(u8 taskId)
{
    struct Task* task = &gTasks[taskId];
    struct Sprite* sprite = &gSprites[task->data[2]];
    int a = task->data[0];
    switch (a)
    {
    case 4:
        sub_80CC358(task, taskId);
        if (TranslateAnimArc(sprite) == 0)
        {
            break;
        }
        else
        {
            task->data[15] = 5;
            task->data[0] = 0xFF;
        }
        break;
    case 8:
        sub_80CC358(task, taskId);
        if (TranslateAnimArc(sprite) == 0)
        {
            break;
        }
        else
        {
            task->data[15] = 9;
            task->data[0] = 0xFF;
        }
        break;
    case 0:
        sub_80CC358(task, taskId);
        if (TranslateAnimArc(sprite) == 0)
            break;

        task->data[15] = 1;
        task->data[0] = 0xFF;
        break;
    case 1:
        sprite->pos1.x += sprite->pos2.x;
        sprite->pos1.y += sprite->pos2.y;
        sprite->pos2.x = 0;
        sprite->pos2.y = 0;
        sprite->data[0] = 10;
        sprite->data[1] = sprite->pos1.x;
        sprite->data[2] = task->data[6];
        sprite->data[3] = sprite->pos1.y;
        sprite->data[4] = task->data[7];
        sprite->data[5] = sub_80CC338(sprite);
        task->data[4] += 2;
        task->data[3] = a;
        sprite->subpriority = task->data[4];
        StartSpriteAnim(sprite, task->data[3]);
        InitAnimArcTranslation(sprite);
        task->data[0]++;
        break;
    case 2:
        sub_80CC358(task, taskId);
        if (TranslateAnimArc(sprite) == 0)
            break;

        task->data[15] = 3;
        task->data[0] = 0xFF;
        break;
    case 3:
        sprite->pos1.x += sprite->pos2.x;
        sprite->pos1.y += sprite->pos2.y;
        sprite->pos2.x = 0;
        sprite->pos2.y = 0;
        sprite->data[0] = 10;
        sprite->data[1] = sprite->pos1.x;
        sprite->data[2] = task->data[6] - ((task->data[10] / 2) + 10) * task->data[5];
        sprite->data[3] = sprite->pos1.y;
        sprite->data[4] = task->data[7] - ((task->data[11] / 2) + 10) * task->data[5];
        sprite->data[5] = sub_80CC338(sprite);
        task->data[3] = 2;
        sprite->subpriority = task->data[4];
        StartSpriteAnim(sprite, task->data[3]);
        InitAnimArcTranslation(sprite);
        task->data[0]++;
        break;
    case 5:
        sprite->pos1.x += sprite->pos2.x;
        sprite->pos1.y += sprite->pos2.y;
        sprite->pos2.x = 0;
        sprite->pos2.y = 0;
        sprite->data[0] = 10;
        sprite->data[1] = sprite->pos1.x;
        sprite->data[2] = task->data[6] + ((task->data[10] / 2) + 10) * task->data[5];
        sprite->data[3] = sprite->pos1.y;
        sprite->data[4] = task->data[7] + ((task->data[11] / 2) + 10) * task->data[5];
        sprite->data[5] = sub_80CC338(sprite);
        task->data[4] -= 2;
        task->data[3] = 3;
        sprite->subpriority = task->data[4];
        StartSpriteAnim(sprite, task->data[3]);
        InitAnimArcTranslation(sprite);
        task->data[0]++;
        break;
    case 6:
        sub_80CC358(task, taskId);
        if (TranslateAnimArc(sprite) == 0)
            break;

        task->data[15] = 7;
        task->data[0] = 0xFF;
        break;
    case 7:
        sprite->pos1.x += sprite->pos2.x;
        sprite->pos1.y += sprite->pos2.y;
        sprite->pos2.x = 0;
        sprite->pos2.y = 0;
        sprite->data[0] = 10;
        sprite->data[1] = sprite->pos1.x;
        sprite->data[2] = task->data[6];
        sprite->data[3] = sprite->pos1.y;
        sprite->data[4] = task->data[7];
        sprite->data[5] = sub_80CC338(sprite);
        task->data[4] += 2;
        task->data[3] = 4;
        sprite->subpriority = task->data[4];
        StartSpriteAnim(sprite, task->data[3]);
        InitAnimArcTranslation(sprite);
        task->data[0]++;
        break;
    case 9:
        sprite->pos1.x += sprite->pos2.x;
        sprite->pos1.y += sprite->pos2.y;
        sprite->pos2.x = 0;
        sprite->pos2.y = 0;
        sprite->data[0] = 10;
        sprite->data[1] = sprite->pos1.x;
        sprite->data[2] = task->data[6] - ((task->data[10] / 2) + 10) * task->data[5];
        sprite->data[3] = sprite->pos1.y;
        sprite->data[4] = task->data[7] + ((task->data[11] / 2) + 10) * task->data[5];
        sprite->data[5] = sub_80CC338(sprite);
        task->data[3] = 5;
        sprite->subpriority = task->data[4];
        StartSpriteAnim(sprite, task->data[3]);
        InitAnimArcTranslation(sprite);
        task->data[0]++;
        break;
    case 10:
        sub_80CC358(task, taskId);
        if (TranslateAnimArc(sprite) == 0)
        {
            break;
        }
        else
        {
            task->data[15] = 11;
            task->data[0] = 0xFF;
        }
        break;
    case 11:
    {
        sprite->pos1.x += sprite->pos2.x;
        sprite->pos1.y += sprite->pos2.y;
        sprite->pos2.x = 0;
        sprite->pos2.y = 0;
        sprite->data[0] = 10;
        sprite->data[1] = sprite->pos1.x;
        sprite->data[2] = task->data[8];
        sprite->data[3] = sprite->pos1.y;
        sprite->data[4] = task->data[9];
        sprite->data[5] = sub_80CC338(sprite);
        task->data[4] -= 2;
        task->data[3] = 6;
        sprite->subpriority = task->data[4];
        StartSpriteAnim(sprite, task->data[3]);
        InitAnimArcTranslation(sprite);
        task->data[0]++;
        break;
    }
    case 12:
        sub_80CC358(task, taskId);
        if (TranslateAnimArc(sprite) != 0)
        {
            DestroySprite(sprite);
            task->data[0]++;
        }
        break;
    case 13:
        if (task->data[12] == 0)
        {
            DestroyAnimVisualTask(taskId);
        }
        break;
    case 255:
        task->data[1]++;
        if (task->data[1] > 5)
        {
            task->data[1] = 0;
            task->data[0] = task->data[15];
        }
        break;
    }
}
Example #21
0
void destroySplash()
{
	DestroySprite(splashbackground.sprite);
	DestroySprite(splashbackground2.sprite);
	DestroySprite(splashoverlay.sprite);
	DestroySprite(splashoverlay2.sprite);
	DestroySprite(enemyOne.sprite);
	DestroySprite(enemyTwo.sprite);
	DestroySprite(enemyThree.sprite);
	DestroySprite(bulletOne.sprite);
	DestroySprite(bulletTwo.sprite);
	DestroySprite(bulletThree.sprite);
	DestroySprite(explodeOne.sprite);
	DestroySprite(explodeTwo.sprite);
	DestroySprite(explodeThree.sprite);
	DestroySprite(ship.sprite);
	DestroySprite(huge.sprite);
	DestroySprite(title.sprite);
}
Player::~Player()
{
	DestroySprite(textureID);
	path.clear();
}
Example #23
0
void Projectile::destroySprites() {
	DestroySprite(texture);
}
Example #24
0
int main( int arc, char* argv[] )
{	
	// First we need to create our Game Framework
	Initialise( width, height, false );
// Now load some sprites
	unsigned int BackgroundSprite = CreateSprite( "images/background.png", 1280, 780, false );
	unsigned int PaddleLeftSprite = CreateSprite( "images/Paddle.png", 32, 64, true );
	unsigned int PaddleRightSprite = CreateSprite( "images/Paddle.png", 32, 64, true );
	unsigned int BallSprite = CreateSprite( "images/Ball.png", 32, 32, true );
	unsigned int Header = CreateSprite( "images/Header.png", 444, 128, true );

//setup all the variables
	int paddleleftx = 100;
	int paddlelefty = height/2;
	int paddleleftyvar = 0;

	int paddlerightx = width-100;
	int paddlerighty = height/2;
	int paddlerightyvar = 0;
	
	if (xspeed<0){
		bPaddle = 0;}
	else if (xspeed>0){
		bPaddle = 1;
	}
	int iOption = 1;
	int iOptiony = height/2;

//if the ball is in the up/down area, reset it again
	while (xspeed>-2 && xspeed <2){
		srand((unsigned)time(0));	
		xspeed = -5 +(rand() % 10);	
	}
	while (yspeed>-2 && yspeed <2){
		srand((unsigned)time(0));	
		yspeed = -5 +(rand() % 10);	
	}

	glClearColor(0.0f,0.0f,0.0f,0);
	do{

		fDeltaTime = (clock() - fLastTime)/(float)CLOCKS_PER_SEC;
		fLastTime = clock();

		if (!IsKeyDown(GLFW_KEY_SPACE)){
			bCanCheck[0]=true;
		}
		if (!IsKeyDown(GLFW_KEY_ENTER)){
			bCanCheck[1]=true;
		}
		if (!IsKeyDown(GLFW_KEY_BACKSPACE)){
			bCanCheck[2]=true;
		}
		if (!IsKeyDown(GLFW_KEY_UP)){
			bCanCheck[3]=true;
		}
		if (!IsKeyDown(GLFW_KEY_DOWN)){
			bCanCheck[4]=true;
		}
		switch (Menu){
/////////////////////////////////////////////////////////////////////////////////////////////////////GAME CASE////////////////////////////////////////////////////////////////////////////////////////////////////////////
		case 0:
//make sure the game doesnt "flash" with keypress's on menus by clearing all old objects
		ClearScreen();
//controls & movement
		if ( IsKeyDown('W') && paddlelefty>64)      {paddleleftyvar--;}
		if ( IsKeyDown('S') && paddlelefty<height-64) {paddleleftyvar++;}
		
		if ( IsKeyDown(GLFW_KEY_UP) && paddlerighty>64 )      {paddlerightyvar--;} 
		if ( IsKeyDown(GLFW_KEY_DOWN) && paddlerighty<height-64){paddlerightyvar++;}
//left
		if (paddlelefty>=64 && paddlelefty<=height-64){
			paddlelefty += paddleleftyvar * 10.0f * fDeltaTime;
		}else {
			paddleleftyvar = 0; if (paddlelefty>height/2) {paddlelefty=height-64;}else{paddlelefty=64;}
			}
//right
		if (paddlerighty>=64 && paddlerighty<=height-64){
			paddlerighty += paddlerightyvar * 10.0f * fDeltaTime;
		}else {
			paddlerightyvar=0; if (paddlerighty>height/2) {paddlerighty=height-64;}else{paddlerighty=64;}
		}
		ballx += xspeed * 100.0f * fDeltaTime;
		bally += yspeed * 100.0f * fDeltaTime;

//ball collisions
//outside left/right and top/bottom bounce
//add to score
		if (ballx>=width){iScore[1]++;} 
		if (ballx<=0)    {iScore[0]++;}
//reset room
		if (ballx<=0 || ballx>=width){ 
			BallReset();
		}
		if (bally<=0 || bally>=height){
			yspeed *= -1;
		}
//stop the ball going to fast
		if (xspeed>10) {xspeed=10; }
		if (xspeed<-10){xspeed=-10;}
		if (yspeed>10) {yspeed=10; }
		if (yspeed<-10){yspeed=-10;}
//paddle left
		if (ballx<=paddleleftx+16 && bPaddle == 0){
			if       (bally<paddlelefty-28 && bally>paddlelefty-64){
				xspeed *= -3 * 100.0f * fDeltaTime;
				yspeed *= 2 * 100.0f * fDeltaTime;
			}else if (bally<paddlelefty+28 && bally>paddlelefty-28){
				yspeed *= -1 * 100.0f * fDeltaTime;
				xspeed *= -1 * 100.0f * fDeltaTime;
			}else if (bally<paddlelefty+64 && bally>paddlelefty+28){
				xspeed *= -3 * 100.0f * fDeltaTime;
				yspeed *= -2 * 100.0f * fDeltaTime;
			}
		bPaddle = 1;
		}
//paddle right
		if (ballx>=paddlerightx-16 && bPaddle == 1){
			if       (bally<paddlerighty-28 && bally>paddlerighty-64){
				xspeed *= -3;
				yspeed *= 2;
			}else if (bally<paddlerighty+28 && bally>paddlerighty-28){
				yspeed *= -1;
				xspeed *= -1;
			}else if (bally<paddlerighty+64 && bally>paddlerighty+28){
				xspeed *= -3;
				yspeed *= -2;
			}
		bPaddle = 0;
		}
//draw the instances
		DrawSprite(BackgroundSprite);
		MoveSprite( BackgroundSprite, 0, 0);
		DrawSprite(PaddleLeftSprite);
		DrawSprite(PaddleRightSprite);
		DrawSprite(BallSprite);
//draw the middle
		DrawLine(width/2,  0,  width/2,  height,  SColour(0x00,0x00,0x00,0xAA) );
//move the instances
		MoveSprite( PaddleLeftSprite, paddleleftx, paddlelefty );
		MoveSprite( PaddleRightSprite, paddlerightx, paddlerighty);
		MoveSprite( BallSprite, ballx, bally );
//convert the int's to strings and draw thw score
		DrawInt(iScore[0],(width/4)*3, 32);
		DrawInt(iScore[1],(width/4), 32);
//if someone has won, change the screen to say so.
		for (int i = 0; i<=1; i++){
			if (iScore[i] >= 10){
				winner = i;
				Menu = 2;
			}
		}
//debug information
		if (debug==true){
//hitlines
		DrawHitline(paddleleftx+16,paddlelefty);
		DrawHitline(paddlerightx-16,paddlerighty);
//vars	
		std::cout << "paddlelefty : " << paddlelefty<< std::endl;
		std::cout << "paddleleftyvar : " << paddleleftyvar<< std::endl;
		std::cout << "paddlerighty : " << paddlerighty<< std::endl;
		std::cout << "paddlerightyvar : " << paddlerightyvar<< std::endl;
		std::cout << "ballx : " << ballx<< std::endl;
		std::cout << "bally : " << bally<< std::endl;
		std::cout << "xspeed : " << xspeed<< std::endl;
		std::cout << "yspeed : " << yspeed<< std::endl;
		}
//Checks to set the debug to show or no
		if (IsKeyDown(GLFW_KEY_BACKSPACE) && bCanCheck[2] == true){
			if (debug==true ){
				debug=false;
				bCanCheck[2]=false;
			}else if (debug==false){
				debug=true;
				bCanCheck[2]=false;
			}
		}
		//add to the timer
		break;
///////////////////////////////////////////////////////////////////////////////////////////////////MAIN MENU//////////////////////////////////////////////////////////////////////////////////////////////////////////////
		case 1:
			ClearScreen();
			//sets the screen to black
			//draws the information
			DrawSprite(BackgroundSprite);
			MoveSprite( BackgroundSprite, 0, 0);
			DrawSprite(Header);
			MoveSprite( Header, width/2, height/8 );
//fake objects
			MoveSprite( BallSprite, width/2, iOptiony );
			DrawSprite(BallSprite);
			MoveSprite( PaddleLeftSprite, 100, height/2 );
			DrawSprite(PaddleLeftSprite);
			MoveSprite( PaddleRightSprite, width-100, height/2 );
			DrawSprite(PaddleRightSprite);
			DrawString( "Scores", width/2+32, height/2-48 );
			DrawString( "Play Game", width/2+32, height/2-16 );
			DrawString( "Quit",  width/2+32, height/2+16 );
			DrawString( "Controls", (width/2)+32, height/2+48 );

			switch (iOption){
			case 0:
				iOptiony = (height/2)-32;
				break;
			case 1:
				iOptiony = (height/2);
				break;
			case 2:
				iOptiony = (height/2)+32;
				break;
			case 3:
				iOptiony = (height/2)+64;
				break;
			default:
				break;
			}
			if (IsKeyDown(GLFW_KEY_DOWN) && bCanCheck[4] == true){
				bCanCheck[4]=false;
				iOption++;
				if (iOption>3){iOption=0;}
			}
			if (IsKeyDown(GLFW_KEY_UP) && bCanCheck[3] == true){
				bCanCheck[3]=false;
				iOption--;
				if (iOption<0){iOption=3;}
			}
			if (IsKeyDown(GLFW_KEY_ENTER) && bCanCheck[1] == true){
				bCanCheck[1] = false;
				switch (iOption){
				case 0:
					Menu = 2;//goto the highscores
					break;
				case 1:
					//reset the winner and score
					winner=-1;
					iScore[0]=0;
					iScore[1]=0;
					//reset the ball
					BallReset();
					//reset the paddles
					paddlelefty = height/2;
					paddleleftyvar = 0;
					paddlerighty = height/2;
					paddlerightyvar = 0;
					Menu = 0;//goto the game
					break;
				case 2:
					bQuitGame = true;
					break;
				case 3:
					Menu = 3;//goto the Controls Page
					break;
				}
			}			
			//go to game when pressed
		break;
////////////////////////////////////////////////////////////////////////////////////////////////////////WIN SCREEN////////////////////////////////////////////////////////////////////////////////////////////////////////
		case 2:
//draw the win screen
			ClearScreen();
			DrawSprite(BackgroundSprite);
			MoveSprite( BackgroundSprite, 0, 0);
			DrawSprite(Header);
			MoveSprite( Header, width/2, height/8 );
//draw the background pong items
			MoveSprite( BallSprite, width/2, height/2-32 );
			DrawSprite(BallSprite);
			MoveSprite( PaddleLeftSprite, 100, height/2 );
			DrawSprite(PaddleLeftSprite);
			MoveSprite( PaddleRightSprite, width-100, height/2 );
			DrawSprite(PaddleRightSprite);
//draw old menu
			DrawString( "Play Game", width/2+32, height/2-16 );
			DrawString( "Controls", (width/2)+32, height/2+48 );
			DrawString( "Quit", (width/2)+32, height/2+16 );
//draw new items with some indentation
			DrawString( "  Scores", width/2+32, height/2-48 );
			switch (winner){
			case 0:
			DrawString("  Player One Wins", (width/2)+32, height/2-112 );
			break;
			case 1:
			DrawString("  Player Two Wins", (width/2)+32, height/2-112 );
			break;
			}
		DrawString("  Enter to return to the main menu.", (width/2)+32, height/2-80 );
//back to the main menu
		if (IsKeyDown(GLFW_KEY_ENTER) && bCanCheck[1] == true){
				//goto the main menu
				Menu = 1;
				iOptiony = 1;
				bCanCheck[1] = false;
			}
		if (IsKeyDown(GLFW_KEY_DOWN) && bCanCheck[4] == true){
				//goto the main menu
				Menu = 1;
				iOptiony = 1;
				bCanCheck[4] = false;
			}
		break;
///////////////////////////////////////////////////////////////////////////////////////////////////////////CONTROLS//////////////////////////////////////////////////////////////////////////////////////////////////////
		case 3:
		ClearScreen();
//draw the pong background
			DrawSprite(BackgroundSprite);
			MoveSprite( BackgroundSprite, 0, 0);
			DrawSprite(Header);
			MoveSprite( Header, width/2, height/8 );
			
			MoveSprite( BallSprite, width/2, iOptiony );
			DrawSprite(BallSprite);
			MoveSprite( PaddleLeftSprite, 100, height/2 );
			DrawSprite(PaddleLeftSprite);
			MoveSprite( PaddleRightSprite, width-100, height/2 );
			DrawSprite(PaddleRightSprite);
//draw old menu
			DrawString( "Scores", width/2+32, height/2-48 );
			DrawString( "Play Game", width/2+32, height/2-16 );
			DrawString( "Quit", (width/2)+32, height/2+16 );
//draw new items with some indentation
			DrawString( "  Controls", (width/2)+32, height/2+48 );
			DrawString( "  Payer Left, W is up, S is down.", (width/2)+32, height/2+80 );

			DrawString( "  Player Right, Arrow Up is up, Arrow Down is down.",width/2+32, height/2+112 );
			DrawString( "  Enter to return to main menu.", width/2+32, height/2+144 );
//check if up or enter is pressed to go back
		if (IsKeyDown(GLFW_KEY_ENTER) && bCanCheck[1] == true){
				//goto the main menu
				Menu = 1;
				iOptiony = 1;
				bCanCheck[1] = false;
			}
		if (IsKeyDown(GLFW_KEY_UP) && bCanCheck[3] == true){
				//goto the main menu
				Menu = 1;
				iOptiony = 1;
				bCanCheck[3] = false;
			}
		break;
/////////////////////////////////////////////////////////////////////////////////////////////////////DESTROY EVERYTHING//////////////////////////////////////////////////////////////////////////////////////////////////
}
	} while ( FrameworkUpdate() == false && !bQuitGame == true);
//destroy all objects clearing them on game exit
	DestroySprite(PaddleLeftSprite);
	DestroySprite(PaddleRightSprite);
	DestroySprite(BallSprite);
	DestroySprite(Header);
	DestroySprite(BackgroundSprite);
	Shutdown();
//programming signature
	std::cout << "So long, and thanks for all the fish!";
	return 0;
}
Example #25
0
RedBullet::~RedBullet(void) {
	DestroySprite(spriteID);
};
Example #26
0
void SplashScreen::Destroy()
{
	DestroySprite(splashSprite);
}
Example #27
0
void Bilbo::destroy()
{
	DestroySprite(m_sprite);
}
Example #28
0
// calls the DrawSprite function from the AIE Framework
void Sprite::Destroy()
{
	DestroySprite(m_iSpriteId);
}
Example #29
0
// to be executed when state is popped from end of stack
void IntroState::Cleanup()
{
	// **clean stuff? (sprite & fader?)**
	DestroySprite(m_iBG);
	printf("IntroState Cleanup\n");
}