If Programable_Matter
Member
I've tried to find the sum of an array by using the following code
CREATE EVENT
for loop......
value[1] = 1
value[2] = 1 all the way to value[40] and every single one is worth the value one
STEP EVENT
for i=1; i<=40; i++)
{
global.sum = global.sum + value
}
The problem is (like expected) it starts incrementing during the game many times while going through the STEP EVENT..... I should end up with the value 40 but it keep incenting throughout the game because of the STEP EVENT running throughout the game... how do I make so it's a solid number with the summation of the values
CREATE EVENT
for loop......
value[1] = 1
value[2] = 1 all the way to value[40] and every single one is worth the value one
STEP EVENT
for i=1; i<=40; i++)
{
global.sum = global.sum + value
}
The problem is (like expected) it starts incrementing during the game many times while going through the STEP EVENT..... I should end up with the value 40 but it keep incenting throughout the game because of the STEP EVENT running throughout the game... how do I make so it's a solid number with the summation of the values