Touch-To-Move Behaviour Bug?
Hello to GS Community,
I have been trying to create a touch-to-move behaviour in my newest project but I have noticed a bug or I am messing up something in my coding.
Clicking on the white actor spawns 4 red actors on each direction. When you click on any of the red boxes the white box should move to its position, destroying the rest red boxes, thus making touch-to-move (similar to grid) movement.
However, I have noticed that first time of clicking on the white actor, the red boxes spawns and disappear in a blink of an eye, then on second attempt they spawn and work as they should.
I will be glad if anyone help me finding my mistake in the coding.
NOTE: I have made SELECTED attribute into Player actor because in the original file there are more than one white boxes.
You can download the project: Click Here to Download
Comments
Bump
NOTE: I have previously written another issue which occured to me in this post but I managed to fix it so I bump the thread.
Try putting the spawn behaviors inside of an after 0.1 seconds timer with Run to Completion checked. I think what's happening is that your attempt to change game.Destroy from 1 to 0 before the actors spawn is not working because of the way you set up your rules. The spawn actually occurs before the other rules complete their actions. You need a slight delay.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang
Thank you, it helped me.
Can you give me any clue how to unselect a box after clicking on it again? Also, if I have clicked one white box then without moving it to click another white box to unselect the first one and select the second one (to have only one selected box)?
Thank you