How do I count sprite with first animation frame ?

Get help using Construct 2

Post » Sat Mar 11, 2017 8:05 pm

i try set text object to set text > sprite.count...and that works
But this sprite have two animation frames and i need to know how many is objects with frame 0 and frame 1
?
B
24
S
7
Posts: 208
Reputation: 2,032

Post » Sat Mar 11, 2017 8:14 pm

Use a counter variable

For Each Sprite
Animation frame = 0, add 1 to counter
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Sat Mar 11, 2017 10:19 pm

oosyrag wrote:Use a counter variable

For Each Sprite
Animation frame = 0, add 1 to counter



Dont work, i also add trigger once and counter count multiple times
B
24
S
7
Posts: 208
Reputation: 2,032

Post » Sun Mar 12, 2017 2:51 am

Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Mon Mar 13, 2017 9:48 am

oosyrag wrote:https://www.dropbox.com/s/e330q1l63bano0o/conditionalcount.capx?dl=0



Hi, thanks for capx,
i try modify this to my projects but something gone wrong
can you take look at this?
https://dl.dropboxusercontent.com/u/447 ... ount2.capx
B
24
S
7
Posts: 208
Reputation: 2,032

Post » Mon Mar 13, 2017 11:16 am

Image
B
63
S
23
G
7
Posts: 1,480
Reputation: 10,796

Post » Tue Mar 14, 2017 2:07 am

pick all by comparison expression should solve this

condition or expression should look like the following

pick all by comparison

sprite

sprite.animationframe = 1

action

text1 set text to pickedcount

=========================

pick all by comparison

sprite

sprite.animationframe = 2

action
text2 set text to pickedcount.
B
70
S
20
G
67
Posts: 1,314
Reputation: 42,301

Post » Tue Mar 14, 2017 7:02 am

Forgot about the pickedcount expression! Ignore my suggestion earlier, using pickedcount is the way to go.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 6 guests