Hi everyone,
I'm trying to build an app for setting a dinner table.
I have a canvas and a set of images sprite representing utensils (fork, spoon, knife, plate and so on).
The images are sparse in the table, the user has to set the table by correctly placing the utensil in a drop table.
When the user picks and places an utensil in the table, and he drops upper the other ones, all the touched utensils drop. For avoiding that, I set the enabled field of no dragged utensil to false, and when the user touches up the dragged utensil, the enabled fields of the other ones return to true.
But it does not work!
When utensils collide, something crashes, and I do not know why! I attach a demo of the error.
In the demo, the spoon collides to the plate, and the app crashes (all remain blocked). WhatsApp Video 2021-02-22 at 21.48.43|video
The simple code is
To insure only one sprite gets dragged at a time, set aside a global variable to hold the current sprite component that is being dragged, and set it on sprite touchdown. In all dragged events, insure that only the sprite recorded in the global variable moves. Reset the global variable on touchUp.
You are a genius!
Now it works!!
Tks very much!
Can I ask you if there is a method for ordering the images? For example, for setting that the plate has to stay above the other utensils?
Thank you!
Have you some suggestions about the size of the picture in the imagesprite?
In the design view the size seems good, but when I simulate the app in my companion, the size changes and the utensils look bad.
Tks a lot!