How do I Count Objects with same AnimationFrame?

Get help using Construct 2

Post » Wed Jan 21, 2015 1:06 pm

Hello and first (as always) sorry for my english!

How can i count objects with the same animation-frame-number?

For example:
There's a playfield with X number of objects.
Each object has 10 frames (framespeed = 0; on create = random frame).
On combine more then two objects (adjacent) of the same color (frame) they will destroyed.

But how can i "test" if there are no more objects of the same color (frame), that lies side by side?

Thanks alot!
Last edited by Cherico on Thu Jan 22, 2015 11:29 am, edited 1 time in total.
B
22
S
6
G
2
Posts: 185
Reputation: 3,632

Post » Wed Jan 21, 2015 2:10 pm

I would suggest looking into the foreach loop target each instance of the object checking each frame
Need Sprites For Your Next Project?
100% Vector Animated Sprites
B
8
S
2
Posts: 170
Reputation: 1,086

Post » Wed Jan 21, 2015 2:13 pm

Like this perchance?
Image
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

Post » Wed Jan 21, 2015 2:40 pm

How can i do it for THIS game?

Have i check for all objects separately, if there is a "neighbor" with the same animation-frame?
B
22
S
6
G
2
Posts: 185
Reputation: 3,632

Post » Wed Jan 21, 2015 3:30 pm

Frame numbers
You do not have the required permissions to view the files attached to this post.
B
255
S
39
G
15
Posts: 1,982
Reputation: 41,005

Post » Wed Jan 21, 2015 4:27 pm

Thanks! I look at it ... I think about it ... But i find no solution how it will work for me.
I have to find out it if any object with the same color (frame-number) is near every other object - not anywhere else on the playfield ;)
But thanks alot for your help!
B
22
S
6
G
2
Posts: 185
Reputation: 3,632

Post » Wed Jan 21, 2015 4:52 pm

There is also command call nearest/furthest. Therefore just code if nearest than do this or that
B
255
S
39
G
15
Posts: 1,982
Reputation: 41,005

Post » Wed Jan 21, 2015 6:22 pm

Here i attached an test-file. Please show me, how to do it. :? :( :cry: :roll:

In this demo you can touch any object and it will change its color (frame) to any other random color (frame).
How can i realize, that (for example) every objects will be destroyed, wait 1s and restart the layout again, when no objects of the same color (frame) are side by side (one step horizontally, vertically and diagonally)?

I tried different things, but nothing work ... :(
You do not have the required permissions to view the files attached to this post.
B
22
S
6
G
2
Posts: 185
Reputation: 3,632

Post » Fri Jan 23, 2015 11:13 am

Do you mean like so
You do not have the required permissions to view the files attached to this post.
B
255
S
39
G
15
Posts: 1,982
Reputation: 41,005

Post » Fri Jan 23, 2015 12:53 pm

Each time you change the color of a cell, you check each cell to see if the neighbour cells have the same colors or not.
If ever along the whole check you do not find the same color again, then you can assume that all cells have different colors.
You do not have the required permissions to view the files attached to this post.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
293
S
117
G
96
Posts: 7,310
Reputation: 71,069

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests