Friday 1 May 2009

HPS: Progress

In the previous post about the the Health Particle Setting I mentioned that they were some performance issues when using pngs for each frame of animation in Flash. Testing with a sequence of PNGs prove to be a problem if I went with exporting all 200 pngs and sequencing them in order of the animation created in ParticlesIllusion 3 (This application allows for the particles effects to be exported in a sequence of PNG files with the option of alphering out the background). The animation would significantly slow down the animation in Flash, So after deciding not to use ParticlesIllusion, the only way to have a particle system work without having massive slowdowns is to generate it with code. I didn't see it at first but Flash's actionscript would be awesome in implementing a particles system with a low memory usage.

Flash is very efficient in generating a dynamic particle system that can easily be controlled and adaptable in the way I want it to act within the game's environment(particles that change from good to bad health), but I was worried that it would involve using particle physics equations in actionscript (I only know the basics of actionscript 2 and 3, I don't want to venture into more head aches than I already got with code). Luckily James, our games tutor was working on generating a snow particle system that was entirely done in actionscript. He was nice enough to let me experiemnt with the code to make it act the way I wanted it to.

So here how it works, the particles fall the same way as how rain or snow falls from the sky, which involves some sort of gravity and friction, but these forces are cheated to give the illusion of realistic rain/snow by making particles fall at different speeds and distances in Flash. The particles are also drifting across one side of the screen, representing a wind force on the particles. The last and most important thing the particles show is the player's health through a harminous sequence of colours that seemlessly change from green to red if the player takes damage. This is done by calling upon the player's current health, if the character takes a certain number of hits from enemies, the colour of the particles start to change after every 20 health points. If the player reaches zero health, the particles fade and the character dies.

Full/Medium Health Setting



Medium/Low Health Setting



Low Health Setting



The rotation of the particles also speed up everytime the health particle's colour change, where green is a very calm rotating speed and red is full chaotic spins. This adds stress towards the player, which makes them act more quickly and gives them the challenge of finding health to restore the particles setting.

No comments: