How do I make a simple skill system.

Just started using Construct 2? Post your questions here

Post » Tue Mar 18, 2014 4:31 pm

Hi! I have read the manual and different tutorials about C2 but I didn't catch the idea of making a simple skill system of my hero in platform game. The goal which i'm going to achieve is very simple, I need
-dmg (for example 2-6)
-defence
-health
-mp
and for a mage I need different skills, which you should open on the new level.

The problem is that I don't understand the difference between instance value, array, and dictionary. All of these instruments can be used to reach my goal?
B
7
S
1
Posts: 73
Reputation: 603

Post » Tue Mar 18, 2014 6:09 pm

An Instance Variable is a variable that is tied to an instance of an object. So you could create an object call Monster and give it an instance variable of Health. If you place multiple copies of that Monster object on the layout they are instances of Monster, each with their own Health.

An Array is kind of like a box that is divided up into compartments to hold things. The default Array is divided up into 10 compartments numbered (0, 1, 2, 3, 4, 5, 6, 7, 8, 9). So to set a value in the 3rd compartment to 20 you would apply an action on the Array to Set value at (2) to 20. The (2) represents the 3rd compartment because the array index starts at 0. You can also have a multidimensional Array. So you could divide that same 3rd compartment up into 8 compartments. So to set a value of the 6th compartment of the 3rd compartment to 50 you would apply an action on the Array to Set value at (2, 5) to 50. In Construct 2 the dimensions of the Array are referred to as X, Y, and Z. In my above example the "Z" would happen if you divided that 6th compartment up into additional compartments. This seems like it could be getting confusing, so I'll stop and see if you are following what I'm saying.
Found this:
https://www.scirra.com/tutorials/307/ar ... -beginners

A Dictionary is a set of key/value pairs. So you can have a key of "Tom" and set its value to 30. The key is similar to the Array compartment index value. In the Array example above we stored a value in the 3rd compartment. In the dictionary we store the value at compartment "Tom". In a Dictionary you have no control over the order. So if you had Dictionary with keys for "Tom", "Dick", and "Jane" you have no idea which one comes before the other. I haven't tested it in C2 but in Python it is considerably faster to access data stored in a Dictionary compared to an Array.
B
17
S
4
G
3
Posts: 172
Reputation: 1,933


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests