The game file to import and load for this session is 5961_07_08.stencyl
.
Pause Management
.Paused Banner
, by clicking on the Attributes section button in the block palette, then the Create an Attribute… button below the category buttons. Ensure that the new attribute is configured with Type as Actor as shown in the following screenshot:Create Pause Banner
.We have put in place the framework for placing a pause message on the screen.
The first step was to download the Paused Banner actor from StencylForge; when we add the instructions for pausing the game, this message banner will be displayed so players of our game will have a clear indication that the game has been paused. Because we do not want the banner to move under any circumstances, we configured its What kind of actor type? setting to Cannot Move. Because by default, all actors are configured to pause when the game is paused, we have specified that the banner cannot be paused. This will ensure that the banner is displayed correctly when all the other actors in the scene have been paused.
We then created a new scene behavior called Pause Management
, and we attached it to the three existing game levels, but not the scene named Level4. In the previous Have a go hero section, it was suggested that only one additional level should be added in order to avoid additional work later in the development process. Because we are still developing our game, we will almost certainly be adding additional scene behaviors that will be required for each of the game levels, and when we do add those behaviors, we must remember to add them to each and every level that already exists in the game. For this reason, it's a good idea to leave the design and creation of additional levels until the development process has been finalized. This allows us to simply duplicate existing levels along with all the behaviors that are attached to the original scene.
However, because we already have three levels in our game, the next step was to attach the new Pause Management
behavior to each of those levels. We could have done this after completing the design of the events in this behavior, but it's a good idea to attach it as soon as the behavior has been created, so that we don't forget to do it at a later stage!
The next step was to create an actor attribute called Paused Banner
, and this attribute will be used to store the instance of the Stencyl Book Paused Banner
actor that we have just created, so that we can access it easily from any other events with the Pause Management
behavior. We'll be accessing this attribute in the when created
event.
We then added the required instructions to the when created
event. The first block creates an instance of the Stencyl Book Paused Banner
actor with an x
and y
position of zero.
The second instruction in the when created
event, set Paused Banner to Last Created Actor
, sets the value of the Paused Banner
actor attribute that we created earlier, to the value of Last Created Actor
, which must be the newly created Stencyl Book Paused Banner
, because that actor was created in the immediately-preceding instruction block! This ensures that, as long as the scene is active, we can always easily refer to the banner using the Paused Banner
actor attribute; without this attribute, it would be very difficult to access and make changes to the banner.
We then inserted an instruction to hide the banner actor that we just created; this ensures that it cannot be seen by the player when the scene is first displayed. Note that we have just hidden the banner actor, so it cannot be seen; we have not killed it, so we can now manipulate it as required!
3.141.12.209