Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Stencyl Essentials
Stencyl Essentials

Stencyl Essentials: Build beautiful, unique, cross-platform games rapidly with the free Stencyl 2D game engine and toolset

By Richard Sneyd
€19.99 €13.98
Book Apr 2015 206 pages 1st Edition
eBook
€19.99 €13.98
Print
€24.99
Subscription
€14.99 Monthly
eBook
€19.99 €13.98
Print
€24.99
Subscription
€14.99 Monthly

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Apr 27, 2015
Length 206 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781784399450
Category :
Languages :
Table of content icon View table of contents Preview book icon Preview Book

Stencyl Essentials

Chapter 1. Exploring the Stencyl Toolset and Game Engine

Stencyl Essentials has been written as a no-nonsense, concise guide to acquiring the functional use of Stencyl in as little time as possible. To achieve this, little or no time is wasted discussing the basic computer science and/or programming concepts, as this fundamental knowledge is assumed on the part of the reader. In line with that, highly detailed instructions on how to download and install Stencyl will not be provided, as this is not considered to be a challenging process for someone with previous computer science experience. However, a simple, lucid outline of the process will be provided.

In this chapter, we will begin by downloading and installing the free version of Stencyl. The free version is all that is required to complete the lessons in this book. Immediately after that, we will begin exploring and rapidly become acquainted with the Stencyl interface, including all of the most important areas and layouts, which are as follows:

  • Sign-in window

  • The Welcome Center

  • The Dashboard

  • StencylForge

  • Stencylpedia

By the end of this chapter, we will be comfortable enough to use Stencyl in order to be able to navigate through the most common screens, windows, and tabs at will and with relative ease. This newfound facility and comfort will stand us in good stead in the subsequent chapters, which will be fast-paced and punchy in the manner in which the new information is presented. Redundancy will be avoided wherever possible, which means there will not be a lot of needless posturing or repetition. So without further ado, let's start learning how to build games with Stencyl!

Downloading and installing Stencyl


Stencyl can very easily be downloaded free of charge from the official Stencyl website, www.stencyl.com. When you visit the landing page, you will see something that resembles the following screenshot:

Click on the Download button, which is prominently displayed on the landing page. You will then be given the option to download either a Windows, Mac, or Linux build:

Simply select the appropriate build for your operating system, and click on Download. This could take anywhere from 20 seconds to 20 minutes depending on the speed of your Internet connection and the size of the particular Stencyl build you are downloading. Once the file is downloaded, launch the installer (if you are installing for Windows), follow all of the prompts, and when the installation is completed, you will have the option to launch Stencyl. If you have downloaded the Mac version, you will have to extract the stencyl-full folder from the downloaded ZIP file, then put it in the Applications directory for it to become useable. Once you have completed the appropriate steps, launch Stencyl.

Tip

For Linux users, the installation process may be a little more complicated. It is beyond the scope of this book to delve into such particulars. However, there is an excellent guide to the Ubuntu installation on the Stencyl website itself, which is available at http://www.stencyl.com/help/view/install-stencyl-linux.

Creating an account and signing in


When we first launch Stencyl, it will ask us to either sign in with an existing account or register a new account. If you have already registered for the Stencyl forums, then you do not need to create an account here. The same login credentials are used to access Stencyl as well as the forums. You will see something similar to this in the following screenshot:

You need to complete one of these two tasks, obviously depending on whether you have a pre-existing account or not. Once this is done, we will be ready to explore the most important Stencyl screens and windows.

Exploring Stencyl – screens and windows


In this section, we will explore the most common fundamentals of the Stencyl screens and windows, briefly examining their basic nature and purpose, and learn how to navigate to them effectively and easily.

The Welcome Center

The Welcome Center is the first screen you will see after you first open Stencyl. Let's take a look at the following screenshot (your list of games will be different from mine; do not worry about this fact):

You may notice right off the bat that Stencyl does not have a native interface, whichever operating system you may be using (Windows, Mac, or Linux). In terms of style and aesthetics, it is entirely its own beast. The good news is that, because the toolset is written in Java, Stencyl looks much the same whether you're using it on Windows, Mac, or Linux. This is advantageous, as it is quite easy for us to jump from one OS to another without being disorientated by stylistic differences. What is more, games can be exported and imported between the installations of Stencyl as .stencyl files, across all the three supported operating systems, so you're never tied to just one OS. Let's look more closely at the important areas of this layout.

Drop-down menus

At the top-left corner of your Welcome Center layout, you will find a very familiar looking list of menus (see the following screenshot):

Here, we will find the very typical File menu that contains the menu items for common tasks, such as opening and closing games, importing resources (assets), importing and exporting games, signing in or out, and closing Stencyl. You will notice that some of the options in these menus are grayed out. This indicates that they cannot be clicked on in the current view. This is logical, as certain tasks can only be performed in appropriate contexts; for instance, it should be obvious that we can only click on Close Game when we already have one opened.

Next, we have our View menu, where we can switch between tabs, show or hide the Toolbar (the area that is shown at the bottom of the preceding screenshot), open up StencylForge, Stencylpedia, Game Settings, and the Log Viewer, all of which are important and will be discussed in good time. You will notice, as you scan the contents of the View menu, that the options have associated keyboard hotkeys. You may find it expedient to learn these, as it can improve your workflow with Stencyl in the long run.

The Run menu is only useful to us when we are inside a game project. It contains options for testing our game on various platforms, debugging tools, and so on. The Publish, Extensions, and Debug menus are likewise only really relevant when we have a game open. We cannot use them in the Welcome Center.

The toolbar

The toolbar, which is shown at the bottom of the previous screenshot, shows buttons for the following common tasks and windows:

  • Create a new game

  • Save a game

  • Import

  • Open the game settings window

  • Show log viewer (primarily for debugging)

  • Sign in

  • Access StencylForge

  • Open Stencylpedia

The Welcome Center tab

To the left of the layout, and as demonstrated by the following screenshot, we can see the Welcome Center tab (at the top-left corner of the window). All the screens in Stencyl are tabbed, so you can have several open at once. This includes scenes and actors, which we will learn about a little later on.

In the following screenshot, you will see that we have three drop-down menus:

  • My Projects: Click on this tab to see your existing game projects, or any game kits (a starter pack for a certain type of a game) you have at your disposal.

  • Download: When you click on Sample Games, it will take you to http://www.stencyl.com/developers/samples/. When you click on Extensions, it will take you to http://www.stencyl.com/developers/market/. Here, you can download extensions created by advanced Stencyl users, which add functionality to Stencyl.

  • News: This is a collection of links that will take you to the social media pages related to Stencyl, the Stencyl Blog, or the Forums. The Forums are an excellent resource for one and all, as they enable all members of the community to share resources, ask and answer questions, collaborate on projects, and engage in idle, Stencyl, or game-related chit chat—all of which are good things. There is also a members-only area, where paying subscribers receive extra support and assistance from the Stencyl team.

Now, it is the right time to download a demo game so that we can use it to explore the Dashboard and other important areas of the Stencyl interface, which are only accessible from within a game:

  1. Let's click on the Sample Games link.

  2. When the Sample Games page opens in your browser, click on the download button for Alien Approach.

  3. When the download completes, you should have a file called AlienApproach.stencyl. This file can be imported into Stencyl by navigating to File | Import Game. Then, you can navigate to the directory where you downloaded the sample game to (likely, your downloads folder).

  4. Double-click on the file to import it. After a few moments, you should see a new game appear in your games list that looks similar to the following screenshot:

  5. Double-click on the game to open it. We will use this sample game to explore our next major screen, the Dashboard.

Tip

A great way to get familiar with Stencyl quickly is to download all of the sample games we have seen earlier and tear them apart to see how they work.

The Dashboard

