Problems with Touch/ 8-Dir/ 'Is Touching'

Get help using Construct 2

Post » Tue Jun 26, 2012 2:06 am

Hello!

I am working on a Breakout style game where there is a paddle at the bottom and some bricks at the top and bounded by walls on 4 sides. The ball is set with a bullet behavior. I had set the paddle and bricks as Solid and the paddle with 8-Direction behavior with Direction set to Left&Right. Everything works fine as expected with keyboard. The paddle does not pass into the left right walls since they are Solids too.

I am trying to code for touch -- I want the user to be able to grab and move the paddle left & right.
I have used the following code in the event sheet:
Touch -- Is touching Paddle -- Paddle Set X to Touch.X

I encounter the following issues:
1) I have turned on 'Use mouse input' for the Touch object. So when I click and drag the paddle, when the paddle object hits the wall, things go weird and paddle jumps up/down a bunch of pixels. What is the recommended behavior to get the 8-Direction Left & Right behavior with Touch?

2) When playing around with Windows 8 Release Preview on a touch machine, I noticed that the touch is not working as expected on IE or Chrome. I am not able to grab the Paddle at all on Chrome and on IE once I grab it and move the Touch.X and Touch.Y become 0. Apart from the method mentioned above, I tried "On touched" Paddle and that does not help either. As soon as I touch/grab the paddle and move my finger, the game thinks that I have already released the touch - which I have not.

Could you please help me what I could be doing wrong or are these known issues? I am on r95.

Thank you!
B
18
S
7
G
5
Posts: 71
Reputation: 4,991

Post » Tue Jun 26, 2012 2:12 am

is this what your looking for? (from prof.stemkoski)
http://www.youtube.com/watch?v=8dqH3pD2KGo&feature=plcp
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Tue Jun 26, 2012 4:32 am

That was a great tutorial. I had managed to do something close to what was described in the tutorial. But I am having trouble with making it work with Touch - as I have explained in the post above.

(Btw, great graphics in Wizard Life!)
B
18
S
7
G
5
Posts: 71
Reputation: 4,991

Post » Tue Jun 26, 2012 4:48 am

For issue 1 it sounds like the paddle is being pushed out of the wall objects (are both marked as solid?). To fix that you can force the paddle to instead try to move towards Touch.X by adding a horizontal speed to it depending if Touch.X is greater or lesser than Paddle.X.

No idea why issue 2 occurs though =/
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Tue Jun 26, 2012 2:39 pm

@Jayjay , i think this because the collision place isn't correct maybe it looks like this :


@iunkn , thanks ^^ , also to make it touch just change any event with mouse to touch and if you wanna test if touch work or not in touch plugin properties there is (make mouse work or something like this) make it yes. so you will have touch + mouse ...
B
48
S
15
G
6
Posts: 795
Reputation: 12,035


Return to How do I....?

Who is online

Users browsing this forum: SpartCrafter and 25 guests