How do I set average number from other points

Get help using Construct 2

Post » Fri Jul 08, 2016 11:24 pm

I have VariableA and VariableB
every time when i start play game timer is start
every 1second add to variableA + 1

When i need quit i click submit and i send this value of VariableA to variableB
But every time when i do this variable B should show average of all added varlues
B
25
S
8
Posts: 215
Reputation: 2,173

Post » Fri Jul 08, 2016 11:54 pm

You can't store an average in one variable. You need to store each variableA when you quit, so that you can take the average of all of the values.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Post » Sat Jul 09, 2016 7:44 am

@blackhornet so i must create multiple variables for this?
B
25
S
8
Posts: 215
Reputation: 2,173

Post » Sat Jul 09, 2016 1:19 pm

You need an array. Then store the array. OR, you need two variables. One for the sum (variableB), and one for the number of times the sum has been added (variableC). Then your average is variableB/variableC.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests