0
Pas un bug

Set counter not working in v4

Gabrielle Strouse il y a 9 ans mis à jour par Alin Alexandru Matei il y a 9 ans 13
After a lot of struggling, I have been unable to get my app to work in v4, so I am rebuilding it from scratch. The working intersections I had in v3 do not seem to be working in v4.

I have an object, when drug to certain locations on the screen, an image should appear and the counter should be set.  The images appear as they should, but the counter value never changes.  I know the intersection of the two objects is ok, because it can trigger the image to appear, but the same intersection combination does not seem to be able to trigger the counter value to change.

Also, I think this page of my app must be having trouble because when I try to "interact" just for that page, it will not load in interactplayer.com.  I must "interact" the whole app from the beginning, and then I am able to preview that page.
À l'étude
Did you add a CounterDisplay behavior after the behavior that changes the counter value, in order to display the new value of the counter? Thank you for your feedback.
Here is a sample app for this situation:
Counter display example.zip
Let me know if you having questions regarding it.
Hi Alin. Thanks for the example.  When I use "counteradd" it works just like in your example. I don't want to add, however, just set it to the value.  When I use "counterset" instead of "counteradd" with everything else the same it does not appear to update.
Alin, update, actually I removed all of my intersections and added them again and it seems to be mostly working.  Randomly, sometimes it doesn't seem to trigger the counter, but for the most part it's now working.
It's pretty reliably unreliable--working about 85% of the time. The counter is displayed in the top right corner. The intersections are to set the counter to 1 if the lizard is on the green grass and 2 if on the brown grass. The counter resets outside of the grassy area.  Also, there are intersections to turn on the black box highlight when the lizard is on the grass and the counter is set to the right value (1 for green, 2 for brown)--this is my check to make sure the counter is updating once I turn off the display.

Here it's working correctly:




And now you can see it has stopped working correctly:


Do you have any suggestions for making this better?  I don't want the kids to be told they're wrong when indeed they are correct!
Hi Gabrielle,
I'm testing this type of activity to see if I can isolate what is causing the problem. For the intersection point, are you using "center?" Also, is the user able to continue moving the element after moving it to one of the areas, or is it meant to snap into place and become not movable?
CounterSet is working just fine. I've updated my previous sample app with CounterSet instead of CounterAdd:
Counter set example.zip
Alin, I agree your example is working.  Inna, I am using "center."  And yes, the user is able to continue moving the element around the screen.  The problem comes up after the lizard has been moved around a bit.  The first move sets the counter correctly.
Can you create that specific page on a one page sample app, archive it , upload it to Dropbox or any other share website and send it via email at alin@interactstudios.com and I will take a look at it. Thank you for your feedback.
Thanks Alin, it should be in your inbox.
Hi Alin, did you get my sample? Is it also inconsistently working for you?
Hi Gabrielle, yes I got your sample, and I found the issue.Let me explain what caused the inconsistently working in this case:
since you selected the Intersect point as Center, if the lizard is dragged right where the rock element and the grass element connects then half of the lizard will set the counter to 1 and the other half of the lizard will set the counter to 2. So basically it will cancel the behaviors. To fix this change the Intersect point as followed:
a) Make the Intersect point to Left when the lizard intersects with the grass ( so that the entire lizard to be on the grass side).
b) Make the Intersect point to Right when the lizard intersects with the rock (so that the entire lizard to be on the rock side).