Once we have opened up our game, the Welcome Center disappears, and it is replaced with the Dashboard. This is the main view within our game. From here, we can access all of our game resources, such as Scenes, Actor Types, Tilesets, Fonts, Behaviors, and Sounds. In the following screenshot, you can see that these resource types are listed in the drop-down menu immediately below the Dashboard at the top-left corner of the page, under Resources:

Let's very quickly click on each one of these resource types, starting with Actor Types and working down. You will see that as you do so, the contents of the main window changes; we are presented with a list of all assets of that particular type. When you've gotten as far as Tilesets, let's move on to the Logic drop-down menu immediately below it.

You will see that in this menu, we have three submenu items: Actor Behaviors, Scene Behaviors, and Code. Actor Behaviors are attached to Actor Types or individual instances of Actors, and modify their functionalities with conditional logic. They are akin to components, which you may have worked with in other game engines, such as Unity.

Scene Behaviors are similar, except that we attach them to Scenes instead of Actors. Clicking on Code will allow us to write our own classes. This is an advanced feature, which we rarely need to utilize, but it's good to be aware that the feature is available to us, as our abilities in Stencyl develop to a more advanced level.

Believe it or not, these nine menu items constitute all of the major asset types within our games. Once we have learned them all, and how they relate to and interact with each other, we will have a working knowledge of Stencyl and will be quite capable of building our own games!

Scene Designer

Let's go back to the scenes view by clicking on Scenes in our Resources menu. You will see that there is already one demo scene in this example game. Now, double-click on it to launch the scene designer and edit our scene. You will be presented with an additional tab with the name of your scene on it, beside the Dashboard tab, and a screen as shown in the following screenshot:

Let's take a closer look at the six tabs that we see at the top center of the screen:

Clicking on any one of these will change our view to show tools and fields that relate directly to a certain aspect of our game. Here is a cursory breakdown of the different tabs and their relative significance in the crafting of a playable game level:

  1. Scene: This is where we sculpt the level by placing tiles and actors on various layers. To the left of the screen, you will see a tool palette, which is similar in some respects to what you might find in a graphics manipulation tool, such as Photoshop or GIMP.

  2. Behaviors: Here, we can add or remove Scene Behaviors as well as assign values to the exposed attributes; we'll be learning more about the attributes shortly. For now, just think of the term attribute as a synonym of the term variable, which is commonly used in math and programming vocabulary.

  3. Events: While we usually use events within our behaviors, there are some instances where we may decide to create a single event that is associated directly with the scene object. In any case, we will not be using this tab as often as the Behaviors tab.

  4. Physics: This is where we can set both horizontal and vertical gravity for our game level. How this gravity affects the individual actors within the scene will depend on how we have configured that specific actor's physics settings.

  5. Background: This is where we can add backgrounds and foregrounds to our level, which can be repeated horizontally and vertically. If desired, we can also add parallax scrolling settings—an effect that is popular in platformer games.

  6. Properties: This tab opens a window where we can alter certain basic scene properties, such as the Name, Size, and Background color (or gradient, if you should choose to use one).

Tip

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. 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.

The Palette

The Palette, which can be located to the right of the scene view (which is active by default when you first open the scene), is where we can go to select the tiles and/or actors we wish to paint onto the canvas. As you can see from the following screenshot, there are two tabs available to us within the palette—one shows the available actors, the other shows the available tiles that can be placed in our scene:

As we can see from the palette display, this particular game demo happens to contain only two tiles and seven actors in total. Some games can contain hundreds of each. If you take a look at the area above the palette area, you will see something similar to the following screenshot:

In the preceding screenshot, we have, from left to right and starting at the top, the following options:

  • Platform: Flash is the default choice. Click on the button to see a drop-down menu displaying all your available options. Which options are displayed here will depend on what operating system you're using. If you're using Windows, for instance, the options will be Flash (Player), Flash (Browser), Windows, and Android.

  • Test Game: By clicking on this tab, you can build and then attempt to launch the entire game for the specified target platform. The default scene, as identified by the star symbol, will be the first one to launch. Bring up the Log Viewer in tandem to view progress, warning, and error messages.

  • Test Scene: Unlike the Test Game button, this only builds the current scene, and launches it directly, ignoring the rest of the game. The Log Viewer can be used for debugging purposes, as before.

