Make 4 sprites have to be clicked in an order

0 favourites
  • 5 posts
From the Asset Store
Build your map with these isometric objects and terrains
  • 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 <img src="smileys/smiley1.gif" border="0" align="middle" />

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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


  • 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

  • Thanks I've got it working now thank you so much

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)