[CAPX] Summation of instance variables?

Get help using Construct 2

Post » Tue May 09, 2017 11:57 pm

OK. The original issue got lost along the way. In the sample you had, set SUM_VAL = 0 in event 2, which is what I said originally. To generate the sum each iteration, you need to reset it to 0.
ImageImageImage
B
71
S
22
G
247
Posts: 3,753
Reputation: 137,552

Post » Wed May 10, 2017 12:14 am

blackhornet wrote:OK. The original issue got lost along the way. In the sample you had, set SUM_VAL = 0 in event 2, which is what I said originally. To generate the sum each iteration, you need to reset it to 0.

Here's my updated example
https://www.dropbox.com/s/048waz6x3ez9e ... .capx?dl=0

Sorry but I don't know where to put the SUM_VAL = 0 statement you suggested.
Event 2 has no condition thus I expect SUM_VAL to always be 0 if I pasted taht there.

Also, value is set to random 1,5 now for every click so I can compare to the brute force sum.
Image Image Image
B
32
S
12
G
27
Posts: 761
Reputation: 17,244

Post » Wed May 10, 2017 12:59 am

http://www.blackhornettechnologies.com/Construct2Stuff/InstanceSumming.capx
There were so many things I'd change, I've created a second event sheet. Have a look.
ImageImageImage
B
71
S
22
G
247
Posts: 3,753
Reputation: 137,552

Post » Wed May 10, 2017 6:30 am

blackhornet wrote:http://www.blackhornettechnologies.com/Construct2Stuff/InstanceSumming.capx
There were so many things I'd change, I've created a second event sheet. Have a look.

I see. Thanks! :)
Image Image Image
B
32
S
12
G
27
Posts: 761
Reputation: 17,244

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests