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

0 favourites
  • 5 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • 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!

  • is this what your looking for? (from prof.stemkoski)

  • 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!)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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 =/

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

    <img src="" border="0" />

    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 ...

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