*Solved* How do I use local variables?

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hello, I am making a RPG style game, I have many classes and each class has attributes, I do not want to share these base attributes so I stuck them in a Group name "Warrior", "Mage", "Rogue", etc...

    Each one of these groups I have created local variables:

    Experience

    Health

    Strength

    etc....

    so later in my MainEvent Sheet I will add an action to add to Warriors health so how would I do this?

    in programing terms I would do something like warrior.health + 10

    how do I do this in construct?

  • I feel that you've structured your variables wrong - character stats should be global variables, your class selection should then inform the global variable.

    if Mage > set Health to 5

    if Warrior > set Health to 10

    etc.

    Your damage events then become much easier to manage

    onCollision with arrow > subtract(Defense-arrow.damage) from Health

    for example

  • ok that was my other way of thinking and I was already working with this.

    Thank you very much

  • I used instanced variables for stats in my turn based rpg demo. I put enemies and characters inside the same group and created the instanced variables in the group. There's probably different ways of doing stats, other people would prefer arrays.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you guys for the fast reply. I will look into both options and see what option will be best for what I plan on doing. Thank you both again!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)