Safe cracking with multiple variables?

0 favourites
  • 8 posts
From the Asset Store
Color Variable
$4.50 USD
10% off
Easily store, modify, read and manipulate colors with Color Variables!
  • Title says it all, I want to check the status of 3 different inputs, they all have to be true to continue.

    Tried to use an array with 3 boolean and toggle each variable when the right number has been set, change it to false when a different number is set. Now how do I go through the array to check if all 3 boolean are true? I can only see sorting and writing options.

    Do I need a fourth boolean that is set to false if any of the other 3 is false?

    Tried to just compare the variables but I can only compare 2. So far I had to write 3 functions to set the values for all 3 variables, havent figured out so far how to do this much easier and the examples I found in the forum are outdated or not available anymore.

    Thx in advance for help.

  • I guess a simple or block would do the trick:

    Variable 1 is not true

    or

    variable 2 is not true

    or

    variable 3 is not true

    • safe stays locked

    else

    • open safe
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What I am missing is that I can create an array with boolean elements and then I cant compare them or read them. Is the value TRUE equal to 1? I created 3 boolean instance variables in that array and I dont understand how I access them.

    And I think I need AND blocks not OR ones or I just dont see that else function yet.

  • I made an or block to check if one of the values is still not true.

    If one of the values is not true, the safe won't open, right?

    When all the values are true (the else statement) the safe will open.

    If you want to know if a value at a specific spot in an array is 1, you can use:

    Array compare at x,y = 1

  • Gosh this forum is a pain when you use Opera, either I dont have the rights for a quick reply, or the session got lost or even I get logged out once I focus on construct for 10 minutes.

    The point is that ELSE is red and has a "(not valid here)" when I put it close to the OR blocks, which makes sense. But how can I put it into a position that it is connected to this? Just to check this I made 3 buttons and the background turns green when all of them have been clicked (OR) but red (ELSE) when not each one has been clicked. Guess what, the background stays green all the time.

  • I created a Capx to show you what I mean:

    Here's the capx

  • Now this is really getting funny, I got the version from steam and it is built 158.2 as well when I try to download the free version it shows me a 158.2 version.

    Your version is 159, which makes it impossible for me to view it.

    I really appreciate your help, thank you, but I could do this more easily programming in java or alike, this software, this forum and this way to release software makes nothing easier for me.

    The session expired just after writing 6 lines before I could post this, unbelievable ..

  • Agreed, the forum with it's time-out is terribly irritating.

    I always use the latest beta, I think you can get beta-versions through steam too.

    Here's an image of the event sheet.

    I created three sprites with two frames (red and green)

    I created a green tiledbackground and set it to invisible.

    <img src="https://dl.dropboxusercontent.com/u/48563442/Open-Safe.png" border="0" />

    I think these events are pretty easy.

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