Just started using Construct 2? Post your questions here

### » Wed Dec 24, 2014 11:08 pm

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.
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?
yeah, i really like to say that you should "Read this:"
B
16
S
8
Posts: 140
Reputation: 1,899

### » Thu Dec 25, 2014 11:35 pm

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
B
9
S
3
G
1
Posts: 128
Reputation: 1,116

### » Fri Dec 26, 2014 12:37 pm

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
yeah, i really like to say that you should "Read this:"
B
16
S
8
Posts: 140
Reputation: 1,899

### » Tue Dec 30, 2014 9:44 pm

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 )
Who dares wins
B
57
S
17
G
21
Posts: 1,880
Reputation: 19,623

### » Wed Dec 31, 2014 11:43 am

EyeForcz here is demo on touch
You do not have the required permissions to view the files attached to this post.
B
265
S
49
G
15
Posts: 2,023
Reputation: 42,716

### » Wed Dec 31, 2014 6:07 pm

thank you both too
I already got it but thanks for the tips next time i will have it easier now
yeah, i really like to say that you should "Read this:"
B
16
S
8
Posts: 140
Reputation: 1,899