How do I move object with finger touch

  • Hi, everybody!

    I'm studing how to build games with Construct 2, and I want to learn how I can move an object with a finger tap (mobile game), like Air Hockey, but only with the ball and nothing else,

    I want to slide my finger in the screen, and when my finger hits the ball, it moves.

    I know this will involve physical, because the faster I move your finger, the higher the speed of the ball. And when she hit the corners it should do angular motion.

    I don't have any capx with this example, because I don't know how to beginning.

    Please, help me! Thank you.

  • Create an object that will be the circle to hit the puck. Call it "Finger_Point" Give it solid behavior.

    use the touch object like so:

    Is in touch> Finger_Point> Set Position to Touch.X, Touch.Y.

    Give the puck Bullet behavior and set it to bounce off objects.

    If you want different speeds by hitting it, you'll have to use the physics behavior instead.

  • Thank You, TheDom, I will try now.

  • Create an object that will be the circle to hit the puck. Call it "Finger_Point" Give it solid behavior.

    use the touch object like so:

    Is in touch> Finger_Point> Set Position to Touch.X, Touch.Y.

    Give the puck Bullet behavior and set it to bounce off objects.

    If you want different speeds by hitting it, you'll have to use the physics behavior instead.

    I used these settings as you said, and it worked. But I wanted a circle "invisible", ie just wanted the ball visible on the screen, without the disc.

    Another question, when I add the bullet behavior to the object it moves alone when I start the project. How do I make it stop?

  • set it's speed to 0

  • set it's speed to 0

    It was so obvious! duh Thanks again.

    and only let the ball without the disc, you know how to do?

  • you still need the disc object. Just set it to invisible.

  • Thanks, but It did not work as I would like

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Could you be more specific about how it didn't work as you would like?

  • Could you be more specific about how it didn't work as you would like?

    Sure, let me try to explain better....

    at that moment, all I want is to move a disc (buck), as in a game of air hockey, but without the disc that is in the hand of the match. He would be invisible in the case. I want to see only the buck on the screen.

    With the help of TheDom, I already managed to put the buck and the disk (which is still visible) already play it with the movement of my finger. But the buck is moving alone on the screen, and if I put the speed to 0 as suggested, the disc don't hit the buck.

    Forgive me for so dumb questions, but I'm learning to use the program, and I did not find examples of this in any tutorial or in the forum.

    I'll have more questions after that, but to start, if I could it already be the beginning of learning.

    Thanks

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