How to monetize Game App

how to monetize social games and how to monetize game maker games and how to monetize facebook game and how to monetize ios game
Dr.KiranArora Profile Pic
Dr.KiranArora,Canada,Teacher
Published Date:27-10-2017
Your Website URL(Optional)
Comment
Bonuses, Game Center, and iAd: Break a Wall In this chapter, you will finalize the game you started in Chapter 4. I have prepared a file named BreakaWallPartII.gameproj that includes background images and actor images. These improvements won’t be covered in this chapter. Refer to previous chapters for a refresher on how to implement graphics and sounds. In this chapter, I want to focus on the finalization of a few elements before you submit your game to the App Store. You will learn how to:  Create a Start Screen.  Implement a scoring system.  Add game interactivity with in-game bonuses.  Post scores on Game Centerleaderboard.  Monetize your game with iAd. You can download my version of Break A Wall, used in this chapter and Chapter 4 to illustrate game-building concepts, for free at http://itunes.apple.com/us/app/break-a-wall/id496154190?ls=1&mt=8 Have fun and try to rank first on the leaderboard CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 274 Designing the Start Screen Every game starts with a Start Screen, also called the menu page. I am not talking about the Splash Screen that may or not appear as the first screen when you launch the game. A Splash Screen will not offer interactivity with the player; it’s just a way to promote your brand. The Start Screen is a very important step in the player experience as it will guide him/her through different choices. The most obvious choice will be to play the game, of course, but you may provide some instructions, too. Note about instruction: Apple loves apps that are intuitive. Nevertheless, some games require a level of instruction to play the game or to understand the rules. The following are the guidelines that I systematically apply to my games: 1) If your game is very simple and very intuitive to use, don’t add instructions. Keep it straightforward. 2) If your game is simple and intuitive but you would like to give non- intuitive additional instructions, create a scene to contain the instructions and make it accessible from the menu. 3) If your game requires some learning, use the first levels or create an interactive scene for the player to learn the game. You may also add instructionsinto the game when a new situation arises. To design a Start Screen in GameSalad, you will create a specific scene. This scene will be the first one in the order (from left to right). Open the file BreakaWall-partII-step1.gameproj in GameSalad. Create a new scene and name it ‘‘Home.’’ Drag and drop the scene in the first position (the very left side) as shown in Figure 9-1. CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 275 Figure 9-1. Home scene Placing the Homescene in this location will ensure that it will be the first scene when you start the game. Note about Splash Screens: As you will see in Chapter 11, you can create a customized splash screen during the publishing process, but this is limited to a static image. By default, it will be a GameSalad Splash Screen. A trick is to replace the Splash Screen with a black image and have an animation in the first scene that acts as an animated Splash Screen. Creating the Actors In this section, you will create a few additional actors for use on your Home screen. A Background actor will be used to contain the background image. You will also create a couple of buttons to add controls for the player. Home Create a new actor and double-click it to open the Actor Editor. Edit the actor attributes with the parameters in Table 9-1. Table 9-1. Home Attributes Name Home Size/Width 768 Size/Height 1024 -ebooks.info CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 276 Click the Images tab to display the images resources and drag and drop Home.png into the actor. Start Game Create a new actor and double-click it to open the Actor Editor. Edit the actor attributes with the parameters in Table 9-2. Table 9-2. Start Game Attributes Name Start Game Size/Width 294 Size/Height 57 Click the Images tab to display the images resources and drag and drop play1.png into the actor. Speaker Create a new actor and double-click it to open the Actor Editor. Edit the actor attributes with the parameters in Table 9-3. Table 9-3. Speaker Attributes Name Speaker Size/Width 90 Size/Height 90 Click the Images tab to display the images resources and drag and drop Speaker.png to the actor. Implementing Rules and Behaviors It’s now time to define the logic behind your actors. The most important logic will reside in the control actors you just created. The Start Game actor will let you start playing and the Speaker actor will control the volume (on or off). CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 277 Home In order to perfectly position the background object, you will use the trick of changing the position attributes. Open the Home actor in the Actor Editor. Drag and drop a Change Attribute behavior and change Home.Position.X to 384. Drag and drop a Change Attribute behavior and change Home.Position.Y to 512. The two behaviors are shown in Figure 9-2. Figure 9-2. Positioning the background with Change Attributes Now drag and drop the actor on the scene and position it approximately in the center. Start Game The Start Game actor will be used as a button. You will implement a rollover effect so that the color of the font changes when the button is pressed. But, because it is an image, you will use the Change Image behavior and use a different image to replace the active one. You will proceed in two steps. First, you will change the image to an image with a different font color when the actor is pressed. Then you will change the image back to the original when the actor touch is released. This is only one of the many ways to createa button-pressing effect. Another approach could be to change either alpha to 0.5 or RGB colors to 0.5. Open the Start Game actor in the Actor Editor. Create a new rule and name it ‘‘Touch is Pressed.’’ The condition is ‘‘Actor receives event’’ ‘‘touch’’ is ‘‘pressed.’’ Then drag and drop a Change Image behavior into the rule and select ‘‘play2’’ from the drop-down next to ‘‘Set Image to.’’ CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 278 Let’s proceed to the second phase of the rollover. Create a new rule and name it ‘‘Touch is Released.’’ The condition is ‘‘Actor receives event’’ ‘‘touch’’ is ‘‘released.’’ This could also be done in the ‘‘otherwise’’ section of the ‘‘Touch is pressed’’ rule. Then drag and drop a Change Image behavior into the rule and select ‘‘play1’’ from the drop-down next to ‘‘Set Image to.’’ The two new rules are shown in Figure 9-3. Figure 9-3. Touch is Pressed and Touch is Released CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 279 You’ve got the visual effect in place, but the purpose of the Start Game actor is to allow you to start the game. In order to reach this goal, you will add some behaviors in the rule ‘‘Touch is Released.’’ In order to have a smooth transition, I often use a short timer before implementing the change scene. This will improve the user experience by giving the player the time to see the change of states of the button. Drag and drop a Timer behavior below the Change Image behavior in the ‘‘Touch is Released’’ rule. Set the timer to ‘‘After’’‘‘0.5’’seconds. Then drag and drop a Change Scene behavior in the timer and set it to Level 1 as per Figure 9-4. Figure 9-4. Updated Touch is Released rule Position the Start Gameactor in the scene. CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 280 Speaker You will use the speaker actor to control the sounds and music. In this example, you will only focus on sound but you could use the same approach with music. A touch on the speaker will change the state of a game attribute to either 0 or 1. You could use rules and Boolean, but instead I will show you a cool trick with the modulo operator. Wikipedia defines modulo operation as a function that returns ‘‘the remainder of division of one number by another.’’ In other words, if you divide 9 by 4, you get 9 = 2 x 4 + 1. The remainder of 9 divided by 4 is 1. Let’s take another example. If you divide 50 by 14, you get 50 = 3 x 14 + 8. The remainder of 50 divided by 14 is 8. With modulo notation (%), you have 9 mod 4 = 1 or 9%4=1. Now, if you take any number (integer) and you do modulo 2 this number, you only have two possible results: 0 and 1. If the number is even, the remainder of this number divided by two is null (0). If the number is odd, the remainder of this number divided by two is 1. So with a simple equation of a unitary increment and modulo two, you have a result that goes from zero to one and from one to zero. The equation is soundOn = (soundOn+1)%2. By default, you want to have the sound on. So the initial value is soundOn=1. When you press the Speaker actor, you get SoundOn = (1+1)%2 = (2)%2 = 0. The next time you press the Speaker actor, you get SoundOn = (0+1)%2 = (1)%2 = 1. And so on… When you want to have sound, SoundOn is equal to 1 and when you don’t want to have sound, SoundOn is equal to 0. All the rules on sound are based on the state of the SoundOn attribute. To make it simple to manage, instead of creating a rule for every PlaySound behavior, you will control the volume instead. When SoundOn is equal to 1, volume is equal to 1. Respectively, when SoundOn is equal to 0, volume is equal to 0. You will also implement a rollover with a crossed speaker icon when the sound is turned off. Let’s do all this now Create a new game attribute of type Integer and name it ‘‘SoundOn.’’ Give this attribute the default value of 1 as per Figure 9-5. wnfo CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 281 Figure 9-5. SoundOn attribute Open the Speaker actor in the Actor Editor. Create a new rule and name it ‘‘Touch is pressed.’’ The condition is ‘‘Action receives event’’ ‘‘touch’’ is ‘‘pressed.’’ Next, drag and drop a Change Attribute behavior and change game.SoundOn to (game.SoundOn+1)%2 as per Figure 9-6. Figure 9-6. Touch is pressed rule Now, create a new rule and name it ‘‘SoundOn is equal to 1.’’ The condition will be ‘‘Attribute’’‘‘game.SoundOn’’‘‘=’’‘‘1’’. Next, drag and drop a Change Image behavior and set the image to speaker. Lastly, drag and drop a Change Attribute behavior and change Device.Audio.Sound Volume to 1 as per Figure 9-7. w CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 282 Figure 9-7. SoundOn is equal to 1 rule. Last but not least, create a new rule and name it ‘‘SoundOn is equal to 0.’’ The condition is ‘‘Attribute’’‘‘game.SoundOn’’‘‘=’’‘‘0’’. Next, drag and drop a Change Image behavior and set the image to speaker off." Lastly, drag and drop a Change Attribute behavior and change Device.Audio.Sound Volume to 0 as per Figure 9-8. w CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 283 Figure 9-8. SoundOn is equal to 0 rule Position the Speaker actor on the scene at the bottom left corner. You can now test your work in the Preview window of GameSalad. Adding Score Keeping Later in the chapter I will cover Game Center. But first you need to have a scoring system. You will make it very simple. Every time a blue brick is destroyed, one point will be added to the score. And every time a red brick is destroyed, you will add two points to the score. To follow the project from this point, open the file named BreakaWall-partII-step2.gameproj. A game attribute of type Integer will be used to keep up with the score. You will ensure a manual reset every time you start the game. And you will increment the score every time a brick is hit. Last but not least, you will display the score on the top right zone of the screen, so the player can keep up with his/her progress. First, let’s create the score attribute. Create a new game attribute of type Integer and name it ‘‘Score.’’ Keep the default value to zero. w CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 284 Open the Start Game actor into the Actor Editor. Drag and drop a Change Attribute behavior into the rule ‘‘Touch is Released’’ and change game.Score to 0, as per Figure 9-9. Figure 9-9. Updated Touch is Released rule Open the Brick1 actor in the Actor Editor. Drag and drop a Change Attribute into the existing rule and change game.Score to game.Score+1, as per Figure 9-10. w CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 285 Figure 9-10. Updated Brick1 rule Repeat the same operation with Brick2 but add two points for each Brick2. Open the Brick2 actor in the Actor Editor. Drag and drop a Change Attribute into the existing rule and change game.Score to game.Score+2, as per Figure 9-11. CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 286 Figure 9-11. Updated Brick2 rule You are keeping up with the score but wouldn’t it be nice to display it to the player? ScoreDisplay Actor Create a new actor and double-click it to open the Actor Editor. Edit the actor attributes with the parameters in Table 9-4. CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 287 Table 9-4. ScoreDisplay Attributes Name ScoreDisplay Size/Width 260 Size/Height 100 Color/Alpha 0 ScoreDisplay Rules and Behaviors Drag and drop a Display Text behavior into the ScoreDisplay actor. Change the settings as follows (and shown in Figure 9-12):  Text: ‘‘Score:’’..game.Score  Font: Cochin  Color: purple Figure 9-12. Display Text for ScoreDisplay actor Open the Level 1 scene in the Scene Editor and position the ScoreDisplay actor in the scene at the top in the middle as per Figure 9-13. CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 288 Figure 9-13. Level 1 Scene CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 289 Creating the Extra-Bonus Actors In order to make it more fun, you will add the following bonuses into some of the bricks:  A 50-point bonus  A 100-point bonus  A auto-bullet bonus The point bonuses will be spawned by the bricks that hide them and will be added to the score if the racket collides with them. The same principle will apply to the auto-bullet, but instead of adding points, it will have the racket trigger bullets automatically. These bullets will destroy the bricks. The bullets will be automatically fired as long as a Boolean game attribute AutoBullet is set to true. By default, it is set to false. Catching the capsule will set it to true. Losing the ball will set it back to false. To follow the project from this point, open the file named BreakaWall-partII- step3.gameproj. 50 pt cap Actor Create a new actor and double-click it to open the Actor Editor. Edit the actor attributes with the parameters in Table 9-5. Table 9-5. 50 Pt Cap Actor Attributes Name 50 pt cap Size/Width 81 Size/Height 54 Click the Images tab to display the images resources and drag and drop 50 pt.png into the actor. 100 pt cap Actor Create a new actor and double-click it to open the Actor Editor. Edit the actor attributes with the parameters in Table 9-6. CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 290 Table 9-6. 100 pt cap Actor Attributes Name 100 pt cap Size/Width 81 Size/Height 54 Click the Images tab to display the images resources and drag and drop 100 pt.png into the actor. Auto Bullet Actor Create a new actor and double-click it to open the Actor Editor. Edit the actor attributes with the parameters in Table 9-7. Table 9-7. Auto Bullet Actor Attributes Name Auto bullet Size/Width 81 Size/Height 54 Click the Images tab to display the images resources and drag and drop Bullet.png to the actor. Bullet Actor Create a new actor and double-click it to open the Actor Editor. Edit the actor attributes with the parameters in Table 9-8. Table 9-8. Bullet Actor Attributes Name Bullet Size/Width 30 Size/Height 60 CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 291 Click the Images tab to display the images resources and drag and drop Bullet-img.pnginto the actor. Your newly created actors should be similar to Figure 9-14. Figure 9-14. Actor Inspector Implementing the Extra-Bonus Rules and Behaviors Basically, you want the bricks containing the extra bonuses to spawn an extra- bonus actor. The extra-bonus actor will move down and when it overlaps with the racket, it will enable the bonus. 50 pt cap Open the 50 pt cap actor in the Actor Editor. Drag and drop a Change Velocity behavior into the actor and change the settings to:  Direction: 270  Relative to: scene  Speed: 150 Create a new rule and set the condition to ‘‘Actor receives event’’‘‘overlaps or collides’’ with ‘‘actor of type’’‘‘racket.’’ Drag and drop a Change Attribute behavior and change game.Score to game.Score+50. Drag and drop a Destroy CHAPTER 9: Bonuses, Game Center, and iAd: Break a Wall 292 behavior. Depending on the number of actions to be executed, you may have an issue if you place the Destroy behavior before them. As a rule of the thumb, I recommend that you place the Destroy behavior last. The actor action pane should be as per Figure 9-15. Figure 9-15. 50 pt cap action pane 100 pt cap Open the 100 pt cap actor in the Actor Editor. Drag and drop a Change Velocity behavior into the actor and change the settings to:  Direction: 270  Relative to: scene  Speed: 150 Create a new rule and set the condition to ‘‘Actor receives event’’‘‘overlaps or collides’’ with ‘‘actor of type’’‘‘racket.’’ Drag and drop a Change Attribute