Encircle gesture challenge!

sparkzillasparkzilla Member Posts: 152
edited November -1 in Working with GS (Mac)
This one is for the experts!

How would you encircle an actor with a gesture? For example say the actor is a ball coming down from the top of the screen. I want to get points by drawing an invisible swiped circle around the actor.

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    That is a mechanic in games like Atari's Quantum and Loopz.

    How it works is when you draw the line, it makes a bunch of line segments. A function then loops through the line segments and sees if any of them cross. And if the object is within those bounds.

    ORBZ has a demo of drawing lines on his wall, that might be able to get you started.

    The math function you are looking for is determining if two line segments intersect. you'll need to google for it.

    However, without access to an array to store the line segments, and a way to loop through it, it will be extremely difficult to do this in GameSalad!
  • AsymptoteellAsymptoteell Member Posts: 1,362
    maybe you could do it by checking to see if the vector to angle of touch and the character's position goes full circle from 0 to 360°
  • sparkzillasparkzilla Member Posts: 152
    Great suggestion Asymptoteell. I made the vector to angle part already. Now I have to work on how to determine the 360degrees. Will keep you updated...
  • AsymptoteellAsymptoteell Member Posts: 1,362
    I'd suggest making it so each time it passes several points, 90, 180, 270, 360, change some attribute to itself +1 until it's 4.
  • sparkzillasparkzilla Member Posts: 152
    I thought I could try this:

    Determine initial vector to angle from ball to touch
    If initial angle - current angle = 360 or -360 then result

    But because the initial vector to angle is an angle-type attribute it won't allow negative numbers. so I think it will have to be something like this:

    Determine initial vector to angle from ball to touch
    Determine direction and amount of movement (clockwise or anti clockwise)
    When the maximum amount moved in either rotation = 360 then result

    Any other ideas most appreciated!
  • sparkzillasparkzilla Member Posts: 152
    I'm having some trouble determining the direction of rotation. I know it's supposed to be easy but I just can't get it...
  • MotherHooseMotherHoose Member Posts: 2,456
    sparkzilla said:
    I'm having some trouble determining the direction of rotation. I know it's supposed to be easy but I just can't get it...

    to me the direction of rotation...isn't important... if the angle is 359 or 360 it is a circle... you only have to have the user drawn line go in the correct direction...

    POM's Party Popper does touch detection of a circular motion ... now that we can message... leave him a request for help...

    MH
Sign In or Register to comment.