[SOLVED]problem counting objects

For questions about using Classic.

Post » Thu Apr 21, 2011 4:54 pm

hi everyone, well I'm been working in a game like arkanoid, every works well except for one thing. when the ball destroy all the block go to the next layout, ok. first I created a global variable(blocks) and a condition:
Star of Layout
----------------->+ System: For each Sprite5
+ System: Trigger once
-> System: Add 1 to global variable 'bloques'
and works, but here is the problem, when the ball collides with two or more blocks at the same time just count 1 in the global variable. so the next condition is not satisfied:
+ System: Is global variable 'bloques' Equal to 0
-> Wait: Delay 500 ms
-> System: Go to layout 2 with transition "None" lasting 0 MS
how to solve this little problem or what condition I can use for when the ball destroy all the block go to the next layout. thanks in advance.
here you are the .cap [url:1b554p45]http://www.box.net/shared/8s69oi3yyh[/url:1b554p45]
B
3
G
1
Posts: 9
Reputation: 518

Post » Thu Apr 21, 2011 4:57 pm

Where do you destroy the block? You might want to add 1 to the Bloques variable in the same event that you destroy the block object.
B
2
S
2
G
1
Posts: 109
Reputation: 1,068

Post » Thu Apr 21, 2011 5:04 pm

you can just have a
System - Compare - Sprite5.count is equal to 0
----------go to Layout 2

just so you also, you don't need a trigger once in a start of layout,
also, in other situations when you need to have that "two or more blocks at the same time" add the right amount to your global variable, there is a system condition CountMatching("Sprite5") that would tell you exactly how many things were overlapping.
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Thu Apr 21, 2011 5:33 pm

wow thank you so much the solution of lucid works perfectly
B
3
G
1
Posts: 9
Reputation: 518


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests