We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

a little logic hint / help needed

Home Forums General Questions a little logic hint / help needed

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #82766
    visualizer
    Customer

    Hi
    here is a simple scene made with 4 cubes..
    how do I set up a condition that, user must click cubes in sequence only.
    Initially 1st then 2nd then 3rd & then 4th
    if user clicks 2, 3 & 4 before clicking 1st then it should pop up an error message
    Then second time user needs to click 2nd cube & if 1, 3 & 4 are clicked then it should pop up the error message
    same with 3rd & 4th.
    how to setup a logic?

    • This topic was modified 1 month, 3 weeks ago by visualizer.
    Attachments:
    #82769
    visualizer
    Customer

    I have set up a simple puzzles as seen here… for first box it plays well
    but the error sound doesn’t play in both the logic puzzles….
    whats wrong?

    If this stage gets resolved there is as second stage to set but I am wondering how to pass this stage?

    • This reply was modified 1 month, 3 weeks ago by visualizer.
    Attachments:
    #82785

    Hi,

    You might employ the following approach:

    1. Create a list of all 4 objects
    2. Create an index variable that will take the following values: 0, 1, 2, 3 (from object 1 to 4)
    3. Upon clicking on the object, find it in the list (returns position)
    4. Compare position with index. index = postion is OK, index ≠ position is an error
    5. Increase index if no error happened on the previous step
    6. If the index > 3, set it back to 0 (to repeat the clicking cycle)

    Hope this helps!

    Soft8Soft Tech Chief
    X | FB | LinkedIn

    #82828
    visualizer
    Customer

    oh ok
    Do we have any example in our asset store on this?

    #82833

    We don’t, but the logic can be implemented quite easily. If you’ll have difficulties just output the content of the variables to the browser console with the print to console puzzle.

    Soft8Soft Tech Chief
    X | FB | LinkedIn

    #82858
    kdv
    Participant

    smth like this will do the job

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #82871
    visualizer
    Customer

    smth like this will do the job

    Oh
    will try to make this puzzle setup and understand it. for me its a kind of a homework…:)) learning for me.
    Thx kdv /|\

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.