0 favourites
  • 8 posts
  • I am trying to create a shuffleboard type game for both pc and mobile, I browsed the forum & tutorials, but seeing how I am a newbie I don't know exactly where to start to implement a swipe event/action.

    I would like to use mouse with click and of course touch and swipe on mobile but most examples already assume you have some knowledge of the two.

    Could anyone point me in the right direction?

    Thank you for any help.

  • Hi jeffige,

    The touch object is also set up to accept mouse inputs (so that should solve one problem).

    The touch object allows you to compare touch speed (go to add event, select the touch object and you should see the option). Also you can save the x,y co-ordinates on start of touch and compare these to the x,y co-ordinates on end of touch. So really you could use either of these to indicate whether the player is swiping or not.

    Hope that helps to get you started :)

  • Thanks Blacksmith for the reply.

    Since I don't know how to test it on my android phone yet, I am stuck with my pc. J got the puck to move with move toward mouse.x & mouse.y but it the puck moves off the layout. I have solid, bound by layout and physics behaviors for the puck.

    1st, should i start with a general template or with a mobile template since i would like it played on both?

    2nd, i need to add move at angle on start of touch & end of touch, correct?

    I have all the sprites which is only 4 cause i would like to add multi player option, but i wouldn't think something so easy as just sending a puck off could be so daunting. I have worked through multiple tut's and even read through the manual. But if you don't know what questions to ask, you can't ask them, like should i use bullet,physics or none, and should i use move at angle, toward position, or speed.

    Again, thanks Blacksmith for helping out a newbie.

  • To make it even more complicated for you, you could probably use all of your suggestions.

    The big question is:"What are you trying to achieve?"

    First of all if you want to be able to use it on touchscreen you better start with touch right away. Touch and mouse work differently, so if you have the mouse-part working it could go bust on touch-screen.

    on touch start add a variable for x and one for y and compare them to on touch end x and y. you can then get the angle(touchstart.x,touchstart.y,touchend.x,touchend.y) and send your puck in that direction with for instance the bullet behaviour...

  • Thanks for that LittleStain,

    The end result will be a puck centered at screen bottom. Player swipes a finger or left mouse click and push up on pc, to send the puck upwards to scoding area, which there are 3, just like on a table shuffleboard.

    The swipe/ mouse click should be a very small area as in shuffleboard. When player sends off another puck it should be able to bounce off other pucks. I was thinking i would need to use physics, but i haven't even got to the point of sending the puck off correctly yet.

    Thanks again for any help.

  • Here's a very simple example


  • Thanks LittleStain,

    Trying to recreate your events to work for mine, but 1st thing i see is the box shoots off the layout. I added wall boh daries in mine to see if that would help. Also, how could i get the box to slow down as in real worl? Would i use physics then adjust friction?

    Thank you, again.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I wouldn't use physics for a game like this, but you can if you want to..

    instead of giving the bullet a speed you would give the object an impulse in the direction.

    I've upgraded the example.. The bullet now bounces of solids and acceleration is set at a high number..

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