Learning Stencyl 3.x Game Development: Beginner's Guide - Innes Borkwood - E-Book

Learning Stencyl 3.x Game Development: Beginner's Guide E-Book

Innes Borkwood

0,0
34,79 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Creating video games has traditionally been a long and complicated process, requiring years of experience and a vast array of skills. However, with the introduction of comprehensive game-development toolkits such as Stencyl, the fun has returned to the art of game-creation – anyone who has the desire to create their own video game can now do so with almost any desktop computer and a free software download from the Internet!Learning Stencyl 3.x Game Development: Beginner's Guide will put you on the fast-track to learning the essentials of the powerful Stencyl game-development toolkit. You will develop a complete, ready-to-publish video game including in-game advertising, by following the clear, step-by-step tutorials, supported by numerous screenshots and practical examples.This book will guide you through all the important steps required to develop and publish your video game. Starting with the installation and testing of the Stencyl toolkit, you will very quickly advance to the fun and exciting process of creating a playable game. The step-by-step tutorials will guide you from a blank screen, right through to giving your game that final polish and sharing it with the rest of the world.

Whilst developing your feature-complete video game, you will learn how to easily detect collisions in your game using Stencyl's built-in physics engine. You'll discover how to use the powerful animation tools included in Stencyl's toolkit, and you'll find out how to make your game shine with sounds and visual special effects. You will also discover how Stencyl makes it easy to utilize the touch-screen and accelerometer features of smartphones and tablet computers.

You will learn all the essential skills required to develop a video game from scratch ‚Äì right through to publishing a game on the Internet and testing games  on the most popular mobile devices.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 494

