How do I Swipe over an object and move it

0 favourites
  • 6 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hello all,

    like a bat with a ball. I tried the "hold gesture over" and the other gesture control but noone of this work.

    Many thanks

  • you can move the bat by calculating distance of mouse :

    a good example is my pool game, basically does the same thing, the code in it, its from the construct 2 template, the angry birds example, you just need to adapt the code from the elastic thing to your needs, basically you need 2 numbers to save X and Y of the touch or mouse,

    but for your bat you need to rotate so you just need the mouse x y or touch x y and 1 original position of the bat

    and then make the bat object move left or right or rotate by using the position of mouse pressed , so the code will be like this lets say for example that you know the original state position of the bat where you want it to be so lets call that OriginBatAngle and we will use a boolean if you want to make it trigger safer so it wont make buggy moves when you random click screen, so lets call the boolean Swing

    then the code will look like this

    On start of layout

    set OriginBatangle to Batobj.angle

    On touch on object bat

    Trigger once

    set boolean Swing True

    Is boolean Swing

    Rotate 2 Degrees towards position touch.x touch.y

    On touch released

    trigger once

    set boolean swing false

    Is boolean Swing (x inverted)

    rotate 2 degrees towards angle OriginBatangle

    and that should do it! il make you a quick capx if you want! reply here!

  • How can you calculate the collision from the bat and the ball ?

    I am making a game where a bear try to catch fish. The player swipe on the mobile and if the bear arms touch the fish, this one fly in che chest.

    I need something for the collision.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • the colision system is already there, you can set a condition on the fish, that says,

    ( arm or bat) if you have it pinned, if not i guess the bear animation has a box boundry autodetected, and the fish will automatically detect it when it hits it on the first edge of that.

    On collison with object bear

    then you trigger your events for flyng fish in chest!

    i can do a capx for you but you have to wait a moment!

    here is a capx from meDOWNLOAD

    and here are some demos that might help you (lost and found on internet)

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