Book Image

App Inventor 2 Essentials

Book Image

App Inventor 2 Essentials

Overview of this book

App Inventor 2 will take you on a journey of mobile app development. We begin by introducing you to the functionalities of App Inventor and giving you an idea about the types of apps you can develop using it. We walk you through the technical set up so you can take advantage of the interactive development environment (live testing). You will get hands-on, practical experience building three different apps using tutorials. Along the way, you will learn computer science principles as well as tips to help you prepare for the creative process of building an app from scratch. By the end of the journey, you will learn how to package an app and deploy it to app markets. App Inventor 2 Essentials prepares you to amass a resource of skills, knowledge and experience to become a mobile app developer
Table of Contents (15 chapters)
App Inventor 2 Essentials
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Creating levels


Computer games typically have multiple levels where the difficulty of playing the game progressively increases. This is what makes a game fun, challenging, and even somewhat addictive. We want to incorporate levels in our game as well.

One simple way to make the game play harder and harder is to increase the speed of the ball as the player continues to score points. You can create whatever tiers you like, but for the purpose of this tutorial, we will create a simple tier system: whenever a player scores 5 points, the player has completed a level. Again, to keep it simple, we will not pause game play (as is common in most computer games) when a level is completed. The player will automatically move on to the next level, which will also increase the speed of the ball.

To figure out whether a level change is needed or not, we will code the app to constantly check the value of score. Each time the score is incremented, the app will check to see whether it is a multiple of 5 (for...