Veröffentlichungsjahr: 2013

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Learning Stencyl 3.x Game Development Beginner's Guide
Credits
Foreword
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Time for action – heading
What just happened?
Have a go hero – heading
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Introduction
How Stencyl works
How we'll learn to use Stencyl
Why Stencyl is a great development tool
Rapid prototyping and development
No code development
Sharing resources with other Stencyl developers
Platforms that Stencyl runs on
Stencyl target platforms
Targeting specific devices
Publishing desktop games
Publishing to iOS devices
Publishing to Android
What makes Stencyl different
Stencyl runs on almost any desktop computer
Stencyl creates native code
You don't need to be a coder
Using the free version of Stencyl
Using the free version of Stencyl with this book
Successful games created with Stencyl
The Stencyl Showcase
Installing Stencyl and testing the setup
Installing Stencyl
Microsoft Windows
Time for action – downloading and installing Stencyl on Windows
What just happened?
Mac OS X
Time for action – downloading and installing Stencyl for Mac OS X
What just happened?
Linux
Time for action – downloading and installing Stencyl for Linux
What just happened?
Creating a Stencyl account
Time for action – creating an account and signing in
What just happened?
Have a go hero
Testing the Stencyl installation
Time For action – testing Stencyl
What just happened?
Have a go hero
Summary
2. Let's Make a Game!
Using the downloaded game files
Let's get started!
Creating a new game
Time for action – creating a new game
What just happened?
Creating a blank scene
Time for action – creating a blank scene
What just happened?
Downloading resources from StencylForge
Time for action – downloading an actor
What just happened?
Have a go hero – searching StencylForge for interesting actors
Understanding the Stencyl Dashboard
Adding an actor into a scene
Time for action – adding an actor to the jungle scene
What just happened?
Testing the game
Time for action – testing the game
What just happened?
Downloading and using tiles for scenery
Time for action – downloading tiles from StencylForge
What just happened?
Have a go hero – searching StencylForge for tilesets
Adding tiles into the scene
Time for action – adding tiles into the scene
What just happened?
Working with tiles
Deleting tiles from a scene
Replacing existing tiles in a scene
Moving tiles in a scene
Selecting multiple tiles
Placing multiple copies of tiles
Have a go hero – experimenting with tiles in the scene
Finalizing the initial design
Have a go hero – tidying up the scene
Reviewing our progress
Using behaviors to interact with our game
Working with behaviors
Adding behaviors
Time for action – attaching a behavior to an actor
What just happened?
Configuring behaviors with Attributes
Time for action – configuring the behavior
What just happened?
Have a go hero – configuring the remaining animations
Save the game!
Testing the game
Time for action – testing the game to find a problem!
What just happened?
Improving the scene mechanics
Time for action – adding gravity to the Jungle scene
What just happened?
Keeping an actor in a scene
Time for action – attaching another behavior to the actor
What just happened?
Increasing the width of the gameplay area
Time for action – increasing the width of the scene
What just happened?
Have a go hero – adding more tiles to the scene
Making the screen scroll
Time for action – attaching the Camera Follow behavior
What just happened?
Adding some interesting scenery
Have a go hero – adding some interesting tiles to the scene
Fine-tuning the level design
Finding game testers
Summary
3. Detecting Collisions
Working with collision detection in Stencyl
Time for action – enabling the Debug Drawing feature
What just happened?
Modifying an actor's collision shapes
Time for Action – modifying the monkey's collision shapes
What just happened?
Adding multiple collision shapes
Time for action – adding more collision shapes to the monkey
What just happened?
Planning the collision shapes
Have a go hero
Testing the updated collision bounds
Configuring collision shapes for tiles
Time for action – modifying the collision bounds of a tile
What just happened?
Have a go hero
Adding enemies and collectibles
Downloading the enemies and collectibles
Placing the new actors into the jungle scene
Working with collision groups
Time for action – examining the collision group settings
What just happened?
Viewing the actors' collision groups
Time for action – examining the Players and Actors groups
What just happened?
Creating a new collision group
Time for action – creating a collision group for enemy actors
What just happened?
Have a go hero
Configuring collisions for the fruit actors
Using collision sensors
Time for action – configuring the fruit as a sensor
What just happened?
Have a go hero
Implementing terrain collision shapes
Time for action – adding a terrain collision area to the scene
What just happened?
Have a go hero
What else can we improve?
Summary
4. Creating Behaviors
Creating custom behaviors
Creating our first custom behavior
Time for action – creating a behavior
What just happened?
Time for action – adding an action and attaching to it an actor
What just happened?
The actor's behavior screen
Adding an additional event to a behavior
Time for action – adding an event and renaming the behavior
What just happened?
Understanding the instruction block palette
Considering future refinements
A review of the gameplay
Introducing a new challenge
Have a go hero – downloading and configuring the statue
Creating a timed event
Time for action – creating a behavior to drop the statues
What just happened?
Identifying and resolving problems
Examining screen size and scene size
Time for action – adjusting the drop-location of the statue
What just happened?
Examining the scene instruction blocks
Preparing for future changes
Time for action – making the behavior more flexible
What just happened?
Introducing randomness into our game
Time for action – introducing randomness to our behavior
What just happened?
Optimizing the number of actors
Time for action – making the statues disappear after a delay
What just happened?
Implementing our first special effect
Time for action – making the statues disappear after a delay
What just happened?
Experimenting with the timings
Have a go hero – making the fruit fade when collected
Understanding active actors
Experiencing a freezing statue
The origin of the actors
Time for action – stopping the statues from becoming inactive
What just happened?
There's more than one way
Have a go hero – using the offscreen bounds block
Creating a countdown timer
Time for action – creating a countdown timer
What just happened?
Examining the debug blocks
Implementing decision making into our game
Time for action – listening for the countdown to reach zero
What just happened?
What if? Otherwise…
Repositioning an actor during gameplay
Time for action – creating an event to relocate the monkey
What just happened?
Triggering custom events in our behaviors
Time for action – triggering a custom event
What just happened?
Triggers and more triggers
Taking time to learn the available blocks
Learning from the provided behaviors
Summary
5. Animation in Stencyl
Creating an actor using an imported image file
Time for action – importing an image into the Animation Editor
What just happened?
Understanding Stencyl's animation terminology
Animation frames
Animation settings
Name
Looping
Synchronized
Origin Point
Default animation
Have a go hero
Importing a ready-made sprite sheet
Time for action – importing a sprite sheet
What just happened?
Fine-tuning an animation's frame durations
Time for action – modifying an animation's frame durations
What just happened?
Have a go hero
Editing animation frames
Time for action – editing an existing frame with Pencyl
What just happened?
Using an alternative graphics tool
Time for action – changing the default graphics editor
What just happened?
Have a go hero
Using instruction blocks to control animations
Time for action – switching animations with instruction blocks
What just happened?
Have a go hero
Implementing tweening with instruction blocks
Time for action – using the grow instruction block
What just happened?
Have a go hero
Summary
6. Managing and Displaying Information
A review of our progress
Planning ahead – what else does our game need?
Displaying a countdown timer on the screen
Time for action – displaying the countdown timer on the screen
What just happened?
Configuring fonts
Time for action – specifying a font for use in our game
What just happened?
Using font files in Stencyl
Have a go hero
Creating a game attribute to count lives
Time for action – creating a Lives game attribute
What just happened?
Using game attributes
Time for action – decrementing the number of lives
What just happened?
No more click-by-click steps!
Time for action – detecting when Lives reaches zero
What just happened?
Have a go hero
Removing debug instructions
Using graphics to display information
Time for action – displaying a timer bar
What just happened?
Activating and deactivating instruction blocks
Have a go hero
Counting collected actors
Time for action – counting the fruit
What just happened?
Time for action – detecting when all fruits have been collected
What just happened?
Preventing multiple collisions from being detected
Keeping track of the levels
Time for action – adding a game attribute to record the level
What just happened?
Fixing the never-ending game!
Have a go hero
Summary
7. Polishing the Game
Adding a background and foreground
Time for action – adding a background to the Jungle scene
What just happened?
Have a go hero
Viewing foregrounds and backgrounds in the Scene Editor
More about foregrounds and backgrounds
Creating a visual special effect
Making the ground shake
Time for action – making the ground shake
What just happened?
Have a go hero
Creating additional levels
Time for action – renaming, duplicating, and modifying a level
What just happened?
Progressing through the levels
Time for action – implementing level progression
What just happened?
Adding even more levels
Have a go hero
Adding a pause feature
Preparing the pause banner framework
Time for action – creating the pause framework
What just happened?
Implementing the pause feature
Time for action – implementing the main pause routine
What just happened?
Summary of the pause routine configuration
Have a go hero
Implementing a level progression routine
Displaying the message and buttons
Time for action – displaying the message and buttons
What just happened?
Responding to the player's selection
Time for action – responding to the player's selection
What just happened?
Have a go hero
Creating a game over message
Reusing the existing banner event
Time for action – modifying the existing banner event
What just happened?
Understanding internal attribute names
Updating attribute names
Displaying the game-over banner
Time for action – displaying the game over banner
What just happened?
Creating a Main Menu scene
Time for action – displaying the introduction scene
What just happened?
Have a go hero
Finalizing the game-completed scene
Time for action – implementing the game-completed scene
What just happened?
Have a go hero – improving the game-completed scene
Summary
8. Implementing Sounds
Adding a jumping sound effect
Time for action – implementing a jumping sound effect
What just happened?
Have a go hero
Examining the play sound instruction blocks
Organizing sounds in the game
Adding a pickup sound effect
Time for action – implementing a pickup sound effect
What just happened?
Have a go hero
Adding a soundtrack
Time for action – adding a soundtrack
What just happened?
Have a go hero
Understanding sound types in Stencyl
Audio file requirements
Looping music
Importing sounds into Stencyl
Time for action – importing a sound effect
What just happened?
Have a go hero
Summary
9. Publishing and Making Money from Your Games
Publishing to the Stencyl Arcade
Time for action – publishing to the Stencyl Arcade
What just happened?
Have a go hero – changing our game's configuration
Making money with in-game advertising
Third-party advertisement providers
Implementing in-game advertising
Time for action – inserting an advertisement into our game
What just happened?
Have a go hero – finalizing the MochiAds configuration
The Mochi Media review process
Preloaders and advertising
Obtaining sponsorship
Understanding sponsorships
Primary sponsorship
Secondary sponsorship
Exclusive sponsorship
Sponsorship payments
Where to find sponsorship
Flash Game License (FGL)
Industry networking
Improving our opportunities for sponsorship
Mobile game monetization opportunities
In-app purchases
App store sales
Summary
10. Targeting Mobile Platforms
Understanding testing versus publishing
Testing games with the free version of Stencyl
Publishing Stencyl games
Developer licensing for Google Android devices
Developer licensing for Apple iOS devices
Mobile game distribution costs
Considering certification requirements
Examining platform differences
Testing on a mobile device
Testing on an Android device
Time for action – testing on an Android device
What just happened?
Testing on an iOS device
Time for action – testing on an iOS device
What just happened?
Utilizing the accelerometer
Time for action – experimenting with the accelerometer
What just happened?
Understanding accelerometer feedback
Understanding the x axis feedback
Understanding the y axis feedback
Understanding the x axis feedback
Using the accelerometer in a game
Time for action – creating an accelerometer-controlled game
What just happened?
Autorotate
Implementing touchscreen controls
Time for action – implementing touchscreen controls
What just happened?
Exploring additional mobile device features
Summary
A. Planning, Resources, and Legal Issues
The planning process
Where to start
Starting with concept drawings
Starting with a prototype
Finding the fun
Starting small
Using placeholder graphics
Setting small goals
Avoiding burn-out
Third-party tools
Graphics tools
GIMP
Inkscape
GraphicsGale
Audio Tools
Audacity
SFXR
inudge
Third-party assets
Graphics resources
Sound resources
Additional resources
Fonts
StencylForge
Books
Websites
Legal issues
Use of third-party assets
Copyright
Public domain
Licensed works
Royalty-free
A note about collaboration
Clearing up some myths
Myth 1
Myth 2
Myth 3
Myth 4
Myth 5
Myth 6
When it is safe to use third-party game assets
Progressing with Stencyl game development
Summary
Index

Learning Stencyl 3.x Game Development Beginner's Guide

Learning Stencyl 3.x Game Development Beginner's Guide

Copyright © 2013 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: May 2013

Production Reference: 1170513

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-84969-596-1

www.packtpub.com

Cover Image by Vicki Wenderlich (<www.vickiwenderlich.com>) and lnnes Borkwood (<[email protected]>)

Credits

Author

Innes Borkwood

Reviewers

Joe Dolivo

Jean-Marc "jihem" QUÉRÉ

James Vanderhyde

Acquisition Editor

Kartikey Pandey

Lead Technical Editor

Ankita Shashi

Technical Editors

Sharvari Baet

Sayali Mirajkar

Akshata Patil

Dheera Paul

Project Coordinator

Anugya Khurana

Proofreader

Lauren Tobon

Indexer

Rekha Nair

Graphics

Ronak Dhruv

Abhinash Sahu

Production Coordinator

Nitesh Thakur

Cover Work

Nitesh Thakur

Foreword

My journey began nearly 10 years ago creating a map editor for a Mario clone. I had just learned how to program, and like many, I wanted to make games with my newfound knowledge. Even before I learned how to program, I fostered an obsession over editing maps for games on TI graphing calculators, even going as far as drawing such maps out on graph paper as a way of sharing them with friends. Times have surely changed since then!

Over the years, I bounced from one project to another, each with increasingly ambitious scope. The Mario clone begat a general platformer engine, which in turn gave way to a completely general game engine. None of these experiments saw the light of day, but they set the stage for what eventually became Stencyl.

Stencyl was conceived during a time that, despite being a few years back, seems anachronistic. Facebook was closed to the public, YouTube was a novelty, and the iPhone had yet to be invented. Within the gaming world, creating a YouTube for games was considered the holy grail, and no fewer than a dozen companies sought this vision by democratizing game creation in various ways.

A few years later, Stencyl opened its doors to an eagerly awaiting public. Educators in particular loved the combination of a familiar brick-snapping interface with the incentives of building a real game. It was during this time that I met Innes and learned that he wanted to use Stencyl to teach programming and game design to young students. As we grew further acquainted with each other, he proposed this book.

Learning Stencyl 3.x Game Development: Beginner's Guide is a top to bottom treatise on how to build a game using Stencyl, from humble beginnings to the last 10% spent polishing and taking a game to market. Creating a game is portrayed not as a sprint, but as a journey upon which you'll build not just a working knowledge of Stencyl, but acquire a general toolbox of techniques and wisdom that will serve you well throughout your game-creating career.

When I applied to college, one of my essays detailed my early experiences with game programming. I was particularly fascinated by a magical spark of life I bestowed upon a lowly breakout clone when I got a ball to bounce off the paddle and break some blocks. It was a euphoric moment because I finally got my first game to work!

If you're new to the world of game creation, I offer you this one piece of advice: think big but start small. Complete some small projects to get the hang of things and see firsthand just how important that last 10 percent is. When you inevitably hit a brick wall, don't give up. Everybody starts somewhere, and when you get that first game working, you'll experience the same joy that I felt when I finally got my first game to work. Happy Stencyling!

Jonathan Chung

Creator of Stencyl

About the Author

Innes Borkwood is a freelance computer consultant and software trainer living in Perth, Western Australia.

Prior to moving to Perth in 2011, Innes was a full-time teacher at Chesterton Community Sports College in Staffordshire, England, where he taught Information & Communications Technology for four years.

In addition to consulting and teaching, Innes has also worked as a freelance journalist for national computer magazines in the UK.

Since the first personal computers arrived in the UK, Innes has been a dedicated technology enthusiast and electronics hobbyist, with an enthusiasm for participating in, and encouraging, life-long learning. He has a First Class Honours Degree in Business Studies with ICT, and continues to learn something new every day!

Innes is happily married to his very understanding wife, Ellen, with whom he has two wonderful children, David and Catherine.

Acknowledgement

Thanks to my wife, Ellen, and my children, David and Catherine, for being so accepting of my absence from family life during the many, many hours that I spent at my desk while writing this book.

I offer thanks and gratitude to the team at Packt Publishing, whose enthusiasm for this book has ensured that the process of creating it was an enjoyable, rewarding, and challenging experience; it has been a pleasure working with you. For the Technical Reviewers—thank you for your generous comments, helpful suggestions, and for your vigilance in detecting my errors.

For my daughter, Catherine; thank you for proof reading the early drafts, testing the accompanying code, and for providing such helpful, constructive criticism.

My final acknowledgements are reserved for Joe Dolivo and Jonathan Chung of Stencyl, LLC. Joe, thank you for responding to each of my many questions so promptly and comprehensively; I am indebted to you. Jon, thank you for creating Stencyl; it is a wonderful tool that has already enabled, and will continue to enable, many people to "find the fun!"

This book is dedicated to my dear wife, Ellen; thank you for your love, your support, and your encouragement. Here it is in print; I love you.

For David and Catherine—I love you too!

About the Reviewers

Joe Dolivo is a practicing electrical engineer (BSEE, UIUC-Illinois 2010) by day and Stencyl team member by night. Originally an inquisitive volunteer, he now handles numerous aspects of Stencyl's operations, including content development, site maintenance, social media, business partnerships, educational outreach, and support. Most recently, Joe's taken an interest in using innovative technologies such as Stencyl to improve STEM education in the US and abroad.

Jean-Marc "jihem" QUÉRÉ is a senior computer science engineer, and is also the author of numerous articles in the French specialized press and books (on WinDev). Self-taught, he provided software for more than 20 years in every domain: decision-making methods, artificial learning, robotics, and autonomous systems. Technology evangelist, he has chosen to support Stencyl (since the migration from Flash to haXe). He actively contributes to the community (extensions, translation, and support). Undoubtedly, you will meet him one day or another on the Stencyl forums. And you will be welcome!

Being part of something, implies to be welcomed by a community. Stencyl users are part of one of the best communities I have been in touch with as far as I can remember since the first steps of Internet (and Linux). You know that a person uses Stencyl because he (or she) has sparks in his (or her) eyes and a child-like spirit to create amazing games. I have found this in Innes. And if you go through this journey, you might have them too.

James Vanderhyde teaches computer science and math at Benedictine College in Atchison, Kansas. He has a PhD in computer science from Georgia Tech (2007). His research is in computer graphics and computer game development, especially for educational purposes. He has been writing computer games and other computer programs since the Commodore 128 days.

www.PacktPub.com

Support files, eBooks, discount offers and more

You might want to visit www.PacktPub.com for support files and downloads related to your book.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. 

Why Subscribe?

Fully searchable across every book published by PacktCopy and paste, print and bookmark contentOn demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

Preface

Creating video games has traditionally been a long and complicated process, requiring years of experience and a vast array of skills. However, with the introduction of comprehensive game-development toolkits such as Stencyl, the fun has returned to the art of game creation—anyone who has the desire to create his or her own video game can now do so with almost any desktop computer and a free software download from the Internet.

Stencyl eliminates many of the tedious and time consuming aspects of game development, but getting to grips with such a comprehensive software package can be somewhat daunting—there are so many great features that it's difficult to know where to start!

Learning Stencyl 3.x Game Development: Beginner's Guide will guide you through learning the essential skills that are required to create your own video games without knowing how to write computer code. We're going to start with a blank screen and, before we reach the end of the book, we'll have developed a complete game, ready for publishing. We won't stop with just the basics in place—we're going all the way, right through to including many of the important features that we would expect to find in a professional production!

Let's install Stencyl and create a video game.

What this book covers

Chapter 1, Introduction, explains what Stencyl is, how it works, and how we're going to learn the skills that we need to develop our own video games. We'll also install Stencyl and check that the installation is working as expected.

Chapter 2, Let's Make a Game!, guides us through the first steps of creating our game. We'll learn how to control our game's main character, design a game level with platforms, and create a scrolling display.

Chapter 3, Detecting Collisions, explores the management of different types of collisions within Stencyl. We'll add enemy characters and collectible items, and we'll fine tune the collision detection by modifying collision shapes.

Chapter 4, Creating Behaviors, explains how we can take full control of how our games work, by constructing our own custom gameplay routines. We'll learn how to use Stencyl's instruction blocks to introduce more advanced features into our game, such as random in-game events and decision making.

