How do I manage families data using array

0 favourites
  • 1 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hello !

    I searched for information about this type of things but I found nothing, excuse me if I missed something

    I've got a family called Monster with some instance variables for them like : hp, lvl, damage, speed etc.

    As I have a lot of different monsters and different variables, I want to manage their attributes with an array (using the plugin from rex, csv2array) and I'm trying to avoid a lot of events so I'm wondering if there is any simple solution using the family, but I don' know how to do this properly.

    So, I'm using a loop in the array, only on the column (X=0) because in this column I store the ID of the monster.

    And I compare every value of this column. And I'm trying to apply modifications of the monster of this row using the array.

    For example, If array.At(0;0) value = 1, it means that on this row, I have the data for the monster 1. So I can do Monster1.HP = array.At(1;0), Monster1.damage = array.At(2;0) etc. etc.

    But as I have a lot of monster and a lot of variables to change, how can I use families to simplify the process? Maybe it's something about picking but I'm a bit confuse about this. I've read some tutorials about this but I'm still struggling with this.

    I expect to have maybe something like this :

    Loop in the array

    -if curX=0

    --if value = 0

    ---function SetAttributes ( param Monster1,param curY)

    --if value = 1

    ---function SetAttributes ( param Monster2,param curY)

    --if value = 2

    ---function SetAttributes ( param Monster3,param curY)

    and of course with the function :

    OnCall (SetAttributes)

    -ID = function.param(0)

    -Row = function.param(1)

    -pick in familyMonster, function.param(0)

    --familyMonster.HP = array.At(1,Row)

    --familyMonster.damage = array.At(2,Row)


    But I'm not sure how to manage calling function with the right monster, and the picking in the function...

    I hope it's clear and somebody can give me a clue

    Thank you !

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)