Missile that leaves behind a crisp line where it flew

Forum Home Forum Home > Construct Classic > Construct Classic Discussion > Help & Support using Construct Classic
 Post Reply Post Reply Page  12>
Author
1,125 Rep
Post Options Post Options   Quote strike911 Quote  Post ReplyReply Direct Link To This Post Topic: Missile that leaves behind a crisp line where it flew
    Posted: 08 Dec 2009 at 11:00am
Okay, I've hit a road block... let me tell you what I'm trying to get. I have a missile object that flies towards enemies. It flies very fast (I've limited the bullet setting for speed for 2000, so yeah, that's the max speed). I want a bright trail to stay temporarily in the path that the missile flew. You know that kind of effect right?

I tried having an event Always set a particle object to the missile's (X,Y). I set up the particles object to just create a particle at no speed, no movement or anything, with no variation. More or less it was set just to spit out a uniform block at its emitting spot... which would theoretically make a line by the end. So I tried that but the missile was going so fast that the particles wouldn't emit fast enough to make a consistent line, even when I pumped up the particle rate to insane levels. There were a few skips and gaps in the line. It was --ALMOST-- what I was looking for, but the line drawn didn't have that solid, clean look that I was looking for. There were a few spaces and gaps in the line and the particle object in general seemed, well, more like particles than an actual curvy line (how about that, uk yuk!). It's not exactly the effect I'm looking for.

I'm willing to use particles if I can't figure out a different method... but ... *whines*

Is this possible to get this effect? Again, I'm looking for something that essentially that would draw a thin trail behind the missile that would disappear after a second or two, and I've tried a couple different things but couldn't get it to work right.

Something tells me that a particle object is the way to go, but I can't seem to get it to emit properly if it is.

Help me, oh gurus of Construct.
Back to Top

Scirra Developer
81,187 Rep
Post Options Post Options   Quote Ashley Quote  Post ReplyReply Direct Link To This Post Posted: 08 Dec 2009 at 11:46am
The particles object is probably actually not what you want - you want a customised system for drawing a line.

I think the best thing to do would be to manually spawn a sprite every tick, and resize and angle it so that it touches the start of the previous particle. Then, you should get a series of joining up lines which you can fade out with the fade behavior etc.
Back to Top
4,548 Rep
Post Options Post Options   Quote QuaziGNRLnose Quote  Post ReplyReply Direct Link To This Post Posted: 08 Dec 2009 at 2:12pm
adding to ash's suggestion

you need to store the missiles x,y position before it had moved using variables (just set one to missile.x, the other to missile .y, in an always event at the very bottom of the sheet) and create an sprite with a plain texture (just a colour fill) at that point, set the height to the desired "thickness" of your trail, and set the width to distance(trail.x,trail.y,missile.x,missile.y). then set the trails angle towards the point on the missile where the trails are spawned on (by default its the hotspot, but im assuming you want it on the back), do these events always

add to the always an event that sets the trails opacity to ".opacity-(speed of fadeout perframe)" and maybe some timedelta stuff but that shouldnt be hard to figure out if youre using timedelta already.
lastly create an event to check if the opacity of the trail is less or equal to 0, and add an action that destroys it in that event.

thats all ! ^_^
Back to Top

Moderator
10,796 Rep
Post Options Post Options   Quote deadeye Quote  Post ReplyReply Direct Link To This Post Posted: 08 Dec 2009 at 6:47pm
Are you looking for something like this?

viewtopic.php?f=16&t=5172

You can change the thickness and fade rate by messing with the numbers a little. Or use a different trail sprite to get a different effect entirely.
Back to Top
1,125 Rep
Post Options Post Options   Quote strike911 Quote  Post ReplyReply Direct Link To This Post Posted: 08 Dec 2009 at 10:07pm
Thanks so much guys. This thread was very very useful. I got the effect I wanted by using some of the techniques you guys mentioned. At first I thought I could just up and copy most of the events from DeadEye's cap. My laziness didn't pay off so well, it didn't work so smoothly, but it served as an excellent outline for how the basic set up should be. After about an hour or so of tweaking, everything is running perfectly!

Now i can have multiple heat seeking missiles chaotically flying towards different enemies on screen, all with crazy light trails everywhere and it actually looks exactly how I wanted it to! :D

thanks guys.
Back to Top
552 Rep
Post Options Post Options   Quote bizla Quote  Post ReplyReply Direct Link To This Post Posted: 10 Dec 2011 at 1:26pm
After about an hour or so of tweaking, everything is running perfectly!

Now i can have multiple heat seeking missiles chaotically flying towards different enemies on screen, all with crazy light trails everywhere and it actually looks exactly how I wanted it to! <!-- s:D -->:D<!-- s:D -->

thanks guys.[/QUOTE]
would you mind uploading the cap so i can have a quick look at how you done it as im a little stumped atm, and im wanting to do bassicly the same thing but with a trail of paint after my paintbrush sprite.
Back to Top
5,280 Rep
Post Options Post Options   Quote tulamide Quote  Post ReplyReply Direct Link To This Post Posted: 10 Dec 2011 at 2:28pm
@bizla you ask on a thread that is more than two years old. Also, the one you adress to was last active 1 year and 5 months ago, according to his profile.
Back to Top
552 Rep
Post Options Post Options   Quote bizla Quote  Post ReplyReply Direct Link To This Post Posted: 10 Dec 2011 at 2:55pm
ah good point :L i didnt notice the dates
Back to Top
252 Rep
Post Options Post Options   Quote TKO Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jan 2012 at 12:36am
Strike did you say you made an object seeking missle? I am looking to make bullets project towards an object that is moving at different locations.
Back to Top
2,221 Rep
Post Options Post Options   Quote zyblade Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jan 2012 at 12:31pm
Just what Tulamide said...
Strike911
Last Active
1 year and 6 months ago

I think he won't reply in the next time.

Edited by zyblade - 06 Jan 2012 at 12:31pm
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down