Follow touch with solids?

0 favourites
  • 6 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • i make a classic pong game for getting skills etc.

    Now i would like the pong sticks to follow my finger while im touching the screen.

    I simply made something like:

    set Pong Y to touch.Y

    But the problem is that my top,bottom and pong sticks are made of solids and when my finger goes to up or to down the pong sticks crashes into the wall and moves his X axis because of that too.

    How can i prevent that crash?

  • Make an invisible tilebg covering the playable area.

    Set as condition:

    if any touch and if touching invisible tilebg = then set pong.Y and pong.Y to touch.x and touch.Y

  • thats not really working good because when you move your fingers too fast than it wont go to the top right, but i already solved it by my one.

    I had to calculate the area for the pong moveing place and have set the touch.x/touch.y in a variable of the pong so that i first calculate if its in the area - if true then it moves.

    and for swiping to fast i controlled if the finger is on the top space or the bottom space and if thats true i set to max Top or max bottom.

    But thank you anyway Uniform a answer is better then none

  • something like:

    set bat.Y to clamp(touch.Y, ViewportBottom(0), ViewportTop(0))

    perhaps ?

    Assuming your borders are outside the layout.

    check the clamp() expression for limiting number usage. (which can be x or y )

  • EyeForcz here is demo on touch

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thank you both too

    I already got it but thanks for the tips next time i will have it easier now

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