How to make bullet follow the line just drew Forum Home > Construct 2 General > How do I....? |
Post Reply
|
Page 12> |
| Author | |
Post Options
Quote Reply
Topic: How to make bullet follow the line just drewPosted: 24 Jun 2012 at 3:04am |
|
|
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_line Edited by farsmile90 - 24 Jun 2012 at 3:09am |
|
![]() |
|
Post Options
Quote Reply
Posted: 24 Jun 2012 at 4:18am |
|
|
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. Edited by JohnnySix - 24 Jun 2012 at 4:20am |
|
![]() |
|
Post Options
Quote Reply
Posted: 24 Jun 2012 at 7:36am |
|
|
@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 |
|
![]() |
|
Post Options
Quote Reply
Posted: 24 Jun 2012 at 11:10am |
|
|
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.
|
|
![]() |
|
Post Options
Quote Reply
Posted: 24 Jun 2012 at 11:31am |
|
|
good luck XD i wish you can fix it :)
|
|
![]() |
|
Post Options
Quote Reply
Posted: 24 Jun 2012 at 7:04pm |
|
|
wow, it's hard to make a bullet travel smooth with high speed :( any idea people ?
|
|
![]() |
|
Post Options
Quote Reply
Posted: 24 Jun 2012 at 10:34pm |
|
|
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. :) |
|
![]() |
|
Post Options
Quote Reply
Posted: 24 Jun 2012 at 11:05pm |
|
|
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. |
|
![]() |
|
Post Options
Quote Reply
Posted: 25 Jun 2012 at 4:39am |
|
|
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 . Edited by farsmile90 - 25 Jun 2012 at 4:43am |
|
![]() |
|
Post Options
Quote Reply
Posted: 19 Sep 2012 at 1:17pm |
|
|
@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?
|
|
![]() |
|
Post Reply
|
Page 12> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |