How do I test multiple variations on a condition

0 favourites
  • 3 posts
From the Asset Store
9 Music Tracks (4 season variation) and 30 Sound Effects
  • Capx file

    https://drive.google.com/open?id=1D5JXr ... kComjTuXxB

    Hi, i hope you guys can help me.

    Ok, so i am trying to do a fairly basic game where a face is shown and you have the match the word for the emotion (happy , sad etc).

    It is fairly simple, the face are 1 sprite with each face on a different frame.

    The corresponding emotion words are in arrays where the X of the array matches the face animation frame.

    You click the play button and randomly spin the faces /words. This all works.

    My problem is with matching them up.

    I tried to create a draggable line between a face and word (or vs versa), but although it works in a browser it simply didn't on mobile. The line didn't appear as you dragged - maybe frame rate or something.

    Now i am trying to click first on one face and then 2nd on the corresponding word.

    The idea is you click on the face, it's background animates to show it is chosen, then you click on the corresponding word which also animates the background. Right now, i am simply writing "win" to a text box on screen to see it working or not.

    I am getting odd errors where the animations don't run or the "see if it is correct" function doesn't seem to be called.

    If you look at it in the debug, the values that are tested for win / lose are being stored but my logic is off somewhere. I know i am making too many things "true" but i can't see the problem.

    I would appreciate anyone taking a look as i have been staring at for a while and i can't see where it is wrong.

    Thanks,

    Jeremy

  • Your code is too complex..

    If you have the same emotions in the same frames in Faces and EmotionWords sprites, you can do something like this:

    variable clickedFace=-1
    variable clickedWord=-1
    
    On clicked Faces        -> Set clickedFace=Faces.animationFrame
                           -> Call Function "SeeIfCorrect"
    
    On clicked emotionWords -> Set clickedWord=emotionWords.animationFrame
                            -> Call Function "SeeIfCorrect"
    
    On Function "SeeIfCorrect"
       clickedFace not equal -1
       clickedWord not equal -1
    
            clickedFace=clickedWord  -> Set text to "Correct"
            
            Else                     -> Set clickedFace =-1
                                     -> Set clickedWord =-1
                                     -> Set text to "Incorrect"
    [/code:hc0lxzcr]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop2000

    Thank you very much, I knew i made it too complicated but could not see how to get out of it.

    Your solution works well and lets me delete lots of un-necessary code.

    Thanks again!

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