Make 4 sprites have to be clicked in an order

Get help using Construct 2

Post » Mon Feb 17, 2014 1:33 am

Hi there.
I'm making a bomb defusal game. I have Red, Green, Blue and Yellow wires.
I've got it so that it gives you a randomly generated order to cut the wires in but I'm not sure how to program it so that if u don't cut them in the order that you've been told that it will fail/explode. My Values currently output as text "RGBY", "BYGR" etc I'm just trying to get BYGR to equal some vaulues that mean you must click Blue then yellow then Green then Red or else it will explode.

Cheers Guys/girls
B
2
Posts: 4
Reputation: 154

Post » Mon Feb 17, 2014 7:54 am

Can't you just check the string values?

Have a correct string, CString="R:G:B:Y", and each wire has some instance variable Var1 of either "R", "G", "B", or "Y".

Test Var1 against tokenat(CString, N, ":"), where N is the (N-1)th wire being cut so if he's cutting the 3rd wire, N is 2.

Haven't actually tested any of this but it seems like it should work.
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Tue Feb 18, 2014 11:48 pm

Hi there thank you so much for your help.
As this is my first game and first time using this engine. Could i trouble you to dumb it down a wee bit more if possible. At the moment i have:
Each wire has its Instance variable "R","G" etc

I have a global Value called "CString"

I Have the wires "on touch" become invisible (revealing the broken wire sprite beneath)

I have Set CString to choose ("R:G:B:Y","G:B:Y:R",... (All 24 combinations)

So CString becomes "R:G:B:Y" etc. How do i on touch of the wire compare if that wires Instance Variable is the next In the CString value? I dont seem to be able to "compare variable" as an event within the "on touch" condition.

Sorry to be a pain
cheers
B
2
Posts: 4
Reputation: 154

Post » Wed Feb 19, 2014 2:38 am

Have a variable called WireNum, set that to 0. When the player clicks on a wire, check this:

tokenat(CString, WireNum, ":") = WireVar (where WireVar is the wire "R", "G", etc)
Then add 1 to WireNum.
Remember to re-set WireNum to 0 when you start a new wire puzzle
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Thu Feb 20, 2014 9:08 am

Thanks I've got it working now :) thank you so much
B
2
Posts: 4
Reputation: 154


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests