In other words, if you create a behavior for an enemy in your game, you can easily export that to any other project, as the Stencyl structure was designed exactly for that purpose. Stencyl plays with the idea of object-oriented programming languages in that it distributes the parts of your project as completely modular and independent entities.
Stencyl save game how to#
Obviously the Internet provides an inexhaustible heap of knowledge to delve into any tool, but the learning curve is always more accessible if someone holds your hand through the first steps, not to mention that in the realm of software development doing your preliminary reading is almost as important as knowing how to handle code. The main obstacle faced by amateur developers when starting with a framework of this sort is fear of the unknown, that abyss of nothingness where you have to start molding your project from zero. It would be madness to try to present all the potential of this tool in a single article, so here we’re going to limit ourselves to providing an orientation for Stencyl users as to its enormous possibilities. The developer can then choose what happens next (e.g., changing Scenes accordingly).Development environments focused on video games are a dime a dozen, as we’ve seen before, but Stencyl is undoubtedly one of most balanced tools out there in terms of good results and ease of use. Loading a game amounts to reading in all stored Game Attributes. Score (as well as any other Game Attributes) will get saved automatically. All we need to do is to use the save block. Let’s say every time the player enters a new Scene, we want to save the game. If we want to keep track of a player’s progress between gameplay sessions, we can do so by storing any data that needs to persist into Game Attributes and then by using the save block. Saving a game amounts to storing Game Attributes. The following simple logic does the trick, using both the getter and setter blocks for the Score Game Attribute: Since this Game Attribute has the type Number, we can use it almost anywhere we could use any other number.Īs an example, say we want to increase the player’s score by 100 anytime a bullet collides with an enemy. Note: If you want to use a new Game Attribute in a Behavior you already have open, you’ll need to reload the Behavior using Ctrl-R ( Cmd-R on Mac).
![stencyl save game stencyl save game](https://static.packt-cdn.com/products/9781784399450/graphics/9450OT_01_04.jpg)
The new Game Attribute appears in the listing off to the right, sorted by category. The other fields can be left to their defaults. To start, once you've opened a game, click the Settings button in the upper left to open the master Settings dialog window.ġ-Click the Attributes button in the dialog.Ģ-Click the green Create New button in the upper right area in the dialog window.ģ-Enter a name (“Score”) for the Game Attribute. Note: As of version 2.2, the process for creating Game Attributes has changed. Let’s perform the following to create a new Score Attribute from the Dashboard: Although you can dump anything in, if you plan to save this data, avoid putting in unsupported data types.Ĭonsider our familiar vertical shoot ‘em up game.Ī perfect use case for using Game Attributes is to keep track of the player’s score, since presumably we want the score to persist between Scenes. Note: Unlike normal lists, Lists can only contain Numbers, Text and other Lists that contain the same.