0 Favourites

issue with variable check

  • I am using drag n drop on 6 items. Every time they are dropped in the correct place I add 1 to the global variable score.

    I have a text set to score for a visual feedback and it is working fine. The score reaches 6.

    When score = 6 I need a screen to slide in. However, though I think I have the correct code the slide does not move in.

    Set up: 6 labels - 6 boxes - six check marks - 6 red crosses. (feedback items show when element dropped).

    Code:

    system/compare variable score

    if score = 6 then move slide in (using LiteTeen) (LiteTeen is set to start from beginning)

    This does not work so I added another global variable finished = 0

    then I have if score = 6 then set finished to 1

    if score = 6 and finished = 1 then move slide in - set animation to frame 0 (good! image)

    if score < 6 and finished = 0 then move silde in - set animation to frame 1 (not so good! image)

    Does not work either.

    I tried to put the score variable on an every tick even too. still not joy!

    Any idea why this is not working?

  • Educated guess.

    Your score stays at 6. Now the 'event that moves' keeps starting the move from the beginning every tick. Tick, tick, tick tick ....

    Or.

    if score = 6

    ....set score to something different

    ....move slide in

    Or

    If score = 6

    Once While true

    ...move slide in

  • Does it work if you add the System object's Trigger once while true condition to your event?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thanks for your input. I will try these and let you know probably tomorrow.

  • 99Instances2Go - I used the following:

    if score = 6, set score to 7 
    if score = 7 slide in good [/code:2x9t1a0v]
    and it works.
    
    FYI, for the 'not so good slide' I added a new variable called 'done' and add 1 to it when any drop is done. At the end if check both score and done.
    [code:2x9t1a0v]if score < 6 and done = 6, then slide in 'not so good'.[/code:2x9t1a0v]
    
    [b]Thanks for your help.  I wish there was a way to mark your answer as correct.[/b]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)