How To Make An Actor Follow Your Touch?

FallingBoxStudiosFallingBoxStudios Freelance Graphic DesignerMember Posts: 822
edited October 2013 in Working with GS (Mac)
Hi, I mean like a ping pong paddle, where if you grab it, you can control it by moving it left or right,

Thanks, :) - Hunter

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited October 2013
    Put a rule on the paddle that says:

    When touch is pressed constrain the paddles X and Y location to your touch location.

    "touch location" is in the expression editor, Devices » Mouse » Position » X and Y.
  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822
    edited October 2013
    @jamie_c THANKS! It worked :D, but how do I put a speed control on it?
  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2013
    @jamie_c THANKS! It worked :D, but how do I put a speed control on it?
    Move your finger at the speed you need the paddle to move at ?
  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822
    @jamie_c also, how do I make it so that if an actor goes completely to one side of the screen, he appears on the other side (like doodle jump)
  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822
    edited October 2013
    @Socks Yeah, but it looks kinda crazy if you move the mouse really fast.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited October 2013
    Since it's constrained to your touch position, it just follows your touch, as Socks says.

    If you want it to wrap around the screen maybe you need a different play mechanic? Since it's constrained to touch, you'd need to drag it back to the other side...

    Doodle Jump uses the accelerometer, not touch so it's a different play mechanic.
  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822
    @jamie_c Oh, okay then, thanks.

    But I also tried to set up walls, by creating a "Collide With Actor - Walls" but the paddle actor went right through the walls :(.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited October 2013
    Yes, that is because it's Constrained to your touch position, that overrides collisions. I think I've seen here in the forum a way to deal with that but honestly I'm not sure what it was. Maybe someone else remembers?
  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822
    edited October 2013
    @jamie_c Okay then, thanks for your help :)
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    You're welcome, hope it helped a little. :)
  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822
    edited October 2013
    I'm trying to follow this tutorial.

    mainly the part where he teaches you how to make the paddle have a limit of how far the paddle could go out of the screen, but the resolution is far too low, I can't read what he's typing into the expression editor :( can someone please help :-S
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Looks like it is:
    Constrain Attribute: self.Position.X To: min(max(game.Mouse Position.X,30),290)
  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822
    @RThurman Thanks! it worked perfectly :)
Sign In or Register to comment.