| Sprite Editor: Flags |
| The flag menus are probably the most confusing part of the editor. And I'll probably be answering questions about them until the day I die. But I'll try to explain it here.
What are these menus for?
| These menus allow you to control when things appear in the game.
What are "flags"?
| Flags are conditions. They control when things appear and disappear in the game, and when events occur. When a variable's value changes in the game, every sprite's "flag"
| condition is checked to figure out whether or not that sprite should still exist. Actually, each sprite can store a set of conditions, all of which need to be true for it to appear, otherwise it disappears.
NOTE: Not all games use flags. Platformer games usually don't need them. With a game like that, the editor will still be able to create and display flag conditions, but the game will ignore them and simply display all the sprites, all the time. With games like that, you don't even need to worry about these menus. You can ignore them completely.
"Preview" flags
| The list on the top-right controls which sprites you see in the editor. They're temporary and are not stored in the game. This allows you to see what the player
| will see at a given moment in the game. When the list is empty, you'll see EVERY sprite in this level, including the ones with flags. NOTE: The display won't change until you click the "update" button at the bottom of this list.
"appearance" flags
| Each sprite has its own set of conditions that control when it appears in the game. A sprite won't appear unless ALL of its conditions are met.
| (there can be more than one) And it'll vanish the moment one of them is NOT met. For example: _myVar = true This sprite will only appear when the variable called myVar is equal to true. And it'll disappear if myVar has any other value. If there are no conditions, (the list is empty) then this sprite will always appear.
How do I use flags?
| When you click on a sprite, you'll see the flags that control it on the left side of its options. The sprite will only appear in the game when ALL of these conditions are met.
| (there can be more than one condition) If the list is empty, the sprite will always visible. NOTE: A sprite's flags won't actually change until you click the "apply" button at the bottom of the list. You must click it to update the flags.
What are "conditions"?
| These are examples of things you can type into a flag list: myVar = true myObject.myVar < 9 myStory = "intro" myObject = undefined
| fooBar != undefined fooBar Think of it as a bunch of "if" statements. As you can see, you can also read variables that are inside of objects, or detect whether or not an object or variable even exists. Also... _myVar Is the same as writing: _myVar != undefined. It's just an easy way of detecting whether it exists.
My sprite disappeared!
| By default, the display flags (on the upper-right) are set to "none". Which effectively only shows the sprites that don't have any flag conditions at all. To view all the sprites, including the ones with flags, simply empty the display flag list on the top-right, and press the "apply" button. To view only sprites that require a certain condition, type that condition into the top-right flag list and press the "update" button.
How do I make a sprite vanish?
| To deliberately make a sprite disappear under certain conditions, type something like this: myVar != undefined The sprite will be visible until myVar gets a value. In other words: As long as myVar doesn't exist, this sprite will display. NOTE: Some sprites are able to remove themselves. For instance, RPG sprites can remove themselves or turn invisible using their script commands.
I'm still confused!
| I don't blame you. Here's a video demonstrating how to use flags.
| Last updated: January 23, 2010 |