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
25
S
8
Posts: 219
Reputation: 2,181

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
55
S
28
G
115
Posts: 1,709
Reputation: 65,116

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
25
S
8
Posts: 219
Reputation: 2,181

Post » Sun Mar 12, 2017 2:51 am

Mistakes were made.
B
55
S
28
G
115
Posts: 1,709
Reputation: 65,116

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
25
S
8
Posts: 219
Reputation: 2,181

Post » Mon Mar 13, 2017 11:16 am

B
67
S
24
G
7
Posts: 1,519
Reputation: 11,084

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
78
S
23
G
69
Posts: 1,354
Reputation: 44,037

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
55
S
28
G
115
Posts: 1,709
Reputation: 65,116


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 52 guests