Reader small image

You're reading from  Stencyl Essentials

Product typeBook
Published inApr 2015
Reading LevelBeginner
Publisher
ISBN-139781784399450
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Richard Sneyd
Richard Sneyd
author image
Richard Sneyd

Richard Sneyd (BA Hons.) is the founder and CEO of CyberMyth Games, an indie game development studio based in Country Cork, Ireland. His role within the company requires that he wears many hats, including that of a programmer, designer, digital 2D and 3D artist, sound designer, scriptwriter, texture artist, leader, marketer, and business man. He is also a fully registered, qualified, and highly experienced lecturer. His specialty subjects include 3D modeling and animation, computer game programming, 2D image processing, game design, desktop audio, psychology, consumer behavior, human resources, and business management. In addition to classroom teaching, he is actively involved in online education, regularly publishing new courses, and various other learning materials, such as books and tutorials, in conjunction with CyberMyth Games. He is enthusiastic about his work, and his students and colleagues think of him as a very dedicated and accomplished teacher. All of his courses and books are characterized by a steady, incremental flow of information, and a lucid teaching style that is easy to understand and follow for all. He is a husband to his wonderful wife, Jennifer, and father to a wonderful son, Darius.
Read more about Richard Sneyd

Right arrow

Chapter 5. Actor Types and Instances

So far, we have come quite a long way in terms of assimilating the essential Stencyl workflow and learning how to structure the levels in our games, including the implementation of foregrounds, backgrounds, and tilesets to create ludic spaces. However, it is impossible to implement the actual gameplay elements without first learning how to create and deploy Actors in our levels. In this chapter, we will cover all the fundamentals of working with Actor types and instances. The key points covered here will include:

  • Creating Actor Types

  • Importing Animations

  • Customizing Animations, including frame duration in milliseconds and so on

  • Editing physics settings, such as, but not limited to, mass, linear and angular drag, friction, and bounce

  • Customizing collision shapes

  • Adding Actor instances to our Scenes and customizing them if required

By the end of this chapter, you will have the ability to implement the core gameplay elements into your games through the effective...

What are actors?


In Stencyl, only two resource types can have Behaviors or code attached to them. The relevant Behavior types are as follows:

  • Scene Behaviors: These are attached to Scenes and are usually used to handle more global events, such as timers and score keeping, not specific to one actor

  • Actor Behaviors: These are attached to Actors themselves and are generally used to govern their movement around the level, their physical interaction with other actors or tiles, and in some cases, to make the actor respond to user input

Coupling Actors with Actor Behaviors in an intelligent fashion allows us to create an unlimited variety of game mechanics and gameplay elements. Hence, the creative use of Actors is the key to bringing our game concepts to life within Stencyl.

Adding our first actor


Let's begin by adding the avatar, which will symbolize the player in the game, in game development parlance. The actor that represents the player in-game is generally referred to by the acronym PC (Player Character). Having established this, we will use this abbreviation from time to time henceforth. Perform the following steps for adding our first actor:

  1. Go to the Dashboard, and take a look at the now familiar RESOURCES pane on the left-hand side of the screen. Select Actor Types, which just so happens to be at the top of the list, as shown in the following screenshot:

  2. You can see that there is a cut-out styled button in the main view that contains the text This game contains no Actor Types. Click here to create one. Do as it says, and the Create New… window will pop up, as shown in the following screenshot. We are not complete strangers to this window, as it is the same window we used to create our Backgrounds, foreground, and Tilesets in Chapter 3, Backgrounds and...

Summary


Excellent job! You have now successfully created two very important Actor Types and configured all of their core settings, including the application of box, circle, and polygon collision shapes. In the next chapter, we will write our first Actor Behavior, and use this to control the movement of the Player Character (PC) through our levels, cycle, and switch animations, and handle its physical interactions with the other elements of the game world. Let's get going; it's time to start programming some gameplay!

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Stencyl Essentials
Published in: Apr 2015Publisher: ISBN-13: 9781784399450
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Richard Sneyd

Richard Sneyd (BA Hons.) is the founder and CEO of CyberMyth Games, an indie game development studio based in Country Cork, Ireland. His role within the company requires that he wears many hats, including that of a programmer, designer, digital 2D and 3D artist, sound designer, scriptwriter, texture artist, leader, marketer, and business man. He is also a fully registered, qualified, and highly experienced lecturer. His specialty subjects include 3D modeling and animation, computer game programming, 2D image processing, game design, desktop audio, psychology, consumer behavior, human resources, and business management. In addition to classroom teaching, he is actively involved in online education, regularly publishing new courses, and various other learning materials, such as books and tutorials, in conjunction with CyberMyth Games. He is enthusiastic about his work, and his students and colleagues think of him as a very dedicated and accomplished teacher. All of his courses and books are characterized by a steady, incremental flow of information, and a lucid teaching style that is easy to understand and follow for all. He is a husband to his wonderful wife, Jennifer, and father to a wonderful son, Darius.
Read more about Richard Sneyd