Help with creating a paddle control?

JegriffithJegriffith Member Posts: 9
edited January 2012 in Working with GS (Mac)
Anyone care to tell me how to create a behavior with GS on controlling a paddle going left/right?

Comments

  • AsymptoteellAsymptoteell Member Posts: 1,362
    edited January 2012
    If you mean where you can drag it left and right, make a rule in the paddle that says
    When Touch is pressed
    Constrain attribute self.position.x to mouse.position.x (you'll find it under "devices")

    If you want to make a more smooth grabbing, where the paddle won't jump to the mouse position, make a new self attribute for the paddle called offsetX
    Put in your touch is pressed rule "Change attribute self.offsetX to self.position.x-game.mouse.position.x. This will tell how far apart your touch is from the center of the paddle. Then change your constrain attribute behavior to say "mouse.position.x+self.offsetX"

    If any of that doesn't make sense, just say so and I'll try to clarify.
    Asymptoteell

    Edit: Oh! And in the future, don't make threads called "Help" or "Help me" or anything. Make sure the title says what you're asking about. Don't sweat too much over it this time, just be sure to make a better name next time; some people get really irked by nondescriptive titles, plus you'll get help sooner if people know what you're asking about from the title.
  • JegriffithJegriffith Member Posts: 9
    @Asymptoteell Yeah none of that makes sense haha I'm sorry..
  • AsymptoteellAsymptoteell Member Posts: 1,362
    Alright. for now, don't worry about the bottom part.

    Double click on your paddle actor to see its attributes on the left side (those are the color, size, placement etc.) and the rules and behaviors, (probably empty) in the box in the middle and on the right.

    Drag from the behaviors box (lower left) the behavior "Constrain Attribute"

    Click on the little box with the "..." on it next to the first box on the Constrain Attribute behavior.

    From the dropdown menu, select Paddle (or whatever your actor is called)>Position>X

    Next click on the lowercase e on the other side, next to the "To:" box. A dropdown will appear. Click the downward pointing arrow to bring up the dropdown menu from before.

    From the dropdown menu, pick Devices>Mouse>position>X

    Click the green check mark.

    Okay. Now click on the Constrain Attribute box, and click on the button "Add rule" at the upper right side.

    Keep it at its default setting of Touch is pressed.

    That should do it. If not, let me know.

    Asymptoteell
  • CloudsClouds Member Posts: 1,599
    edited January 2012
    UC
  • AsymptoteellAsymptoteell Member Posts: 1,362
    What?
  • CloudsClouds Member Posts: 1,599
    I removed my comment as I thought it was unhelpful (UC = unhelpful comment).
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Go to YouTube search for gamesalad cookbook you'll find a host of video to help you.
  • JegriffithJegriffith Member Posts: 9
    edited January 2012
    @Asymptoteell - Okay so now when I play my game and it'll be working with the touch screen? And also how do I make it so my segment stays still it always gets pushed downward with my ball
  • AsymptoteellAsymptoteell Member Posts: 1,362
    In your touch is pressed rule, put in "otherwise" constrain attribute self.linearmotion.x to 0. And another constrain attribute for self.linear motion.y to 0. That should do it.
Sign In or Register to comment.