Recently, I had the sudden urge to try my hand at something that at least vaguely reflected real life - real physics. But what? What on earth could I program in Flash without too much hassle and that also followed the rules of physics and was, at the same time, fascinating to look at?
Now of course you already know the answer to that, you've seen the title to this post. I decided to create some fireworks! This would provide me with a challenge but wouldn't require masses of graphical work either.
As this is my first blog I should probably take a minute out to explain that I love challenges, especially programming challenges. Often I manage to solve some problem or other and then loose all interest in whatever I was doing merely because there's no challenge in it any more. I should also say that I'm a programmer at heart... Yeah, I can do graphics that look okay, but it takes me far longer than it should and I get less enjoyment from it.
Anyway, I expect you're tiring now - I can't help but write long blogs / comments, I like writing - so I'll get back to Fireworks.
I had to use the SUVAT equations as well as trigonometry and maths involving vectors to get the right effect. I also got a little confused when bouncing them off the sides of the stage. There's a little more information about the maths used on Fireworks page of my FriHost site, but not much. If anyone would like something more in depth about this I'm happy to make another blog; just don't ask me for any source code.
Did I manage to make something that reflected real life? Yes! I think I did. However, I cheated slightly by increasing the rate of time (I think by 50%, I can't remember). My reason for this being that the fireworks move in pixels per second and not meters per second and thus appear very slow in real time. So speeding them up actually means they reflect life more fully.
I'm not sure whether to make the explosion particles fade out as they fall - what do you think? Oh, and have you got any other suggestions?
Here's a link to Fireworks: http://ninjakannon.frih.net/?pageid=7!
Now of course you already know the answer to that, you've seen the title to this post. I decided to create some fireworks! This would provide me with a challenge but wouldn't require masses of graphical work either.
As this is my first blog I should probably take a minute out to explain that I love challenges, especially programming challenges. Often I manage to solve some problem or other and then loose all interest in whatever I was doing merely because there's no challenge in it any more. I should also say that I'm a programmer at heart... Yeah, I can do graphics that look okay, but it takes me far longer than it should and I get less enjoyment from it.
Anyway, I expect you're tiring now - I can't help but write long blogs / comments, I like writing - so I'll get back to Fireworks.
I had to use the SUVAT equations as well as trigonometry and maths involving vectors to get the right effect. I also got a little confused when bouncing them off the sides of the stage. There's a little more information about the maths used on Fireworks page of my FriHost site, but not much. If anyone would like something more in depth about this I'm happy to make another blog; just don't ask me for any source code.
Did I manage to make something that reflected real life? Yes! I think I did. However, I cheated slightly by increasing the rate of time (I think by 50%, I can't remember). My reason for this being that the fireworks move in pixels per second and not meters per second and thus appear very slow in real time. So speeding them up actually means they reflect life more fully.
I'm not sure whether to make the explosion particles fade out as they fall - what do you think? Oh, and have you got any other suggestions?
Here's a link to Fireworks: http://ninjakannon.frih.net/?pageid=7!