0

Variable Conditions

168 0 2
Posted   one month ago

Hi Community, I need some help creating a variable condition,

 

 
I have created a drag and drop game, 

2 x drop targets (Asset or Not an Asset) that when a draggable is drop on, fires a boolean variable.
 
14 draggable objects, when dropped on either drop target, show a text box. The draggable objects have mixed correct answers, some Assets and some Not Assets. 
 
The boolean determines which text appears when the draggable is dropped. 
 
I want a variable that adds up a correct score. 
 
 
So, eg
 
When a draggable object is dropped on the correct drop target, add 1 to a new variable if boolean is true
 
AND 
 
When a draggable object is dropped on the correct drop target, add 1 to a new variable if boolean is false
 
Draggable A is an Asset. When dropped on the Asset Drop Target, the score goes up 1, if dragged onto the Not an Asset drop target, the score goes up 0.
Draggable B is Not an Asset. When dropped on the Asset drop target, the score goes up 0, if dragged onto the Not an Asset, the score goes up 1. 
 
Something like:
ASSETSCORE + 1 if ASSETBOOLEAN = TRUEorFALSE
 
 
Hope this makes sense. 

Comments

( 0 )

Answers  ( 2 )

1
avatar Chris Van Wingerden   |    
Posted   one month ago

Unless I'm misunderstanding something, I don't think you need to evaluate the Boolean variables at all?

An alternate way would be to add an additional variable action to these Drops.

The second action would set a numeric variable to increase +1 in the correct cases.

So the Drop trigger would fire two actions, one action to set the respective boolean value PLUS a second action to set the Score variable to increase +1 (instead of == chose += in the Operator drop down) if it's a "good" drop.

This approach means you don't have to evaluate the Boolean variables at all.

I did a simple test (just one text element dropping on a target) and was able to set both variables this way.

 

Comments

( 1 )
0
one month ago     Paul Schneider     637   |   8  

Agreed! That would be easier and should work!!!!

0
avatar Paul Schneider   |    
Posted   one month ago

Based on the description:

  1. Prior to exercise set a numeric variable for total score to 0.
  2. On the page where the boolean variables are being triggered add 2 actions
    1. an action on variable change (the variable changing being the boolean) that boolean is true then change the total score to be += and value of 1 (this adds 1 to whatever the value was)
    2. an action on variable change (the variable changing being the boolean) that boolean is false then change the total score to be -= and value of 1 (this takes away 1 from whatever the value was)

 

Comments

( 0 )