Missile that leaves behind a crisp line where it flew

For questions about using Classic.

Post » Tue Dec 08, 2009 11:00 am

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.
B
5
G
4
Posts: 50
Reputation: 1,225

Post » Tue Dec 08, 2009 11:46 am

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,554

Post » Tue Dec 08, 2009 2:12 pm

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 ! ^_^
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Tue Dec 08, 2009 6:47 pm

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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue Dec 08, 2009 10:07 pm

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.
B
5
G
4
Posts: 50
Reputation: 1,225

Post » Sat Dec 10, 2011 1:26 pm

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.
B
5
G
1
Posts: 13
Reputation: 577

Post » Sat Dec 10, 2011 2:28 pm

@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.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Dec 10, 2011 2:55 pm

ah good point :L i didnt notice the dates
B
5
G
1
Posts: 13
Reputation: 577

Post » Fri Jan 06, 2012 12:36 am

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.
B
1
Posts: 1
Reputation: 277

Post » Fri Jan 06, 2012 12:31 pm

Just what Tulamide said...
Strike911
Last Active
1 year and 6 months ago

I think he won't reply in the next time.zyblade2012-01-06 12:31:37
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest