Condition with order

Get help using Construct 2

Post » Mon Jan 26, 2015 5:21 pm

Hi everyone

i am new on construct 2, and what i want to do is simple, but i have no idea how to do it

here is an exemple of what i want to do, to see the full picture
you have to play a melody to solve the puzzle

Image

the melody order is : C+E+C+D

when the puzzle solved then a congratulation text appear

please help i really don't know what to do

here is the capx :
https://dl.dropboxusercontent.com/u/138507172/piano_puzzle.capx


thank you very much
Last edited by Hunter on Tue Jan 27, 2015 2:25 pm, edited 1 time in total.
B
4
S
1
Posts: 40
Reputation: 532

Post » Mon Jan 26, 2015 8:40 pm

I made three sprites into one, so they have same instance variable name.
You do not have the required permissions to view the files attached to this post.
ImageImage
B
111
S
51
G
24
Posts: 786
Reputation: 23,392

Post » Mon Jan 26, 2015 11:02 pm

Thank you alextro, but what i wana do is a little diferent
i want to have seperate images not all in one, so i can put a sound on mouse clicked and other things

thank you for your help
B
4
S
1
Posts: 40
Reputation: 532

Post » Tue Jan 27, 2015 3:03 am

If you have an acces to using family behaviour, you may use family instance variable and keep objects separated. Either It is more simple to handle different images within single object type. Put different sound or something else should not be a problem, since you can distinguish images via animation name & frame.
ImageImage
B
111
S
51
G
24
Posts: 786
Reputation: 23,392

Post » Tue Jan 27, 2015 8:28 am

alextro, i don't know how to use the family instance variable fo this case

what i can't do is add an & to a condition like this :

If

i do this
&
do this
&
do this

Then do this

maybe with a capx i undestand better ^^
B
4
S
1
Posts: 40
Reputation: 532

Post » Tue Jan 27, 2015 2:22 pm

Message: Hunter can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
here is an exemple of what i want to do, to see the full picture
you have to play a melody to solve the puzzle

Image

the melody order is : C+E+C+D

when the puzzle solved then a congratulation text appear

please help i rearly don't know what to do

here is the capx : https://dl.dropboxusercontent.com/u/138507172/piano_puzzle.capx
B
4
S
1
Posts: 40
Reputation: 532

Post » Tue Jan 27, 2015 2:29 pm

Sounds like you do something like:

Variable - pp (puzzleprogress)

C clicked
- If pp = 0 or 3
- if pp = 0 then pp = 1
- if pp = 3 then pp = 4
else
- pp = 0

E clicked
- If pp = 1 then pp = 2
else
- pp = 0

D clicked
- If pp = 3 then pp = 4
else
- pp = 0

If pp > 3 - CELEBRATE!

Something like that. There might be a more elegant way to solve this, but with a small puzzle like this, this approach should work.
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

Post » Tue Jan 27, 2015 2:53 pm

thank you for your quick comment Somebody

i tested with your code but nothings is happend, maybe i forget something

here is the capx with your events :
https://dl.dropboxusercontent.com/u/138507172/piano_puzzle_2.capx
B
4
S
1
Posts: 40
Reputation: 532

Post » Tue Jan 27, 2015 2:59 pm

Fixed it for you - pay attention to "ELSE" position - it is important and also do not group the conditionals, like pp = 0 together with pp = 2 as in this case it will never trigger when one of them has the right value.

Also, this is a good idea when doing something like this - run it in debug and watch the pp variable - how it changes after each click - that way you can see in which step something is wrong.

Enjoy.
You do not have the required permissions to view the files attached to this post.
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

Post » Tue Jan 27, 2015 3:25 pm

Ohhh thank you very much Somebody! it works you made my day :D

now i have to understand the mechanism of your code to use it in other things ;)

thanks everybody for your help

Edit : and thank you trultz i can't reply in the private message they told me i don't have enough reply i think
for the moment i don't have mic, please send me your fb or twitter
B
4
S
1
Posts: 40
Reputation: 532

Next

Return to How do I....?

Who is online

Users browsing this forum: blackhornet, Christmas and 3 guests