The Log Viewer

Let's learn more about the Log Viewer. The easiest way to launch this tab is by clicking on the quick launch button, which has conveniently been placed on the toolbar for us; a permanent fixture at the top of the Stencyl interface. Let's click on that button now, and then click on the Test Scene button we learned about just moments ago. After a moment or so, you should see the following window appear (on Windows – the Mac version is a little different), and start to fill with lines of information:

As you may have deduced, the information we are fed through the Log Viewer comes in the form of Events. These events, in turn, come in five basic categories:

  1. Debug: These events are useful for debugging. We can trigger this type of event ourselves to assist in the debugging code.

  2. Info: These events are helpful updates to let us know what is happening during the build or execution process of our program. They do not indicate a problem.

  3. Warning: These events indicate a possible problem in the execution of our code.

  4. Error: These events indicate that something has gone wrong. The Source and Message events will usually provide clues as to what has happened.

  5. Fatal: These events indicate that a fatal error has occurred, and the game can no longer execute.

Your cursor over each of the buttons is indicated in the following screenshot (to be found at the top-right corner of the Log Viewer window):

The first five color-coded circles enable us to toggle the different types of events to on or off. They occur in the same order that we examined earlier, beginning with Debug and ending with Fatal. When your game code is executing, the sheer volume of information being presented through the Log Viewer can be overwhelming, and hence, difficult to process mentally. Use these buttons to filter the displayed events, thus making it easier to read/debug.

The next three buttons relate to highlighting significant events for later consideration. The first one is the Marker. Simply select an event from the list, and click on this button to mark it. When you have marked multiple events, you can use the next two buttons to move up and down the individual items in your selection of events. The last button, in the form of a red X, will clear all of the current events.

Tip

You can experiment with the features of the Log Viewer discussed earlier, including the filtering options and marking tools. Take some time to absorb the basic purpose of each event type (or event level). Becoming comfortable with all these fundamentals now will speed up our progress throughout the chapters that follow.

Summary


In this chapter, we familiarized ourselves with the non-standard, yet beautiful and intuitive interface of Stencyl. Together, we examined many of the most important areas and views in the Stencyl toolset, including the Welcome Center, Dashboard, Scene Designer, and Log Viewer. Having acquired a basic understanding of the structure and layout of Stencyl, we are now ready to begin our fast-paced development project, the completion of which will lead to our mastery of the software. Let's begin – see you in Chapter 2, Starting the Game Project!

Left arrow icon Right arrow icon

Key benefits

What you will learn

Discover the key benefits of Stencyl, its technical structure, and what makes it so special Understand and work effectively with the Stencyl interface Set up scenes and alter their settings at will Import and utilize graphics Integrate sound FX and music in your games Create and configure actor types and instances Implement tilesets and backgrounds by importing them in to your game Write custom behaviors to control your actors

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Apr 27, 2015
Length 206 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781784399450
Category :
Languages :

Table of Contents

20 Chapters
Stencyl Essentials Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
Acknowledgements Chevron down icon Chevron up icon
About the Reviewers Chevron down icon Chevron up icon
www.PacktPub.com Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
Exploring the Stencyl Toolset and Game Engine Chevron down icon Chevron up icon
Starting the Game Project Chevron down icon Chevron up icon
Backgrounds and Tilesets Chevron down icon Chevron up icon
Building Levels Using Scenes Chevron down icon Chevron up icon
Actor Types and Instances Chevron down icon Chevron up icon
Writing Simple Behaviors Chevron down icon Chevron up icon
Complex Behaviors and Code Chevron down icon Chevron up icon
Adding Sound FX and Music Chevron down icon Chevron up icon
Adding HUD Elements Chevron down icon Chevron up icon
Adding Menus and Buttons Chevron down icon Chevron up icon
Scoring and Game Rules Chevron down icon Chevron up icon
Publishing and Monetization Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by


No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.