Smooth Flick?

  • I'm trying to make an object move in the direction of a swipe with the touch plugin and bullet behaviour.

    I don't want the flick to work while the object is moving and the object should move relative to the speed of the swipe/flick.

    This is what I've done:

    It worked great using compare distance travelled(bullet) but I can't reset it??

    Are there any other ways I could go about doing this? It doesn't have to use the bullet behaviour.

    [attachment=0:2lgz723b][/attachment:2lgz723b]

  • Here I edited the capx & remove the bullet behaviour

  • Thanks alextro!

    I took a look at your edits but felt they were a bit too rigid for my intentions. I also wanted to avoid using a decoy.

    So I made some tweaks and it turns out it was quite simple using Bullet and some global variables:

    >ON touch start 
    

    Set StartPointX TO Touch.X

    Set StartPointY TO Touch.Y

    N touch end

    Bullet speed = 0

    Set EndPointX TO Touch.X

    Set EndPointY TO Touch.Y

    Set angle_dev to angle(StartPointX,StartPointY,EndPointX,EndPointY)

    SPRITE Set Bullet speed to Touch.SpeedAt(0)

    SPRITE Set Bullet angle of motion to angle_dev degrees

    [/code:3vea4jmo]

    I was having this weird issue where it would only go left or right (-180 or 7 degrees) Turns out I had to set the angle of motion AFTER setting the Bullet speed

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Great if it suit your need then.

    Angle of motion.. hope it is simple to deal with, since I often using native object angle.

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