Drawing with finger - how to avoid going through walls?
ancch
Member, PRO Posts: 103
I can move my actor around with my finger with the constrain attribute command (self.position = touches.x and y). I also programmed actor to collide with a wall.
The actor stops correctly at the wall if my finger movement is slow. But if my finger movement is fast ie I swipe the actor across the wall, the actor goes right through the wall.
How can I prevent the actor from being swiped past a wall?
The actor stops correctly at the wall if my finger movement is slow. But if my finger movement is fast ie I swipe the actor across the wall, the actor goes right through the wall.
How can I prevent the actor from being swiped past a wall?
Comments
I have a boolean called DragAndDrop (which you can see in a ton of samples here) and I set it to false on overlapping these boundaries but it doesn't seem to catch it if you swipe over it too quickly.
Some thoughts came to mind today though that I might try tonight:
1) All of my 'walls' are basically the borders of the screen to prevent actors from going out of bounds. I am going to try making them extremely wide/deep to see if that prevents them from passing through.
2) On overlap, see if I can force actor to go in the reverse direction of the swipe so it drops right outside my boundary. Again it could be when the collision is determined that causes me grief.
But try those and see what happens.
Good luck!
But it's been bother me quite a bit, kinda discouraging to continue my project!!
Making the walls thicker didn't work for me though...
(but maybe I didn't make them thick enough, I didn't go crazy on them)
Since it seems a problem for others as well I do feel more triggered to give it another go...
Let's see...
I'll try and give my ideas a go in the next day or so and if something works, I'll be sure to post it.