PDA

View Full Version : Making fire trail out a movieclip


sam.uk.net
10-04-2009, 11:06 PM
Hi people...

My problem is that I have a little ship that you can control similar to the one in asteroids and need to have it check hit tests with asteroids and other objects.

I have some code I downloaded for a fire effect and I need the fire to trail out the tail of the space ship thats player controlled.

However making it come out at the right angle and positioning is hard because the rotation of the ship changes.

Here is a swf of my problem (http://sam.uk.net/colouroids.swf)

Use W,A,S,D to move.

How would I make it match up so its in the right place all the time?

Feel free to ask questions for more detail into the problem, I'll be checking this thread at least once a day.

Thanks!

sam.uk.net

scarce
10-05-2009, 01:52 AM
ok, first off which EVERYONE will ask you which is vital to be helpful...as2 or as3 you must specify this or alot of people wont give you the time of day.

ok, look on this forum under search and type in "detecting mouse angle", or "mouse angle" or "detect angle" now, with seeing code to detect the angle of the mouse. you want it behind the ship, so then you then, hmm, that would be opposite of the angle it's facing...180 degrees = -180 degrees (i.e) if your not using mouse angle, then it's easier.

Go into the search here and type in, angle of movieclip. etc...

it's easier to find an answer, then to wait for one, just know what you trying to do and break it down to basics...for instance...

a walking code...first, you need to know keypresses, THEN you need to know how to move him...it's easier to search in steps then to try to find something that will answer all your problems...

It really is alot more rewarding and giving a sense of accomplishment as apposed to, "hey, you accomplished this for me".

This is not a derogatory post in the least, just trying to help you spread your wings.

TomMalufe
10-05-2009, 06:24 PM
You can also use a displacement map with some perlin noise on that fire to give it some more life. Assuming this is AS3, which is what I'm going to do because that fire is easier to make in AS3.

You're control system isn't very nice. It seems to only notice 1 keypress at a time.
I wrote a simple tutorial on asteroid type controls some time ago... http://www.clickpopmedia.com/2008/06/25/easy-keyboard-controls-and-game-design/

As for getting the flame to work right? I think it might be best to draw it out as a trail behind the ship instead of a straight flame all the time.
You can learn about some easy fire effects here http://www.lostinactionscript.com/blog/ which is also where you can find Tweensy, a good tweening engine for this kind of thing.

Maybe also watch this http://gotoandlearn.com/play?id=63 which talks about some basics behind that fire effect.

sam.uk.net
10-05-2009, 07:36 PM
Hi!

Thanks for the quick reply. I'll be on flash later and I'll follow your tutorial - looks quite good and I like the final swf. I see what you mean about the movement in my game, its a bit odd.

As for what you said about the fire effect. I may not have understood you correctly but I thought you said to put the fire movieclip inside the spaceship...however this is not an option because it would make the hit area of the ship quite larger which would cause the hitTests to look in accurate.

Sorry please explain again if I haven't understood you correctly.My fault if I haven't.

Oh yeah and I am working in AS3 :) Thanks for the help!

sam.uk.neth

TomMalufe
10-05-2009, 07:51 PM
I'm not suggesting putting the fire inside the ship MC, what I'm thinking is that you draw the fire onto a large Bitmap and just apply a fadeing effect like in that video tutorial I gave you from GotoAndLearn. This will give it a nice trail behind the ship and you will just have to come up with a good way to make it look like thrust.

For the perlin noise fire effect, I make a very simple example here
Simple Perlin Noise Fire 2009-10-5 (http://wonderfl.net/code/f3550afe173353034f9834cbdb207beb8493fd8c)
I'm not saying you should do it exactly like this, as I just used some random values and I think it still needs tweeking, but it should give you the idea of what I mean.

TomMalufe
10-05-2009, 08:47 PM
Man... I need to get back to my work. I just wasted the last 20 minutes or something playing around with this fire code. This is what it looks like now -> Simple Perlin Noise Fire (applied) (http://wonderfl.net/code/47de60a7514a8f0784f44a270d256579cda5f898)

sam.uk.net
10-05-2009, 10:34 PM
Wow! That looks amazing. I'll check that out :)

Thanks!

sam.uk.net