Okay for this tutorial, I started with consulting the Stencyl textbook, which has a decent introduction on page 50. I have worked with attributes last year where I followed a tutorial on building a turn based battle system. I actually want to find another tutorial to further expand on my skills as there's a lot involved with attributes.
Anyway attributes are the configuration information that is supplied to a behavior. Attributes can be almost any type of data like number, text, actor type or a list of items.
For the game I worked on last year; "Milk Run", I used the dialogue behavior from the RPG town template found in Stencyl. This had a list attribute that allowed you to add in the dialogue for each block of text. This did lead to some issues where you had to assign this to each character and remove the list completely and start a new one. If you didn't do this and just add on text to the list without removing the whole thing first, it will affect the other actors dialogue behaviour. I didn't know why it did this silly thing but I was very happy to find a way to work around it.
Reading about attributes in the stencyl textbook did help a bit in understanding the overall purpose of an attribute, but I want to work on another tutorial this week. Sunrisekingdom on YouTube makes a lot of tuts on Stencyl especially on attributes, so I'll check out if there's any ones I haven't seen yet.
Okay now on page 159 of the Stencyl text book is a tutorial on creating a game attribute to count lives. I've worked through this short tutorial which demonstrated how to count the lives of an actor. This will display text showing the number of lives which will decrease each time the player dies.
All you need to do is create a game attribute called Lives, then put it under the scoring category, name it as Lives, which will be a number type and set the initial value to 3 and click okay.
Next I went onto the next part where you you go into the manage player collisions actor behaviour and go into the collides with enemies event. Then go into the game attributes category button and find the purple set lives to 0 block which can found under number setters subcategory. You then need to drag this block into the orange when event and must be above the red block.
Next click on the drop down arrow of the set lives and choose the 0-0 in the maths section. Now in this left side of this block, click on the drop down and find lives in game attributes and in the right side type in 1.
Now find the print anything block in the flow flow section of the palette which is under the debug menu. and drag it just below the set lives block.
For the print block, click o the drop down arrow and find text & text in text and basics. Now I could not find this block in the standard Stencyl but it could in the 3x version which this text book is for. i Decided to pick text + text instead.
In the print block first empty space, type in Lives remaining: and the last one find anything as text under the basics menu.
In the as text block, go to the drop down arrow and select lives in game attributes under the number option. Finally test the game to see if it works.
Okay this didn't really work for me as I couldn't find the lives countdown text but this could be due to using text + text instead of text & text. This couldn't be helped due to that block not being in this version of Stencyl I'm currently using but it probably would have worked for Stencyl 3x.

No comments:
Post a Comment