_bSplash = TRUE; A big part of making the splash screen work properly is disabling parts of the game when the game is in splash screen mode. Listing 22.1 contains the code for the GameActivate() and GameDeactivate() functions, which check the value of the _bSplash variable before resuming or pausing the MIDI background music. Listing 22.1 The GameActivate() and GameDeactivate() Functions Check the Value of the _bSplash Variable Before Resuming or Pausing the MIDI Background Music 1: void GameActivate(HWND hWindow) 2: { 3: if (!_bSplash) 4: // Resume the background music 5: _pGame->PlayMIDISong(TEXT(”"), FALSE); 6: } 7: 8: void GameDeactivate(HWND hWindow) 9: { 10: if (!_bSplash) 11: // Pause the background music 12: _pGame->PauseMIDISong(); 13: } There isn’t too much explanation required for these functions because they simply check the _bSplash variable to see if the game is in splash screen mode before resuming or pausing the MIDI background music (lines 3 and 10). The most important code in the Space Out 2 program in relation to the splash screen is contained in the GamePaint() function, which is where the splash screen is actually drawn. Listing 22.2 contains the code for the GamePaint() function. Listing 22.2 The GamePaint() Function Draws the Splash Screen Bitmap When the Game Is in Splash Screen Mode 1: void GamePaint(HDC hDC) 2: { 3: // Draw the background 4: _pBackground->Draw(hDC); 5: 6: // Draw the desert bitmap 7: _pDesertBitmap->Draw(hDC, 0, 371); 8: 9: if (_bSplash) 10: { 11: // Draw the splash screen image 12: _pSplashBitmap->Draw(hDC, 142, 100, TRUE); 13: } 14: else 15: { 16: // Draw the sprites 17: _pGame->DrawSprites(hDC); 18: 19: // Draw the score 20: TCHAR szText[64]; 21: RECT rect = { 460, 0, 510, 30 }; 22: wsprintf(szText, “%d”, _iScore); 23: SetBkMode(hDC, TRANSPARENT); 24: SetTextColor(hDC, RGB(255, 255, 255)); 25: DrawText(hDC, szText, -1, &rect, DT_SINGLELINE | DT_RIGHT | 26: DT_VCENTER); 27: 28: // Draw the number of remaining lives (cars) 29: for (int i = 0; i < _iNumLives; i++) 30: _pSmCarBitmap->Draw(hDC, 520 + (_pSmCarBitmap->GetWidth() * i), 31: 10, TRUE); 32: 33: // Draw the game over message, if necessary 34: if (_bGameOver) 35: _pGameOverBitmap->Draw(hDC, 170, 100, TRUE); 36: }
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Cheap Web Hosting services
Hour 22. Adding Pizzazz to Your Game with a Splash Screen One of the problems with the games you’ve developed throughout the book thus far is that they don’t adequately identify themselves when they first run. Sure, the title bar of the window has the name of the game, but it’s important to clearly identify your game when it first starts up. In this way, a game is a lot like a movie in that it should present a title at the beginning. Unlike movies, however, titles in games are referred to as splash screens, and they can contain useful information such as a copyright notice and directions on how to play the game. This hour shows you how to spruce up the Space Out game by adding a splash screen. In this hour, you’ll learn: Why splash screens are an important part of just about any game What it takes to incorporate a splash screen into a game How to add a splash screen to the Space Out game The Importance of a Splash Screen Generally speaking, I get annoyed with opening credits in movies because I’m ready for the movie to get started. However, there are a few rare movies whose opening credits are creative and interesting enough to make them an enjoyable introduction to the movie. A big part of the opening credits for movies is the movie title, which is akin to splash screens used in video games. Similar to movie titles, a splash screen in a video game should convey the theme of the game and possibly provide a sneak preview of what’s to come in the game. Of course, it’s also possible to deliberately show very little in the splash screen for a game, with the idea being that you want to shroud the game in mystery until the game play actually starts. Regardless of how much or how little you give away in the splash screen for a game, it’s important to at least communicate the title of the game and any other pertinent information, such as the copyright for the game. If a certain action is required to start the game, it’s also a good idea to mention it on the splash screen as well. No one likes a game that immediately throws you in the action without any warning when the game is launched, so at a bare minimum the splash screen should give you a chance to initiate the game starting. A splash screen is also a good place to include abbreviated instructions for a game, as well as tips and hints about how to play. In the 1980s when arcade games were the rage, you could often read the splash screen for a game to quickly learn how to play the game. This isn’t as critical of a feature in computer games, but it never hurts to provide information that allows people to get started playing a game quickly. One final piece of information to consider for a splash screen is a high score list. This list contains the top scores people have achieved in the game, and is popular in classic arcade games. Hour 24, “Keeping Track of High Scores,” shows you how to create a high score list that saves high scores for the Space Out game to a file. Many commercial games these days go far beyond a splash screen by including an introductory animation or video sequence. This “splash animation” is a lot flashier than a simple splash screen, but it often requires a considerable amount of effort to create, especially if it’s an actual video. For example, many popular sports games include video clips of the actual sports being played. On the other hand, some games just display animation sequences directly from the game, which serves as kind of a demo for the game. You find out how to turn a splash screen into a demo mode for the Space Out game in the next hour. For now, let’s continue to dig deeper into splash screens and how they work.
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Clan Web Hosting services
Looking Behind a Splash Screen Although you could certainly dream up a complex approach to creating a splash screen, the simplest way to carry out the task is to simply create a bitmap image for the screen and then display it on the game screen before the game begins. The image for a splash screen can be large enough to fill the entire game screen or it can be smaller and displayed on top of the existing background for the game. The size of the splash screen for your own games is entirely up to you. However, for the Space Out game, I opted to create a splash screen that is smaller than the game screen. Figure 22.1 shows how the splash screen image is designed to overlay on top of the game background in the Space Out game. Figure 22.1. The splash screen image in the Space Out game is designed to be displayed over the background for the game. As you can see in the figure, there really isn’t anything magical about displaying a splash screen, especially in the Space Out game. The only slightly tricky aspect of adding a splash screen to a game is establishing a separate mode of the game for the splash screen. For example, all the games you’ve created in the book are always in one of two modes, “game over” or “game not over.” These two modes are directly controlled by the _bGameOver global variable, which has one of two Boolean values, TRUE or FALSE. Although you could associate the splash screen with a game being over, it is more accurate to give it a mode of its own. Giving a splash screen a mode of its own basically means adding a global variable that indicates whether the splash screen should be displayed. This makes sense because you probably don’t want to display the splash screen once a game has started and ended. In other words, the splash screen is only shown when the game first starts, and then it never appears again. You could create a splash screen that is shown in between games, but that’s a role better suited to demo mode, which you learn about in the next hour. Building the Space Out 2 Game You now know enough about splash screens to take a stab at adding one to the Space Out game. In doing so, you’ll be making it more of a complete game with a professional touch. The new version of the Space Out game with a splash screen is called Space Out 2, and it is the focus of the remainder of this hour. Space Out 2 is very similar to the original Space Out program. In fact, the play of the game doesn’t change a bit; all that you’re doing is adding a splash screen to spruce up the game a bit. Writing the Game Code The first step in adding a splash screen to the Space Out 2 game is to add a couple of global variables to the game that store the bitmap for the splash screen, as well as the mode for the splash screen. Following are these variables: Bitmap* _pSplashBitmap; BOOL _bSplash; The first variable, _pSplashBitmap, is pretty straightforward in that it represents the bitmap image for the splash screen. The other global variable, _bSplash, is a Boolean variable that indicates whether the game is in splash screen mode. More specifically, if the _bSplash variable is TRUE, the game is in splash screen mode and the splash screen is displayed; you can’t play the game while the splash screen is being displayed. If the _bSplash variable is FALSE, the game plays as normal as if there were no splash screen. So, the idea is to set the _bSplash variable to TRUE at the beginning of the game, and then return it to FALSE after the user starts the game by pressing the Enter key. As with any global variables, it’s important to initialize the splash screen variables. This takes place in the GameStart() function, which is very similar to the previous version. The first change to the GameStart() function is the creation of the splash screen bitmap: _pSplashBitmap = new Bitmap(hDC, IDB_SPLASH, _hInstance); The only other change is the initialization of the _bSplash global variable, which must be set to TRUE in order to display the splash screen when the game starts:
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Clan Web Hosting services
Finally, Timmy moves entirely horizontally (line 27), and is allowed to wrap off the screen from right to left (line 24). The AddAlien() function ends by adding the new alien sprite to the game engine (line 32). You’re probably relieved to find out that this wraps up the code for the Space Out game, which means that you’re ready to put the resources together and take the game for a test spin. Testing the Game I’ve already said it numerous times that testing a game is the most fun part, and yet again you’ve arrived at the testing phase of a completely new game. Similar to the Meteor Defense game, the Space Out game requires a fair amount of testing simply because a lot of different interactions are taking place among the different sprites in the game. The great thing is that you test a game simply by playing it. Figure 21.2 shows the Space Out game at the beginning, with a single alien firing a few missiles at the car below. Figure 21.2. The Space Out game gets started with an alien firing a few missiles at the car below. You can move the car left and right using the arrow keys, and then fire back at the alien using the Space key (Spacebar). Shooting an alien results in a small explosion appearing, as shown in Figure 21.3. Figure 21.3. A small explosion appears when you successfully shoot an alien. Eventually, you’ll venture into dangerous territory and get shot by an alien, which results in a large explosion appearing, as shown in Figure 21.4. Figure 21.4. A large explosion appears when the car gets shot by an alien. You only have three cars to lose, and the number of remaining cars is shown in the upper-right corner of the game screen next to the score. When you lose all three cars, the game ends, as shown in Figure 21.5. Figure 21.5. When you lose all three cars, the game ends and the game over image is displayed. The good news about the game ending in Space Out is that you can immediately start a new one by simply pressing the Enter (Return) key. Summary Regardless of whether you are a fan of shoot-em-up space games, I hope you realized the significance of the Space Out game that you designed and built in this hour. In addition to adding yet another complete game to your accomplishments, the Space Out game is important because it represents the most complete game in the book. In other words, it makes the most complete usage of the features you’ve worked so hard adding to the game engine. Not only that, but the Space Out game is a great game for experimenting with your own ideas, simply because it is the kind of game that can be expanded upon in so many different ways. Before you get too crazy modifying the Space Out game, however, sit tight because I have a few modifications of my own to throw at you before I turn you loose in the wild world of game programming. This hour concludes this part of the book, which was admittedly quite short. The next part of the book picks up right where you left off by showing you some sure-fire techniques to add pizzazz to your games. More specifically, you find out how to add interesting features to the Space Out game such as a splash screen, a demo mode, and a high score list.
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP Web Hosting services
Q&A Q1: Why does the HandleKeys() function change the velocity of the car sprite in response to the arrow keys, instead of directly changing its position? A1: The HandleKeys() function could certainly change the position of the car sprite to get a similar result, but by changing the velocity you get a smoother sense of control in the game. More specifically, the movement of the car isn’t choppy because when it changes direction, it actually decelerates and then accelerates again. This is a minor detail, but one that helps to add a touch of realism to the game. Q2: Why doesn’t the Space Out game include a unique derived Sprite class for each kind of alien? A2: The game could have been designed to utilize three derived Sprite classes such as BlobboSprite, JellySprite, and TimmySprite, but in reality it just wasn’t necessary to break out the code that much. If the different aliens had required radically different functionality within them, this approach might have made more sense. And if you’re a stickler for adhering to object-oriented design, you could still go back and redesign the game around three alien classes instead of one. However, I usually err on the side of simplicity, and in this case one class does the trick just fine. Workshop The Workshop is designed to help you anticipate possible questions, review what you’ve learned, and begin learning how to put your knowledge into practice. The answers to the quiz can be found in Appendix A, “Quiz Answers.” Quiz 1: What is the purpose of the SA_ADDSPRITE sprite action? 2: Why is it necessary to derive a class from the Sprite class in order for it to take advantage of the SA_ADDSPRITE sprite action? 3: What role does the AlienSprite class play in the Space Out game? Exercises 1. Modify the Update() method in the AlienSprite class so that the aliens fly around in different flight patterns. 2. Create an entirely new alien and add it to the Space Out game. This involves creating an animated bitmap image for the alien, as well as adding appropriate code throughout the Space Out game code, including the AlienSprite class. Part VII: Spicing up Your Games Hours 22 Adding Pizzazz to Your Game with a Splash Screen 23 Showing Off Your Game with Demo Mode 24 Keeping Track of High Scores
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP Web Hosting services
2: { 3: // Clear the sprites 4: _pGame->CleanupSprites(); 5: 6: // Create the car sprite 7: RECT rcBounds = { 0, 0, 600, 450 }; 8: _pCarSprite = new Sprite(_pCarBitmap, rcBounds, BA_WRAP); 9: _pCarSprite->SetPosition(300, 405); 10: _pGame->AddSprite(_pCarSprite); 11: 12: // Initialize the game variables 13: _iFireInputDelay = 0; 14: _iScore = 0; 15: _iNumLives = 3; 16: _iDifficulty = 80; 17: _bGameOver = FALSE; 18: 19: // Play the background music 20: _pGame->PlayMIDISong(); 21: } The NewGame() function begins by clearing the sprite list (line 4), which is necessary because you aren’t certain what sprites have been left over from the previous game. The car sprite is then created (lines 7 10), and the global game variables are set (lines 13 17). The function then finishes by starting the background music (line 20). The AddAlien() function is shown in Listing 21.12, and its job is to add a new alien to the game at a random location. Listing 21.12 The AddAlien() Function Adds a New Alien at a Random Position 1: void AddAlien() 2: { 3: // Create a new random alien sprite 4: RECT rcBounds = { 0, 0, 600, 410 }; 5: AlienSprite* pSprite; 6: switch(rand() % 3) 7: { 8: case 0: 9: // Blobbo 10: pSprite = new AlienSprite(_pBlobboBitmap, rcBounds, BA_BOUNCE); 11: pSprite->SetNumFrames(8); 12: pSprite->SetPosition(((rand() % 2) == 0) ? 0 : 600, rand() % 370); 13: pSprite->SetVelocity((rand() % 7) - 2, (rand() % 7) - 2); 14: break; 15: case 1: 16: // Jelly 17: pSprite = new AlienSprite(_pJellyBitmap, rcBounds, BA_BOUNCE); 18: pSprite->SetNumFrames(8); 19: pSprite->SetPosition(rand() % 600, rand() % 370); 20: pSprite->SetVelocity((rand() % 5) - 2, (rand() % 5) + 3); 21: break; 22: case 2: 23: // Timmy 24: pSprite = new AlienSprite(_pTimmyBitmap, rcBounds, BA_WRAP); 25: pSprite->SetNumFrames(8); 26: pSprite->SetPosition(rand() % 600, rand() % 370); 27: pSprite->SetVelocity((rand() % 7) + 3, 0); 28: break; 29: } 30: 31: // Add the alien sprite 32: _pGame->AddSprite(pSprite); 33: } The AddAlien() function adds a new alien to the game, which can be one of three types: Blobbo, Jelly, or Timmy. The code for the creation of each type of alien is similar, but each alien has slightly different characteristics. For example, Blobbo is capable of moving around fairly rapidly in any direction, but he bounces off the edges of the game screen (lines 12 and 13). Jelly also bounces off the screen edges (line 17), but his velocity is set differently so that he tends to move much more vertically than Blobbo (line 20).
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Clan Web Hosting services
7: if (GetAsyncKeyState(VK_LEFT) < 0) 8: { 9: // Move left 10: ptVelocity.x = max(ptVelocity.x - 1, -4); 11: _pCarSprite->SetVelocity(ptVelocity); 12: } 13: else if (GetAsyncKeyState(VK_RIGHT) < 0) 14: { 15: // Move right 16: ptVelocity.x = min(ptVelocity.x + 2, 6); 17: _pCarSprite->SetVelocity(ptVelocity); 18: } 19: 20: // Fire missiles based upon spacebar presses 21: if ((++_iFireInputDelay > 6) && GetAsyncKeyState(VK_SPACE) < 0) 22: { 23: // Create a new missile sprite 24: RECT rcBounds = { 0, 0, 600, 450 }; 25: RECT rcPos = _pCarSprite->GetPosition(); 26: Sprite* pSprite = new Sprite(_pMissileBitmap, rcBounds, BA_DIE); 27: pSprite->SetPosition(rcPos.left + 15, 400); 28: pSprite->SetVelocity(0, -7); 29: _pGame->AddSprite(pSprite); 30: 31: // Play the missile (fire) sound 32: PlaySound((LPCSTR)IDW_MISSILE, _hInstance, SND_ASYNC | 33: SND_RESOURCE | SND_NOSTOP); 34: 35: // Reset the input delay 36: _iFireInputDelay = 0; 37: } 38: } 39: 40: // Start a new game based upon an Enter (Return) key press 41: if (_bGameOver && (GetAsyncKeyState(VK_RETURN) < 0)) 42: // Start a new game 43: NewGame(); 44: } The HandleKeys() function looks to see if any of four keys are being pressed. Following are the meanings of these keys in the context of the Space Out game: Left arrow Move the car left Right arrow Move the car right Space Fire a missile Enter (Return) Start a new game (if the game is over) By knowing the meanings of these keys, the code in the HandleKeys() function hopefully makes a bit more sense. The function begins by making sure that the game isn't over (line 3), and then proceeds to check on the status of each of the three keys that have relevance to the game play; the fourth key (Enter) only applies to a game that is over. If the left arrow key is pressed, the HandleKeys() function alters the car sprite's velocity so that it moves more to the left (lines 10 and 11). On the other hand, if the right arrow key is pressed, the car sprite's velocity is set so that it moves more to the right (lines 16 and 17). One interesting thing to note about this code is that the car is capable of moving faster to the right than it is to the left, which is because the car is aiming to the right. In other words, it can't go as fast in reverse as it can moving forward, which adds a little realism to the game. Firing missiles is initiated by the user pressing the Space key (Spacebar), but it only takes place if the fire input delay has been triggered (line 21). The net effect of the fire input delay is to slow down the firing of missiles so that the player can't go crazy with a barrage of missiles; the game would be too easy if you could fire at that rate. To actually fire a missile, a missile sprite is created and set to a position just above the car sprite, which makes the missile appear to originate from the car (lines 24 29). A sound effect is also played to indicate that the missile was fired (lines 32 and 33). The last section of code in the HandleKeys() function starts a new game in response to the user pressing the Enter (Return) key. The _bGameOver variable is checked to make sure that the game is over (line 41), and the NewGame() function is called to start the new game (line 43). Another important function in the Space Out game is the SpriteCollision() function, which
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP Web Hosting services
is called in response to sprites colliding (Listing 21.9). Listing 21.9 The SpriteCollision() Function Responds to Collisions Between Missiles, Aliens, and the Car Sprite 1: BOOL SpriteCollision(Sprite* pSpriteHitter, Sprite* pSpriteHittee) 2: { 3: // See if a player missile and an alien have collided 4: Bitmap* pHitter = pSpriteHitter->GetBitmap(); 5: Bitmap* pHittee = pSpriteHittee->GetBitmap(); 6: if ((pHitter == _pMissileBitmap && (pHittee == _pBlobboBitmap || 7: pHittee == _pJellyBitmap || pHittee == _pTimmyBitmap)) || 8: (pHittee == _pMissileBitmap && (pHitter == _pBlobboBitmap || 9: pHitter == _pJellyBitmap || pHitter == _pTimmyBitmap))) 10: { 11: // Play the small explosion sound 12: PlaySound((LPCSTR)IDW_LGEXPLODE, _hInstance, SND_ASYNC | 13: SND_RESOURCE); 14: 15: // Kill both sprites 16: pSpriteHitter->Kill(); 17: pSpriteHittee->Kill(); 18: 19: // Create a large explosion sprite at the alien’s position 20: RECT rcBounds = { 0, 0, 600, 450 }; 21: RECT rcPos; 22: if (pHitter == _pMissileBitmap) 23: rcPos = pSpriteHittee->GetPosition(); 24: else 25: rcPos = pSpriteHitter->GetPosition(); 26: Sprite* pSprite = new Sprite(_pLgExplosionBitmap, rcBounds); 27: pSprite->SetNumFrames(8, TRUE); 28: pSprite->SetPosition(rcPos.left, rcPos.top); 29: _pGame->AddSprite(pSprite); 30: 31: // Update the score 32: _iScore += 25; 33: _iDifficulty = max(80 - (_iScore / 20), 20); 34: } 35: 36: // See if an alien missile has collided with the car 37: if ((pHitter == _pCarBitmap && (pHittee == _pBMissileBitmap || 38: pHittee == _pJMissileBitmap || pHittee == _pTMissileBitmap)) || 39: (pHittee == _pCarBitmap && (pHitter == _pBMissileBitmap || 40: pHitter == _pJMissileBitmap || pHitter == _pTMissileBitmap))) 41: { 42: // Play the large explosion sound 43: PlaySound((LPCSTR)IDW_LGEXPLODE, _hInstance, SND_ASYNC | 44: SND_RESOURCE); 45: 46: // Kill the missile sprite 47: if (pHitter == _pCarBitmap) 48: pSpriteHittee->Kill(); 49: else 50: pSpriteHitter->Kill(); 51: 52: // Create a large explosion sprite at the car’s position 53: RECT rcBounds = { 0, 0, 600, 480 }; 54: RECT rcPos; 55: if (pHitter == _pCarBitmap) 56: rcPos = pSpriteHitter->GetPosition(); 57: else 58: rcPos = pSpriteHittee->GetPosition(); 59: Sprite* pSprite = new Sprite(_pLgExplosionBitmap, rcBounds); 60: pSprite->SetNumFrames(8, TRUE); 61: pSprite->SetPosition(rcPos.left, rcPos.top); 62: _pGame->AddSprite(pSprite); 63:
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP Web Hosting services
18: DrawText(hDC, szText, -1, &rect, DT_SINGLELINE | DT_RIGHT | DT_VCENTER); 19: 20: // Draw the number of remaining lives (cars) 21: for (int i = 0; i < _iNumLives; i++) 22: _pSmCarBitmap->Draw(hDC, 520 + (_pSmCarBitmap->GetWidth() * i), 23: 10, TRUE); 24: 25: // Draw the game over message, if necessary 26: if (_bGameOver) 27: _pGameOverBitmap->Draw(hDC, 190, 149, TRUE); 28: } The GamePaint() function takes care of drawing all graphics for the Space Out game. The function begins by drawing the starry background (line 4), followed by the desert ground image (line 7). The sprites are then drawn (line 10), followed by the score (lines 13 18). The number of remaining lives, which are represented by small car images, are drawn in the upper-right corner of the screen just right of the score (lines 21 23). Finally, the function finishes up by drawing the game over image, if necessary (lines 21 27). The GameCycle() function works hand-in-hand with the GamePaint() function to update the game’s sprites and reflect the changes onscreen. Listing 21.7 shows the code for the GameCycle() function. Listing 21.7 The GameCycle() Function Randomly Adds New Aliens to the Game 1: void GameCycle() 2: { 3: if (!_bGameOver) 4: { 5: // Randomly add aliens 6: if ((rand() % _iDifficulty) == 0) 7: AddAlien(); 8: 9: // Update the background 10: _pBackground->Update(); 11: 12: // Update the sprites 13: _pGame->UpdateSprites(); 14: 15: // Obtain a device context for repainting the game 16: HWND hWindow = _pGame->GetWindow(); 17: HDC hDC = GetDC(hWindow); 18: 19: // Paint the game to the offscreen device context 20: GamePaint(_hOffscreenDC); 21: 22: // Blit the offscreen bitmap to the game screen 23: BitBlt(hDC, 0, 0, _pGame->GetWidth(), _pGame->GetHeight(), 24: _hOffscreenDC, 0, 0, SRCCOPY); 25: 26: // Cleanup 27: ReleaseDC(hWindow, hDC); 28: } 29: } Aside from the standard GameCycle() code that you’re already accustomed to seeing, this function doesn’t add much additional code. The new code involves randomly adding new aliens, which is accomplished by calling the AddAlien() function after using the difficulty level to randomly determine if an alien should be added (lines 6 7). With the alien sprites squared away, you still have to contend with how the user is going to control the car sprite. This is accomplished via a keyboard interface using the HandleKeys() function, which is shown in Listing 21.8. Listing 21.8 The HandleKeys() Function Allows the User to Control the Car Sprite Using Keys on the Keyboard 1: void HandleKeys() 2: { 3: if (!_bGameOver) 4: { 5: // Move the car based upon left/right key presses 6: POINT ptVelocity = _pCarSprite->GetVelocity();
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Cheap Web Hosting services