Comparing array indexes with the animation frame

Get help using Construct 2

Post » Mon Dec 05, 2016 6:52 pm

blackhornet wrote:Again, you need to post what you have. A function should make no difference.


Ok. Here it goes.

https://www.dropbox.com/s/5xshuvuyp6q6ngw/test.capx?dl=0


The checking system is not working and it's also not recognising the number 10.
B
4
S
2
Posts: 133
Reputation: 868

Post » Mon Dec 05, 2016 10:04 pm

You can't use Trigger once that way. What is "check" supposed to do? I know you are comparing the array to the frame, but what are you looking for - use a specific example please.
ImageImageImage
B
71
S
22
G
247
Posts: 3,753
Reputation: 137,552

Post » Mon Dec 05, 2016 10:19 pm

Sorry, I thought it was clear. Check if the sequence is right. If each frame is right it will add 1 to the "hit" if the player got 3 hits, something happens.
B
4
S
2
Posts: 133
Reputation: 868

Post » Mon Dec 05, 2016 10:50 pm

Please be specific. Right now the code looks to see if any number in the array matches, which makes no sense. That's why you need to be specific. Do they need to match from index 0,1,2, or match the sequence anywhere in the array? Very different code.
ImageImageImage
B
71
S
22
G
247
Posts: 3,753
Reputation: 137,552

Post » Mon Dec 05, 2016 11:01 pm

blackhornet wrote:Please be specific. Right now the code looks to see if any number in the array matches, which makes no sense. That's why you need to be specific. Do they need to match from index 0,1,2, or match the sequence anywhere in the array? Very different code.


Always the sequence of the array (Index 0,1,2,3,4,...).

On the left of the screen you can generate the random numbers and when you click in "show" the game show you the sequence (the first three numbers of the array). I will use 3 number at the beginning and I will increase this amount during the game.
B
4
S
2
Posts: 133
Reputation: 868

Post » Tue Dec 06, 2016 12:29 am

ImageImageImage
B
71
S
22
G
247
Posts: 3,753
Reputation: 137,552

Post » Tue Dec 06, 2016 9:21 am

Thanks. I saw that you exchange all the sprites for one and use instances of it with an id (nID). I have used several sprites because I need to check another order besides the crescent. Can I also check the reverse order using the same solution?

Why I cannot make the comparison in this way:

Array2 value at 0 = Sprite1.AnimationFrame
Array2 value at 1 = Sprite2.AnimationFrame
Array2 value at 2 = Sprite3.AnimationFrame
B
4
S
2
Posts: 133
Reputation: 868

Post » Tue Dec 06, 2016 3:57 pm

No problem. I got it.
B
4
S
2
Posts: 133
Reputation: 868

Previous

Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 8 guests