Page 1 of 1

Smooth Flick?

PostPosted: Mon Jul 21, 2014 2:20 pm
by TwinTails
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.


Re: Smooth Flick?

PostPosted: Mon Jul 21, 2014 7:40 pm
by alextro
Here I edited the capx & remove the bullet behaviour

Re: Smooth Flick?

PostPosted: Wed Jul 23, 2014 3:45 pm
by TwinTails
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:

Code: Select all
>ON touch start
>> Set StartPointX TO Touch.X
>> Set StartPointY TO Touch.Y

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

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 :)

Re: Smooth Flick?

PostPosted: Wed Jul 23, 2014 8:01 pm
by alextro
Great if it suit your need then.
Angle of motion.. hope it is simple to deal with, since I often using native object angle.