Username or E-mail
Password (Forgot?)
New? Sign Up
Join or Sign In
Forums Stencylpedia Stencyl TV Translations Go Pro - Plans & Pricing Download Stencyl


Switch to Book Layout

1: Getting Started

  • Getting Started
  • Crash Course
  • Crash Course 2
  • StencylForge

2: Building Logic

  • What is a Behavior?
  • Creating a Behavior
  • Attributes
  • Game Attributes
  • Attribute Types
  • Events
  • Our Behaviors

3: Actors

  • What are Actors?
  • Animations
  • Motion & Forces
  • Physics
  • Controls
  • Collisions & Groups
  • Killing vs. Recycling
  • Tweening
  • Effects
  • Chapter 3 Challenge

4: Scenes

  • Scene Basics
  • The Camera
  • Tilesets
  • Regions
  • Drawing Text & HUDs
  • Changing Scenes
  • Music, Sounds & Channels
  • Backgrounds
  • Customizing Actors
  • Chapter 4 Challenge

5: Game Mechanics

  • Saving
  • Pausing
  • 3rd Party Services
  • Web Requests

6: Advanced Topics

  • Get/Set Attributes
  • Custom Events
  • Blending Modes
  • Lists
  • Custom Blocks
  • Continuous Collisions

7: Testing & Tuning

  • Testing Games
  • Optimizing Performance 1
  • Optimizing Performance 2

8: The Last 10%

  • Flash Publishing
  • Standalone Apps
  • iOS App Store
  • Chrome Store
  • Making Money

M1: Mobile - Intro

  • Getting Started
  • Testing on your Device
  • Flash -> iOS Guide

M2: Mobile - Basics

  • Atlases
  • Drawing Text
  • Retina Display
  • Accelerometer
  • Joystick
  • Universal Games

M3: Mobile - Services

  • iAds
  • Game Center
  • In-App Purchases

M4: Mobile - Publishing

  • Debugging
  • Publishing to the App Store
  • Optimizing Performance
  • Promoting your Game

A: Troubleshooting

  • Showstoppers
  • General FAQ
  • iOS FAQ
  • The 90% Memory Warning
  • Recovering Broken Games
  • Can't Export to SWF
  • Reloading Documents
  • Generating Logs
  • Flash Security Settings
  • How to Report Bugs

B: How-To Guides

  • Importing Assets
  • Scene Designer
  • Code Mode
  • Font Editor
  • Pencyl (Image Editor)
  • Tile Editor (Shapes)
  • Game Cleaner

C: Reference

  • Glossary
  • Block Reference
  • Useful Shortcuts
  • Stencyl API

D: Resources

  • Stencyl TV
  • Abigayl's Guides
  • Giving Critiques
  • Creating Extensions
  • Translating Stencyl
  • Credits

3.0 Drafts (In Progress)

  • What's New in Stencyl 3.0?
  • Setup (Android)
  • Setup (Desktop)
  • Setup (iOS) - Concepts
  • Setup (iOS) - Mac
  • Setup (iOS) - Windows
  • Testing iOS on Windows
  • iOS Troubleshooter

  • Mobile App Scaling
  • Full Screen Mode
  • Simple Physics
  • Backgrounding an App

  • iOS App Store
  • Mac App Store
  • Windows Store
  • Google Play
  • HTML5

  • Android Ads
  • Android Purchases (WIP)
  • 4" Form Factor (iPhone 5)
  • Mobile Input
  • Mobile Features

  • Extending the Engine
  • iOS / Android Extensions
  • Developing the Official Extensions
  • Developing the Engine

  • iAds (Revised)
  • Game Center (Revised)
  • iOS Purchases (Revised)
  • Atlases (Revised)
  • Drawing Text (Revised)
  • Joystick (Revised)
  • Accelerometer (Revised)
  • Sounds (Revised, WIP)
  • Debugging (Revised, WIP)
  • iOS Performance (Revised)
Level: Beginner

Customizing Actors

Contents

  • Introduction
  • What is Actor Customization?
  • You can refer to specific Actors/Regions inside a Scene
  • Example: Pressing Switches
  • Caveat: Don't use hidden attributes if you intend to customize an actor.

 

Introduction

Sometimes, you'll want to customize the "behavior" of an actor instance in order to make it act a little differently from the norm.

Suppose we’ve got a Goomba for a Mario game. Now, we want to make a Hopping Goomba, but we only want one.

You could do this by creating a brand new Actor Type, copying everything about the regular Goomba, and adding a Jump behavior. But a few too many times and you end up with this...

Is there a better way to go about this? There is. It’s called Actor Customization.


What is Actor Customization?

Actor Customization is a feature that lets you tweak a specific instance of an Actor to behave differently.

To customize an Actor, left-click on it, and then click the Inspector Pane tab on the right hand side of the screen.

Inspector Tab

From there, check "Customize" box in order to change the characteristics of the actor you've selected.

Customize Check Box

What can you customize?

1) Modify an actor’s set of behaviors.
You can add more behaviors or even take some away. You can click the + button in the Inspector to add a Behavior.

Add Behavior Button

Doing so will bring up a dialog that lets you choose a Behavior to add, for example one that lets our Actor jump and run.

Add Jump and Run Behavior

You can also delete a Behavior for an Actor from the Inspector by clicking the X button.

Delete Behavior

2) Modify the values for those behaviors.
For example, suppose that we want a particular Actor to walk really quickly. We could increase the “Minimum Speed” field for the
"Wander" Behavior.

Walking Speed

 

You can refer to specific Actors and Regions within a scene.

As you may know,  an Actor’s behaviors can’t directly refer to specific objects within a scene. This is why, when you attach a Behavior to an Actor, and that behavior has an Actor attribute, you see this.

Why? Because an Actor’s behaviors are generic, they have no connections to specific scenes. Every Actor behaves the same way, regardless of where it is.


Is there a way to enter values into these fields for Actors? There is! When you customize an actor, you can refer to specific Actors and Regions within a scene. Like this.

I’ll explain how to do this through a common example: pressing switches.

Example: Pressing Switches

Suppose that you're playing an adventure game like Zelda. You're inside a dungeon, and you come across a room with several switches. Stepping on a switch causes a particular door to open.

Download the Project

- Unzip and stick the project into your Games directory as "Switches"

- Don't know where your Games directory is? Click the "View Games Directory" button at the bottom of the Welcome Center (the first screen you see after opening Stencyl)

 

How can we use Actor Customization to make this work?

In a gist, we want to create a “Switch” behavior that, given a “Door” actor, will tell that Door actor to open up when our Hero steps (collides) on the switch. (The switch should also visually change to a pressed-down state)

Through Actor Customization, we can customize each instance of a switch to open up a particular door when pressed.


Walkthrough

(Note: I’m explaining how this works for this scenario. You’ll need to tweak the approach to fit your needs.)

1) Open the “Customizing Actors” project that you downloaded above.

2) Open the main scene.

3) Left-click the left switch, then click the Inspector tab on the right. Click the “Customize” check box in the Inspector.

4) Notice that you now have full control over what behaviors are attached to this particular switch!

Inspector Switch Behavior

5) Click on “Door Actor...” in the Inspector. A dialog will pop up. Choose the left door.

Choose Door

6) Test the game!

7) Finally, configure the other switch to open the other door. Test again.

That's it!

Checking for Understanding

You’ve customized the switch so that when that switch is pressed, the left door opens.

How does this work? Let's take a peek into the "guts" of this sytem. Open up the “Switch Behavior” behavior.



The key piece is the Actor attribute called “Door Actor” - when you customize the Switch actor inside a scene (by double-clicking it), this "Door Actor" attribute lets you pick a SPECIFIC door within the scene to act upon.



If you understand that connection, you fully understand how Actor Customization works.

 

Caveat: Don't use hidden attributes if you intend to customize an actor.

Readers have reported an issue in which hidden attributes are problematic when you attempt to customize an actor. For the time being, it is best to adhere to this limitation until the issue is fixed. 


Summary

  • Use Actor Customization to tweak the behavior of actors rather than creating brand new ones.
  • Actor Customization lets you modify the attached set of behaviors and modify each behavior’s values, for a particular instance of an Actor within a scene.
  • You can refer to specific Actors and Regions within a scene through Actor Customization.


Last Updated: 2013-01-29 by Jon

13614 have read this article
Disclaimer: The Stencyl Team does not actively monitor comments on articles. If you're seeking help for your game, please ask a question on the forums. Thanks!
7 Comments
jammer2407
i cant figure out how to delete an actor from a scene.
0 3 months, 2 weeks ago
MarkRosewood
It is possible to get this to work. It seems like it's just the 'Switch Behaviour' that's missing.

Steps to create it are:

Create an Actor Behaviour called 'Switch Behaviour'
Add an Attribute to it of type Actor called 'Door Actor'
Add an Event Collisions->Actor of Type
Add the red (above) 'trigger event ' block (from Behaviour->Triggers palette)
Type text 'open' and select attribute 'Door Actor' as above (except it's in red not blue)
Add the blue (above) 'switch animation to' block (from Actor->Draw palette)
Type text 'off' instead of the blue 'Pressed State' above
Save and go over to the Switch Actor and add the Switch Behaviour

Now you should be able to go to the Scene and do the customising as above and get the correct result when you run it.

0 6 months, 3 weeks ago
wizopizo
Please note that all of this is invalid now and doesn't work sadly.
0 7 months, 2 weeks ago
monkeydoodledo
Also, the customizable attributes must not be Hidden (right?)

Could not follow the Switches example because the download seems to be missing some behaviours, more detailed bug report here:
http://community.stencyl.com/index. php/topic,11810.0.html

0 11 months, 4 days ago
vegestoc
Also you need to check the little white box next to Customize for anything useful to show up.
0 11 months, 5 days ago
axelbig
Please upload a “Customizing Actors” project.
Thanks.

0 11 months, 3 weeks ago
Jon
Note that in 2.1 and later, the Inspector Pane is now the way to customize actors. Just click on an actor, and all of its details will appear on the right. You no longer need to double-click and work with the pop-up dialog.
0 12 months, 4 days ago



Commenting Guidelines

Sign In to Comment

Make Games

  • What is Stencyl?
  • Roadmap
  • Pricing

Play

  • Arcade
  • Showcase

Community

  • Forums
  • Chat
  • Translations

Help

  • Stencylpedia
  • Stencyl TV

About Us

  • Blog
  • Contact Us
  • Press
  • Privacy
Follow Stencyl on Twitter



© 2013 Stencyl, LLC.