How do I set text to total variable = spritecount????

0 favourites
  • 6 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Anyone can help me with this? I make 10 copies of sprite with instance variable. but i want to set text to get the total of each sprite variable since each sprite variable will be randomize.(not clone)

    Every tick: set text to spritecount????? maybe?

    is there any method for this?

  • yoyo - i still don't understand, can you give me a example or anything?

    did you mean like this

    every tick - system: set LOCALVARIABLE value to sprite.self.variable?

    - set text to LOCALVARIABLE

    i tried every thing btw but result keep showing failed...

  • yoyo i tried your method but the number keep increasing...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yoyo i tried your method but the number keep increasing...

    Make sure that is a "Local Variable" and not a Global Variable that can be the problem

  • ah oops

    It worked now...thank you yoyo and tarek2...appreciate it. :D

  • ah oops

    It worked now...thank you yoyo and tarek2...appreciate it. :D

    Cool no problem

    This Answer is for the First question:

    There is no way around it, you have to loop through each one of them and add the Values to a Variable first as yoyoEleanor showed you, but if you wanna avoid doing it every Thick, One alternative is to create a "Global Variable" then add at the start of the Layout the Total of all the Variables then after just keep updating it whenever one of them changes the Value of their Variables.

    Your Trigger for changing RandomValue:

    Action: Subtract the old Value from "Global Variable" then add the New Value

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