Chapter 5, Animation in Stencyl, introduces some of the different ways in which we can implement animation in our game. We'll discover how to bring our in-game characters to life with Stencyl's built-in animation and graphics editing tools.

Chapter 6, Managing and Displaying Information, focuses on managing information and sharing that information with players of our game. We'll be learning how to display text on screen, keep track of collected items, and also how to display a countdown timer bar.

Chapter 7, Polishing the Game, shows us how to add some essential elements to our game, such as an introductory screen, a game-over message, and a pause feature with a pop-up banner. We'll also be implementing an interesting visual effect and creating additional levels for our game.

Chapter 8, Implementing Sounds, concentrates on the skills that we need for implementing audio within our game. We'll learn many of the important techniques required for introducing sound effects and a soundtrack, to add that final professional touch to our games.

Chapter 9, Publishing and Making Money from Your Games, explains how we can publish our games on the Internet, and discusses some of the options available to us for selling or licensing our games. We'll also discover how to implement in-game advertising so we can earn some money each time our games are played.

Chapter 10, Targeting Mobile Platforms, discusses how we can test our games on mobile devices, and we'll also learn how to use the accelerometer and touchscreen features to control games.

Appendix, Planning, Resources, and Legal Issues, examines some of the important aspects of planning the development of a video game. We'll also consider the availability of third-party tools and resources and, finally, we'll review some of the legal aspects relating to the use of third-party assets within our video games.

What you need for this book

You will need to download Stencyl 3.x from stencyl.com.

Stencyl can be installed on Microsoft Windows XP (and later versions of Microsoft Windows), Mac OS X, and Linux (Ubuntu distributions recommended).

No prior knowledge of game development or computer programming is required.

Who this book is for

This book is for beginning game developers who have no prior knowledge of creating games or computer programming.

It's also an ideal resource for experienced game developers and designers who need to create rapid prototypes, or who want to speed up the game-development process.

Teachers and students, who think learning should be fun, will also benefit from this book!

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Time for action – heading

Action 1Action 2Action 3

Instructions often need some extra explanation so that they make sense, so they are followed with:

What just happened?

This heading explains the working of tasks or instructions that you have just completed.

You will also find some other learning aids in the book, including:

Have a go hero – heading

These are practical challenges and give you ideas for experimenting with what you have learned.

You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text are shown as follows: "The game file named 5961_02_13.stencyl represents how our game should look at this point in the book!"

Newterms and importantwords are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Before we can open up another game, we should close the Adobe Flash Player window in which the previously tested game is running, and we must close the current game in Stencyl by clicking on File | Close Game and follow any prompts that appear".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title through the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output.

You can download this file from: http://www.packtpub.com/sites/default/files/downloads/5961OT_ColoredImages.pdf

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the erratasubmissionform link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.

Chapter 1. Introduction

Welcome to Stencyl — an exciting and fun game development tool used by many professional and amateur game developers around the world.

By the end of this book, we will know all the skills required to develop a product that exhibits all the features expected in a professionally-developed computer game.

However, before we start to create our game, we're going to learn about the Stencyl toolkit, install Stencyl, and test that everything is working as required, then experiment with some of the sample games that have been provided with the installation.

In this chapter we will learn the following:

How Stencyl worksHow we'll learn to use StencylWhy Stencyl is a great development toolPlatforms that Stencyl runs onWhat makes Stencyl differentSuccessful games created with StencylUsing the free version of StencylInstalling Stencyl and testing the setup

How Stencyl works

If you have purchased this book, then you may already have an idea of what Stencyl is and how it works.

However, if you are browsing online or standing in a bookstore flicking through the pages of this book, then you might want to know that Stencyl is a no-coding toolkit for creating 2D video games that will run on many different mobile and desktop devices.

Scenes, or levels, within a game are created using Stencyl's drag-and-drop Scene Designer. The screenshot below shows the Scene Designer being used to modify one of the levels in the game that we'll be creating:

Tip

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: http://www.packtpub.com/sites/default/files/downloads/5961OT_ColoredImages.pdf

The instructions or logic for the gameplay can be created using Stencyl's Gameplay Designer— a clever system that utilizes building blocks which snap together to create a series of instructions that are used by the objects in our game. An example of some instructions being created in the Gameplay Designer is shown in the following screenshot:

How we'll learn to use Stencyl

All that is needed to follow the tutorials in this book are a desktop computer—Microsoft Windows, Mac OS X, or Linux will do just fine, along with the free version of Stencyl that can be downloaded from www.stencyl.com. The free version of Stencyl can be used to develop and publish Flash and HTML5 games, and it can also be used to develop and test games for desktop computers and mobile devices. If you want to publish games for platforms other than Flash and HTML5, then you'll need to pay for an annual subscription to Stencyl in order to access the additional publishing features.

A great way to learn to use a tool such as Stencyl is to complete a practical project, and over the course of this book, we will develop a game from a blank screen right through to completion, learning all the important features of Stencyl along the way.

The game will start in a very basic form and as we progress, we will use the tools within Stencyl to add features to our game until we have a final product that demonstrates many of the characteristics that a professional game should exhibit.

Later in this chapter, we'll install Stencyl and run some test games to ensure that everything is working properly. Then, in Chapter 2, Let's Make a Game!, we'll jump straight in and create a game with a character that we can control as it runs and jumps across a scrolling jungle scene and interacts with an interesting environment.

We're going to experience some amazing results very quickly, so the learning process is going to be fast paced and fun!

The following screenshot was captured while developing the game in Chapter 2, Let's Make a Game!, so it can be seen how quickly we will be progressing through the development of our game.

Why Stencyl is a great development tool

Stencyl is a ready-to-use, complete, game development studio that can be used by anyone from beginners to game development experts to create professional-quality games; there is no requirement to purchase or install additional software. The Stencyl game development process avoids the repetitive, complicated requirements of writing hundreds of lines of computer code, and gets you started with the creation of your games without being distracted by the intricate details that traditional computer programming languages require.

Rapid prototyping and development

If you have an idea for a game, Stencyl will enable you to rapidly create a working prototype, so that you can quickly progress to creating a completed game using the great features that come built into the Stencyl toolkit, including:

Scene DesignerDrag-and-drop Gameplay DesignerResource management (sounds and graphics)Animation editorGraphics editorOnline resource sharing

We'll be learning how to use all these features to enable us to quickly build our video game.

No code development

Games can be created without writing a single line of computer code, by using Stencyl's drag-and-drop Gameplay Designer. Its clever system of building sequences of commands using specially designed instruction blocks means that we can only create instructions that make sense to the computer.

If you have ever tried writing computer games using a language such as Apple's Objective-C or Adobe's ActionScript, you probably know how frustrating it can be to ensure that every bracket, period, and special symbol appears in exactly the right place. That's a problem of the past with Stencyl!

Sharing resources with other Stencyl developers

One of the many great features of Stencyl is StencylForge — a ready-built repository of game resources that can be used for downloading graphics, audio, gameplay rules (known as Behaviors in Stencyl), and utilities. You can also upload your own resources to share with others.

StencylForge is a remarkable asset to the Stencyl community, and it's one of the exciting features of Stencyl that we'll be learning to use while we develop our game.

In addition to being able to share resources using StencylForge, there is a great community of helpful Stencyl users for both beginner and experienced users at community.stencyl.com.

Platforms that Stencyl runs on

The Stencyl game development toolkit can be installed on the following desktop computer platforms:

Microsoft Windows (XP, Windows Vista, Windows 7, and Windows 8)Mac OS XLinux

The installation process for each of the above platforms is detailed later in this chapter.

Stencyl target platforms

When we talk about target platforms, we mean the devices that our game can run on.

Games created with Stencyl can be played on most common platforms including web browsers, Microsoft Windows, Mac OS X and iOS devices (for example, iPhone and iPad), Android, and Linux. The main issues that we need to think about, when it comes to the target platform, are the screen size of the game and how our game will be controlled (that is, keyboard, mouse, or touch). Stencyl does all the hard work for you!

Currently, at the time of publication, Stencyl can target the following platforms:

Apple mobile devices running iOS Version 4.1 and above, including:
iPod touchiPadiPhone
Google Android devices running Android Version 2.2 and above, including:
PhonesTablets
HTML5 web browsers:
Many web browsers and devices that support the HTML5 web standard
Microsoft Windows desktop PCs and laptops:
Windows XP and above
Mac desktop operating systems:
Mac OS X
Linux desktops:
Ubuntu distributions recommended

Targeting specific devices

If you need to target a specific device, it is important to ensure that it is supported. So, check the Stencyl website for the most up-to-date information, as details may have changed since publication.

Publishing desktop games

When creating games for desktop platforms, it's important to understand that you can only publish games for the platform on which you are running Stencyl. For example, if you are running Stencyl on a Windows PC, you can only create desktop games for other Windows PCs, and if you are running Stencyl on Mac OS X, then you can only create desktop games for other Mac OS X computers.

Publishing to iOS devices

Amazingly, if you want to publish to Apple's iOS devices using Stencyl, you don't need to own an Apple computer, which has been, until now, an expensive barrier to entry for would-be iOS game developers! The Stencyl Mobile and Studio annual subscriptions include access to the StencylBuilder service that enables Windows and Linux users to publish their Stencyl games to the Apple App Store as long as they are current members of the Apple iOS Developer Program.

Publishing to Android

Publishing to Android is a very straightforward process with Stencyl running on any supported desktop platform, and testing on an Android device does not require a developer license.

What makes Stencyl different

There are many game development tools available, but Stencyl has some stand-out features that make it very different from its competitors.

Stencyl runs on almost any desktop computer

Stencyl can be installed on nearly all popular desktop computers, and Stencyl files can be freely exported and imported between the different desktop platforms, which is very useful when working with friends or colleagues who use different platforms for game development.

Stencyl creates native code

Whichever platform we want to publish our game onto, Stencyl does all the hard work for us! It creates the game code specifically for that device, and it will not have to run the game in a wrapper that can slow our games down.

Although that might sound fairly technical, it just means that our games will run at the fastest possible speeds without us having to learn a new programming language for each target platform. Stencyl takes care of all the hard work when it comes to publishing to different target devices; we can just concentrate on creating our games!

You don't need to be a coder

Probably the greatest differentiator between Stencyl and other game development tools is the way in which the gameplay instructions are built. With many game development tools, you must hand-code the instructions in a specific programming language, which can be very tedious and time-consuming. Or, with some other development tools, you are required to point and click on the instructions that you want to select in order to build rules that the objects in your game will follow, which can be very restricting when it comes to complex gameplay.

The developers of Stencyl have created a system that offers an impressive set of options when compared to other currently available game development methods. There are four different options available to game developers when using Stencyl, so we can do the following:

Use Stencyl's built-in gameplay routines (called behaviors in Stencyl)Download existing behaviors from StencylForgeCreate our own behaviors using an intuitive drag-and-drop systemHand-code our own gameplay instructions using a traditional programming language called Haxe

The magic of Stencyl is that we can mix and match any combination of the above development methods!

For example, if we want to create a basic game with common gameplay features, it's very easy to use Stencyl's built-in behaviors, and it's quite possible to develop a complete game in this manner.

At the time of publication, there were more than fifty built-in behaviors, a small sample of which is shown in the following screenshot:

Once we understand how the prebuilt behaviors work, we can either customize existing ones or we can create our own from scratch using the drag-and-drop behavior editor.

The following screenshot shows an example of a custom-built behavior, and even if you have never seen Stencyl before, you might be able to understand some of the instructions.

Finally, more advanced developers may choose to hand-code their own special game routines using the Haxe programming language (pronounced Hex, according to the main developer). This is certainly not a requirement for creating games, and many Stencyl users have never even tried this kind of development! Most Stencyl developers use a combination of prebuilt behaviors, customized behaviors, and also behaviors that they have created themselves, and these are the methods that we are going to be using throughout this book.

When our game is finished, we just need to decide which platforms we want to target, and Stencyl will do the rest with a few clicks of the mouse!

Using the free version of Stencyl

The free version of Stencyl has very few limitations compared to the subscription versions and in practice, you can use all the important game development features and make any kind of game with the free version that you can make with the subscription versions.

The main limitations of the free version of Stencyl are:

Only Flash and HTML5 games can be publishedA Stencyl splash screen is displayed for a few moments when a published game loadsCustom preloaders can't be implemented (these are the loading screen and progress bar that you see when your game first loads)Some monetization features are limited

The great thing about the free version of Stencyl is that we can develop our games to completion, publish them for Flash or HTML5, and even sell them if we wish.

If, after publishing for Flash or HTML5, we find that a game is very popular, we can then pay for the appropriate Stencyl subscription and sell the game in the Apple App Store, or for Android devices in the Google Play store. We can learn how to use Stencyl and develop games for free to see if people like them, before paying for an annual subscription!

If you are a member of the Apple iOS Developer program, games can be created and tested for the Apple iOS devices with the free version of Stencyl, but they can't be published to the Apple App Store. In Chapter 10, Targeting Mobile Platforms, we'll look in more detail at the options available, and the requirements for publishing to mobile devices running iOS and Android.

Using the free version of Stencyl with this book

In order to follow the game development tutorials in this book, only the free version of Stencyl is required. Subscriptions to Stencyl are only necessary for publishing to mobile devices and desktop applications.

The following matrix shows the major differences between the free and subscription versions of Stencyl:

Please note that the previous matrix provides only a summary of differences between the available versions of Stencyl. It is vital to check the Stencyl website (www.stencyl.com) for the latest features prior to making a purchasing decision, as the feature list may have been updated since publication.

Successful games created with Stencyl

Many successful games for Flash and mobile devices have been created with Stencyl. In some cases, they have been created by experienced developers who have switched to Stencyl to speed up the development process, and in other cases, the games have been developed by newcomers to game development, who had previously been unable to create their own games due to the complexity of traditional programming languages, or who had simply not attempted to create a game previously.

Following are three examples of successful games that were created using Stencyl:

Making Monkeys: Making Monkeys is an original, fun, platform game created by Greg Sergeant of greg-anims.com. The idea of the game is that very weird-looking monkeys can use a special weapon to duplicate themselves and solve various puzzles. Making Monkeys was sponsored by Armor Games and has gained over 1 million game plays.

Greg has stated that it only took him a few days to create the prototype of the game and that Stencyl enabled him to try out new gameplay elements very quickly.

Kreayshawn Goes to Japan: The first game that Beth Maher (www.bethmaher.com) created was called Kreayshawn: The game. The game, shown in the following screenshot, was created by her with Stencyl during a workshop project that was designed to encourage women to become involved in the indie game industry.

The development of this fan game led to Beth working with Columbia Records (part of the Sony group of companies) to produce Kreayshawn Goes to Japan, for Kreayshawn's fan website (arcade.kreayshawn.com). The game is a bright, imaginative platform game featuring Kreayshawn as the main character.

Impossible Pixel: Impossible Pixel and the Fate of Destiny, created by 99 Up Games, is a challenging platform game with 93 levels, available on iPad and iPhone. This game takes advantage of the touchscreen features provided by iOS; the buttons for controlling the player can be seen in the lower-left and lower-right corners of the following screenshot:

At the time of writing, Impossible Pixel, according to the developer's figures, had been downloaded from the Apple App Store approximately 700,000 times and had reached the position of the most popular free download on the App Store in nine countries. It was also the second most popular free download in thirty other countries, including the US App Store.

Impossible Pixel includes many professional features including Game Center achievements, high score leaderboards, atmospheric retro soundtrack, and many interesting challenges throughout the game.

The Stencyl Showcase

The listed games are a very small sample of the successful games that have been published using Stencyl. The Stencyl website contains areas dedicated to showcasing games, and it's certainly worth visiting Stencyl Showcase for inspiration, and to see some examples of impressive games that have been created with Stencyl.

www.stencyl.com/stencyl/showcase/www.stencyl.com/stencyl/successes/

Installing Stencyl and testing the setup

We've had a look at what Stencyl can do and how we are going to learn to use it. So, let's jump right into the next vital step and install Stencyl. The following section of the book is split into four parts. The first three parts will explain how to install and run Stencyl on each of Microsoft Windows, Mac OS X, and Linux, and the fourth part will step through creating an account and quickly testing Stencyl to make sure that everything is working.

Once we have Stencyl up and running, we'll head off into Chapter 2, Let's make a game!, where we'll quickly progress with the development of our first game.

Installing Stencyl

Let's look at how to install Stencyl on each of the three desktop platforms that it supports: Microsoft Windows, Mac OS X, and Linux.

Microsoft Windows

Stencyl will currently install on the versions of Windows listed as follows:

Windows XPWindows VistaWindows 7Windows 8

The download and installation methods are the same for each version of Windows, but the following screenshots have been captured in Windows 7.

Time for action – downloading and installing Stencyl on Windows

In this session, we're going to download and install Stencyl on Windows:

Visit www.stencyl.com.Click on the Download Now button on the home page.Depending on which web browser you are using and how you have configured it, the latest Stencyl installation file will start to download automatically, or you may have to confirm that you accept the download and specify the download location.When the installation file has downloaded, find it in Windows Explorer and double-click it to start the installation process. You can see the dialog box shown in the following screenshot:Click on Next to accept the default installation folder.Click on Install to set the installation process running. Usually, the installation process will take less than a minute to complete, but the time may vary depending on the specification of your computer.When the installation has completed, click on Next again to display the final dialog box shown in the following screenshot:I recommend clicking on the Run Stencyl option to remove the checkmark so Stencyl does not run automatically.Click on Finish to complete the installation of Stencyl.

Note

Because of the system access that Stencyl requires, you may need to run Stencyl as the Administrator on a Windows PC when updating or the first time after purchasing a subscription. This can easily be achieved by right-clicking on the Stencyl application icon and selecting Run as administrator.

What just happened?

We have just downloaded the latest version of Stencyl for Windows, and the installation is now complete. If you want to delete the installation file that you downloaded, then that's fine; it's not needed any more.

Note

When running Stencyl for the first time, we are asked to sign in. The signing in process is the same for all platforms and is detailed under the heading, Creating a Stencyl account, (after the Linux installation procedure in this chapter).

Mac OS X

Stencyl will currently install on all versions of Mac OS X, but it should be noted that Java 6 must be installed in order for Stencyl to work.

Note

At the time of writing, Java 6 was a mandatory requirement for correct operation of Stencyl; Java 7 is not compatible.

The download and installation methods are the same for each version of Mac OS X, but the following screenshots have been captured in Mac OS X 10.7.4.

Time for action – downloading and installing Stencyl for Mac OS X

In this session, we're going to download and install Stencyl for Mac OS X.

Visit www.stencyl.com.Click on the Download Now button on the home page.Depending on which web browser you are using and how you have configured it, the latest Stencyl installation file will start to download automatically, or you may have to confirm that you accept the download and specify the download location.When the installation file has downloaded, double-click on the stencyl.dmg file to automatically mount it and start the installation process.When the application's files are ready to install, the following window will be displayed:To complete the installation, click-and-hold on the Stencyl icon and drag it on top of the Applications icon. The Stencyl files will be copied into the Applications folder, and Stencyl is then ready to run!

What just happened?

We have just downloaded the latest version of Stencyl for Mac OS X, and the installation is now complete.

The stencyl.dmg file can now be unmounted and deleted; it's not needed anymore.

Note

When running Stencyl for the first time, we are asked to sign in. The signing in process is the same for all platforms and is detailed under the heading, Creating a Stencyl account, (after the Linux installation procedure in this chapter).

Linux

Stencyl should install on most recent versions of Linux, but Ubuntu distributions are recommended. For the following screenshots, Stencyl was installed and tested on Ubuntu Version 10.10.

Time for action – downloading and installing Stencyl for Linux

In this session, we're going to download and install Stencyl on Linux.

Visit www.stencyl.com.Click on the Download Now button on the home page.Depending on which web browser you are using and how you have configured it, the latest Stencyl installation file will start to download automatically, or you may have to confirm that you accept the download and specify the download location.When the download has completed, right-click on the downloaded tar.gz file and select the Open With Archive Manager option as shown in the following screenshot:Open the folder where the files were extracted.Stencyl is now ready to run!

What just happened?

We have just downloaded the latest version of Stencyl for Linux, and the installation is now complete.

The Linux version of Stencyl doesn't really need installing – we just needed to extract the files to create the Stencyl folder so that the application files are accessible.

If you want to delete the original download file, that's fine; it isn't needed anymore.

Creating a Stencyl account

Now that we have installed Stencyl, the next step is to run a quick test to ensure that everything is working, so we can then dive into the next chapter and create our first game.

Time for action – creating an account and signing in

Although it is not a requirement to sign in to create games with Stencyl, we won't be able to publish any games, access StencylForge, or contribute to the Stencyl online forums without an account.

In order to follow the tutorials in this book, we'll need access to StencylForge, and we'll also need to be able to publish our games, so I highly recommend creating a Stencyl account and signing in.

Run Stencyl and the following screen will be displayed:If you do not see the sign-in screen, ensure that you have Stencyl running, and select File | Sign In on the main menu at the upper-left corner of the Stencyl screen.

Note

If you have already signed up for an account on the Stencyl forums, you do not need to create a separate account in order to log into Stencyl. The Stencyl application login and the Stencyl forum login use the same credentials; so, you can sign in to Stencyl without any further action!

Click on Create an Account and enter your username, password, and e-mail address in the right-hand side of the dialog box shown as follows. Note that Stencyl usernames and passwords are restricted to alphanumeric characters (letters and numbers only).

Note

Choose your username carefully as it will be your permanent Stencyl login name and username on the Stencyl online forums!

When you are confident that you have entered the correct details, click on the Sign Up button, and after a few seconds a confirmation message will be displayed as shown in the following screenshot:Click on OK to confirm, and we are ready to start using Stencyl!

What just happened?

We have created an account so that we can access the important features of Stencyl. The same account credentials can be used to log in to the Stencyl forums at community.stencyl.com.