1: Getting Started
2: Building Logic
5: Game Mechanics
6: Advanced Topics
7: Testing & Tuning
8: The Last 10%
M1: Mobile - Intro
M2: Mobile - Basics
M3: Mobile - Services
M4: Mobile - Publishing
B: How-To Guides
3.0 Drafts (In Progress)
Stencyl supports Code Mode, a way to write behaviors entirely using code (currently, ActionScript 3).
This article surveys the interface and explains how to accomplish crucial tasks, such as defining attributes through annotations.
Top Tool Bar
This area has four separate buttons, Check Syntax, Refresh Attributes, Open in External Editor, and View API.
The Attributes Pane stores all attributes currently defined by this behavior. To define attributes, you have to annotate them. Scroll down to the "How to Define Attributes" section for further details.
This area is split in to two sections, one where you add new code, and the other area that shows compiler output when you press Check Syntax.
Syntax highlighting and simple code completion are supported, as well as find/replace.
Using External Editors
Stencyl plays nice with external editors such as Notepad and FlashDevelop.
Configure this setting inside Preferences > Workspace. It will open up the editor on demand and auto-sync the changes when you save in that external editor.
Note: In the future, we will begin bundling FlashDevelop, which is in the process of being ported to Mac and Linux and will support more languages than just ActionScript.
Switching Between Design and Code Mode
At this point in time, we don't support switching between these two modes.
It's possible in the future for there to be a one-way conversion from Design Mode to Code Mode, but the reverse will likely be impossible to do (think about it...)
In order to expose a class member for a Code Mode Behavior as a configurable attribute, you need to annotate it. The easiest way to learn the syntax is by example.
//Expose your attributes to Stencyl like this [Attribute(id="1", name="Display Name", desc="An Attribute")] public var attributeName:String = "default";
By Stencyl 3.0 and possibly sooner, we will completely replace and revamp the code editing experience with something significantly more advanced and productive for serious coding. Stay tuned!
Last Updated: 2012-05-13 by Ceric
16339 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!