Dragging actor into position on Tower Defense
Hi Guys,
Looking for some expert advice! I'm trying to set it up so I touch an icon (actor) which then spawns another actor on top of it, let's say a gun which can then be moved into position on the screen. I've setup the icon to spawn the gun when clicked and for the gun I have a rule that has a self attribute "FirstSelected" which is boolean and default to True. I then have it that if FirstSelected is true and touch is pressed then set the gun to the mouse coordinates. When touch is released then turn FirstSelected to false (so it drops the gun into position).
However, this works perfectly every time but the first time. The first time I touch the icon the gun spawns over the icon but doesn't move with the mouse/my finger. Any idea why this is and how I get it to work the first time as well?
Many thanks in advance for any help or advise!
Looking for some expert advice! I'm trying to set it up so I touch an icon (actor) which then spawns another actor on top of it, let's say a gun which can then be moved into position on the screen. I've setup the icon to spawn the gun when clicked and for the gun I have a rule that has a self attribute "FirstSelected" which is boolean and default to True. I then have it that if FirstSelected is true and touch is pressed then set the gun to the mouse coordinates. When touch is released then turn FirstSelected to false (so it drops the gun into position).
However, this works perfectly every time but the first time. The first time I touch the icon the gun spawns over the icon but doesn't move with the mouse/my finger. Any idea why this is and how I get it to work the first time as well?
Many thanks in advance for any help or advise!
Comments
My recommendation would be to allow the player to click the gun icon and then release the mouse before clicking again to move the gun actor. You'd need a boolean on the gun icon actor so that it only spawns a new gun when the existing gun has been placed in position (after being moved away from the icon).
If you still can't get it to work, post a screenshot of your rules and we'll see where we can go from there.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I think your original comment is right though, it's not recognizing the first touch as it didn't exist at the time. Do you have a way to get around that by any chance?
Cheers!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
If I can get a demo working, I'll post it here.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User