Scenes are a game’s “worlds” or “levels.” Scenes are where everything in a game takes place. This article talks about the fundamental concepts of Scenes.
Scenes and Game Flow
Scenes Control a Game’s Flow
Think about a game such as Super Mario Bros. When you play through the first level and reach the flagpole at the end, there’s a brief victory sequence, and then Mario proceeds to the next level.
Sometimes, scenes aren’t levels at all. Even a main menu itself can be a scene.
Putting this together, scenes can be thought of as various states in a game that you transition between, like a story.
Switching scenes is described later in this chapter (TODO: LINK), but in a gist, use these blocks to switch scenes. (Scene > Game Flow).
What are the building blocks of a scene? The scene’s terrain or “land” is typically made up of Tiles.
Much like the tiles on your kitchen counter or bathroom, Tiles in a game are uniformly sized pieces of land that conform to a grid. That is to say...
Every tile is the same size.
Tiles are spaced equally apart - by the tile size.
Why are tiles a great way to build levels? Imagine that you’re building a sophisticated action game such as Super Metroid.
It would be impractical to create separate sprites for each land mass. After a while, you’d run out of space trying to pre-render all of that!
Tiles are a cheap, reusable way of creating worlds. You’ll find that with tiles, virtually any kind of land form can be re-created with ease. Using this tileset...
We can make a rich landscape out of this.
Tiles need not be square. You can define tiles as triangles and any kind of convex polygon in order to support slopes and other complex forms of terrain.
What if you’re building a game where tiles are inappropriate, as pictured below? You’re able to define custom terrain to satisfy this use case.
(Not a tile-based game, use the Custom Terrain tool!)
For information on how to import tiles and work with our Tile Editor, read our article on that.
What if you want some parts of the scene to draw on top of other parts? For example, you may want a guarantee that the player draws in FRONT of the game’s scenery.
A Layer is a group of both Actors and Tiles that are drawn at the same time. In this way, Layers provide you a flexible yet simple way to determine what order things are drawn in.
To take the example above, here’s the breakdown of what’s on which layer.
Scenes can have an arbitrary number of layers. There’s no limit and no performance hit to having more layers as opposed to fewer.
Use the Layers Pane inside the Scene Designer to manage layers. You can create, remove, rename and re-arrange layers using this interface.
Sometimes, you’ll want to change what layer an Actor is on. To do this, use the following blocks. (Actor > Draw)
When sending an Actor to a particular layer, specify the Layer’s ID. You can find this inside the Layers Pane inside the Scene Designer. In the future, we’ll let you specify a Layer’s name instead.
Every element inside a Scene has a position. This position consists of an X (horizontal) and Y (vertical) component and corresponds to the top left corner of that element.
(0,0) is the top left most point in the scene.
A higher X value moves you towards the right, while a higher Y value moves you towards the bottom.
Every scene has boundaries (a size) that you define when you first create the scene. These boundaries control how far the Camera can travel and how far Tiles can extend.
Although actors can go beyond a scene’s boundaries, actors that are not designated as always active will “freeze” upon doing this.
Imagine boundaries to be like the limits of a level in Mario
Going beyond certain bounds is either not permitted (left & right) or leads to death (off the bottom).
Scenes control the flow of a game, like a storyboard.
Tiles are equal-sized building blocks. They define the terrain.
Layers group together tiles & actors in order to control drawing order.
(0,0) is top left in our coordinate system.
Scenes have boundaries (a size) that define how far actors and terrain can be placed.
Last Updated: 2012-03-30 by Jon
28614 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!
Sign In to Comment