Hi all, I’m making a game where I have to spawn an object at the location of every touch exactly like this multitouch example. However, I need to limit the maximum number of touches. I tried the following but none of them worked properly:
Any ideas on how to do it? Thanks in advance!
hi. I don’t understand what are you doing in this screenshots. so my suggestion may not be helpful to you.
1, create a scene (or a global) variable at the beginning of the scene, which define the maximum number of touches. may be you should display its value in a text object as “moves left” indicator.
2, before create the object, check that the mentioned variable’s value is greater than 0.
3, every time when create an object, substract 1 to the variable.
thus when the player touch the screen after the variable’s value reaches 0, the condition give false output, so the object is not created.
Sorry that the screenshots were vague, but I did exactly what you said and it works flawlessly. Thank you so much!