SOLVED breakthrough mobile version problem

Hello every one, these days I've been trying to replicate the breakthrough game from the tutorials but for mobile, the main problem that i encountered is that I don't know how to make the pad stay in the game area and dont dissapear, I'm trying to implement the gesture event: drag start, dragging and drag end. does any one knows how to make the pad stay in the area between 0 and the room_width?
 

kburkhart84

Firehammer Games
Its a matter of putting code in the step event so the pad's x variable doesn't go too far. Assuming the sprite for the paddle is 128 pixels wide, and the center of the paddle is the center of the sprite, the following code would do it in the step event.

Code:
x = clamp(x, 64, room_width-64);
You can change the values to fit your sprite. You can also add more of a buffer if you have walls in there so it bumps against the wall instead of the literal room border.
 
Its a matter of putting code in the step event so the pad's x variable doesn't go too far. Assuming the sprite for the paddle is 128 pixels wide, and the center of the paddle is the center of the sprite, the following code would do it in the step event.

Code:
x = clamp(x, 64, room_width-64);
You can change the values to fit your sprite. You can also add more of a buffer if you have walls in there so it bumps against the wall instead of the literal room border.
Thank you very much!! that's what i needed
 
Top