Whats the best way to code "swipe across to delete"
hello all.
Ok i have two points some distance apart connected by an actor that joins the two together - think dot to dot. the connecting actor is stretched between the two 'dots'
I want to be able to swipe across the connecting line to delete it - i guess a bit like the cut the rope game would do when cutting the ropes. But i cant work out the best way to do this.
At the moment i am thinking something like
detect when screen is touched - flip a booleon to touched when the line is touched - then when the line is no longer touched delete - however this would let the player delete the line by dragging to it then away... not ideal.
I then thought about calculating perpendicular swipes to things but again did not feel simple and neat so turn to you guys.
I couldnt work out a way to simply use difference between XY coord as the connecting lines can be any direction in game.
Has anyone got any pointers of a simple way to do this please. I am not in need of the code describing... simply a principle of how it could work - any ideas much appreciated.
Ok i have two points some distance apart connected by an actor that joins the two together - think dot to dot. the connecting actor is stretched between the two 'dots'
I want to be able to swipe across the connecting line to delete it - i guess a bit like the cut the rope game would do when cutting the ropes. But i cant work out the best way to do this.
At the moment i am thinking something like
detect when screen is touched - flip a booleon to touched when the line is touched - then when the line is no longer touched delete - however this would let the player delete the line by dragging to it then away... not ideal.
I then thought about calculating perpendicular swipes to things but again did not feel simple and neat so turn to you guys.
I couldnt work out a way to simply use difference between XY coord as the connecting lines can be any direction in game.
Has anyone got any pointers of a simple way to do this please. I am not in need of the code describing... simply a principle of how it could work - any ideas much appreciated.
Comments
Hope this works.
It does give me another idea though.... simply record the touch and release points and spawn/move a 'delete' actor in between them... if the delete actor overlaps a connecting actor remove the connection?
Still does not feel right though and could be open to abuse - deleting multi lines at once... which may not be a bad thing. might be a good place to start the code i guess - thanks for the suggestion... it has helped move things forward!! But i dont think i am there yet!