/** * _ _ * __ _ __ _| |_ ___| |__ __ _ * / _` |/ _` | __/ __| '_ \ / _` | * | (_| | (_| | || (__| | | | (_| | * \__, |\__,_|\__\___|_| |_|\__,_| * |___/ */ /** * @copyright Copyright 2010 Netlog NV * @link http://www.gatcha.com/downloads/singleplayer_as3_example_game/ * @license http://www.apache.org/licenses/LICENSE-2.0.html * */ // // Gatcha Singleplayer example for AS 3.0 // // // About this example // This is a basic remake of the classic arcade Pong and shows how to dispatch basic GameEvents to the Gatcha game wrapper. You control the lower paddle with your left and right keys. Bounce the ball back and forward until you or the computer miss. First one that reaches 5 points wins the game. Remember that this game serves as a basic example on how to communicate with the Gatcha API. It has 3 classes: 1. Main.as - This is the main entry point to the game and is launched from the fla root. 2. Title.as - This is a title screen showing the game title and a start button. 3. Game.as - This holds the game logic. Although the code of the game is very simple, it does hold some interesting methods to build up a game for Gatcha: - Always safeguard your valuable game data (score) in the Safememory class against the simplest form of Game hacking. - Wait until the root has been added to the stage before dispatching GameEvents. - Use a Timer based game loop over a frame based one. - Add a "developer mode" to your code that does not dispatch GameEvents when the swf is run locally. If the game isn't loaded inside the wrapper, nobody will be listening for the GameEvents you dispatch... Testing and developing will be faster & more efficient. - Use the Translations class to insert copy in textfields if your game has multiple languages. - You do not need to make a game over screen for singleplayer games. The wrapper takes care of that after the endGame GameEvent has been sent. - You do not need to make a mute button for game sounds. The wrapper has one already. - You do have to make a pause button to dispatch the pause GameEvent, but you do not need to make a pause screen. // // Prerequisites // - Adobe Flash CS3 or CS4. - Actionscript 3.0 knowledge. // // Documentation // Head over to http://www.gatcha.com/downloads/singleplayer_as3_example_game/ for more details. // // Comments, Questions or Feedback // If you have any comments, questions or feedback on this example, please get in touch: http://www.gatcha.com/about Happy coding!