Follow touch with solids?

Just started using Construct 2? Post your questions here

Post » 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.
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?
Read this:
yeah, i really like to say that you should "Read this:"
B
14
S
7
Posts: 138
Reputation: 1,740

Post » 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

Post » 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 :)
Read this:
yeah, i really like to say that you should "Read this:"
B
14
S
7
Posts: 138
Reputation: 1,740

Post » 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,878
Reputation: 19,592

Post » 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
257
S
43
G
15
Posts: 1,992
Reputation: 41,535

Post » Wed Dec 31, 2014 6:07 pm

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


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests