Smooth Flick?

Get help using Construct 2

Post » Mon Jul 21, 2014 2:20 pm

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

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.

flick.capx
You do not have the required permissions to view the files attached to this post.
B
25
S
6
G
3
Posts: 197
Reputation: 3,355

Post » Mon Jul 21, 2014 7:40 pm

Here I edited the capx & remove the bullet behaviour
You do not have the required permissions to view the files attached to this post.
ImageImage
B
105
S
46
G
23
Posts: 778
Reputation: 22,226

Post » Wed Jul 23, 2014 3:45 pm

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 :)
B
25
S
6
G
3
Posts: 197
Reputation: 3,355

Post » Wed Jul 23, 2014 8:01 pm

Great if it suit your need then.
Angle of motion.. hope it is simple to deal with, since I often using native object angle.
ImageImage
B
105
S
46
G
23
Posts: 778
Reputation: 22,226


Return to How do I....?

Who is online

Users browsing this forum: Bootfit and 10 guests