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.
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.
@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
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.
Comments
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.
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
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS