- Home /
OOP data organation
I am looking for a way to set subvalues to values in my array in js. for example i've got an array of skills a player can use, and i want to set a [damage, rate, effect, and range] for each of the attacks in the array. but i don't know how to do this and i assume it can be done in OOP but i dont know how to program that way. So if anybody could please show me an example or tell me how to do it, it would be awesome.
thanks.
Comment
// C#
public struct Skill
{
int damage;
float rate;
// ??? effect;
float range;
}
public Skill[] skills;
to clarify, what @Dreamblur means is now you can populate your array with Skill
objects which will then have the above listed properties (read up on structs
)
In js, you create structs by inheriting from system.valuetype
public class Skill extends System.ValueType {
}