How to make bullet follow the line just drew

Get help using Construct 2

Post » Sun Jun 24, 2012 3:04 am

Yes, please help me about how to make the bullet follow the line ?

Hold down left button mouse and move the mouse to draw a line, when finished, the bullet will follow the line, but i don't know how to do it, someones help me.

Here the capx:
bullet_follow_linefarsmile902012-06-24 03:09:50
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » Sun Jun 24, 2012 4:18 am

Hmm, it could do with some finess, but here's a capx

Download

I made a few quick changes, some instance variables etc.

It marks the first dash and spawns the rocket there, it also deletes previous dashes once the rocket has exploded.

I think there's still a bug with lerping angles, as lerping the angle to make smoother curves causes it to spin wildly as it only works in a positive direction it seems.JohnnySix2012-06-24 04:20:29
Image
B
27
S
9
G
5
Posts: 487
Reputation: 11,939

Post » Sun Jun 24, 2012 7:36 am

@JohnnySix ,@farsmile90 , if you see the capx i can drew a line and when i stop click with the mouse and move my mouse another place and click it will create the line, i remember when i post about this creating line and i really didn't like the idea because of this lol i think the link should be created on array it will be easier :)

about my capx here is it maybe you wanna use it
https://dl.dropbox.com/u/67034121/scirra%20construct2/line%20games.capx
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Sun Jun 24, 2012 11:10 am

Thank you @johnnySix and @zsangerous, i'll see what i can do with your great help. When i finshed , i'll post the capx in here, sry for bad Eng.
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » Sun Jun 24, 2012 11:31 am

good luck XD i wish you can fix it :)
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Sun Jun 24, 2012 7:04 pm

wow, it's hard to make a bullet travel smooth with high speed :( any idea people ?
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » Sun Jun 24, 2012 10:34 pm

You could test for the difference between angles of the line and the rocket being positive or negative, then have a sub event that interpolates in a positive or negative fashion.

I did try smoothing it with LERP(Dash.Angle,Rocket.Bullet.AngleOfMotion,5)

but lerp will only turn clockwise, so you'd need to filter into two sub events and test if the difference is positive or negative I think.

That would smooth out the turning. :)
Image
B
27
S
9
G
5
Posts: 487
Reputation: 11,939

Post » Sun Jun 24, 2012 11:05 pm

Here is a way to make the rocket follow the path:
http://dl.dropbox.com/u/5426011/examples12/dashed_line2.capx

The dashes have a variable to indicate which rocket uses it so each rocket will follow it's own path.
B
79
S
24
G
55
Posts: 4,755
Reputation: 41,273

Post » Mon Jun 25, 2012 4:39 am

Omg, Thank again @JohnnySix and great thank to @R0J0hound for your awesome help here. Work perfect.

If i done somethings with it in my game i will thank for you in credit.

sry for bad Eng .farsmile902012-06-25 04:43:34
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » Wed Sep 19, 2012 1:17 pm

@R0J0hound I get a lot of problems with your capx, the line you draw seems to create additional segments coming off it so the rocket shoots along the line then keeps going off then back to the main line, know what i mean?
B
11
S
2
G
3
Posts: 95
Reputation: 3,028

Next

Return to How do I....?

Who is online

Users browsing this forum: Zebbi and 20 guests