How do I find the average value of variables

Get help using Construct 2

Post » Thu Nov 26, 2015 8:59 pm

I've been adding all the values for each sprite and dividing it by the total number of sprites, is there anyway to do that? (Ex: for each sprite add sprite.size to Globalvariable then divide by the number of sprites is what I've been doing but is there some sort of function I can use instead?)
B
20
S
7
Posts: 195
Reputation: 1,893

Post » Thu Nov 26, 2015 9:02 pm

Create a Family with all the sprites. Then run a System > For Each loop SpriteFamily. i to SpriteFamily.Count (I think) GlobalVar + SpriteFamily.Size then divide the var by SpriteFamily.Count.
B
61
S
19
G
7
Posts: 72
Reputation: 7,198

Post » Fri Nov 27, 2015 1:12 am

That's what I've been doing, I mean to ask is there any other way to do it? Like maybe some kind of function or something? I don't think there would be but I thought I'd ask
B
20
S
7
Posts: 195
Reputation: 1,893

Post » Sat Nov 28, 2015 3:18 pm

Well if there's is I haven't found it so I guess I'll just keep doing what I've been doing, it's just kind of annoying because with what I'm working on I'll have to do that a lot
B
20
S
7
Posts: 195
Reputation: 1,893

Post » Sat Nov 28, 2015 3:43 pm

bbjGames wrote:Well if there's is I haven't found it so I guess I'll just keep doing what I've been doing, it's just kind of annoying because with what I'm working on I'll have to do that a lot


And why would that be an issue?
Three lines, isn't that much?

Image
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Nov 30, 2015 1:30 am

I mean it isn't much I dunno I just thought there'd be some other way but there isn't so it's fine :)
B
20
S
7
Posts: 195
Reputation: 1,893


Return to How do I....?

Who is online

Users browsing this forum: AkbarAsgharMG, blackhornet, giorgio1982, Yahoo [Bot] and 1 guest