How do I make touch controls for a breakout game

0 favourites
  • 7 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • Ok i don't wan't obviously the paddle to instantly move whenever i touch,how do i make it so that when i touch the paddle,and then hold finger on it and move it around,that way paddle moves..?

  • I've made a quick example for you to study how I've done it.

    I basicly did that when "on touch" your paddle will move in the direction of the area you are touching.

    If you're touching the screen on the left side of the paddle, the paddle moves in a certain speed to the left.

    If you're touching the screen on the right side of the paddle, the paddle moves in a certain speed to the right.

    Hope you can figure it out with the help of this capx:

  • That's not what i wan't...i wan't to move the paddle with my finger.

    Touch the paddle,slide the finger over the screen -> paddle moves where your finger is...that's what i wan't.

    And i can't open that capx because i have an earlier version.

  • Try drag and drop behavior

  • Try drag and drop behavior

    Ok that works but there is still one issue,on my PC it is normal,but when i run the preview on phone,the paddle is for some reason all the way to the left,when i drag it with my finger,it works,but,when i release,it goes back to all the way to the left...

    It should on start be on the middle,and simply move where i move my finger,but i don't know why it is doing this.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Maybe something like:

    Touch is touching sprite>set sprite.x to touch.x.

    happy constructing.

  • Maybe something like:

    Touch is touching sprite>set sprite.x to touch.x.

    happy constructing.

    Nope :/ That lets me move the paddle a little bit and then the paddle moves all the way to the left (Note that as i said before another problem is whenever i preview the game on PHONE,the paddle is all the way to the left,so,basically,after what you told me,i can move the paddle a little bit and then it comes back to where it was.

    I also need to fix that problem which puts the paddle all the way to the left (But that isn't going to be a too big problem as long as i fix the main problem,making it move properly.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)