Whats the best way to code "swipe across to delete"

EwokPDEwokPD Member, PRO Posts: 35
edited August 2012 in Working with GS (Mac)
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.

Comments

  • GrapeSodaGamesGrapeSodaGames Member Posts: 93
    How about having an actor on both sides on the line. When the left side actor is touch turn a booleon to true, and when the right side actor is touch, change to true. And when both booleons are true, destroy the line actor.

    Hope this works.
  • EwokPDEwokPD Member, PRO Posts: 35
    Could work in principle but would get messy - there currently can be 5 connecting lines on screen in any level - and the connecting lines can be very different lengths - the ghost actors either side i guess could be the same length. but at what distance are they away from the connecting line... the player would not be able to see them so they would have to be fairly close, or it runs the risk of the swipe not quite working if it didn't connect with one of the ghost actors

    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!
  • GrapeSodaGamesGrapeSodaGames Member Posts: 93
    You are welcome. If I come up with another idea I will let you know.
Sign In or Register to comment.