Missile that leaves behind a crisp line where it flew

This forum is currently in read-only mode.
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • 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.

  • 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.

  • 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 ! ^_^

  • Are you looking for something like this?

    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.

  • 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!

    thanks guys.

  • 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 --><img src="SMILIES_PATH/icon_biggrin.gif" border="0" alt=":D" title="Very Happy" /><!-- s:D -->

    thanks guys.

    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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • ah good point :L i didnt notice the dates

  • 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.

  • Just what Tulamide said...

    Strike911

    Last Active

    1 year and 6 months ago

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

  • beastly tutorial. I think i wanna use this for something.

  • If someone still needs an example .cap, my all-purpose tutorial/example game "Verve!" also shows how to do sprite-based trails.

    You can find it in the tutorial/example forum.

  • I haven't tried this out yet, in theory though it should work, for a homing missile, you could insert a sprite with bullet and 8 direction behavior and have it rotate towards the moving object you want it to target.

    con 1: on mouse clicked

    con 2: 'crosshair' overlapping enemy >

    action1: spawn 'homing missile' at 'launcher' (X,Y,)0

    action 2: rotate towards enemy

    let us know how you do ;)

  • answer to crisp line missile question:

    just make a small white box sprite with fade behavior, give it around 85% opacity and if your bullet sprite with bullet behavior is on screen spawn the white sprite with fade behaviour at the bullet's X,Y co-ord ;) it works beautifully.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)