0

I'm building a shmup (bullet hell, shoot 'em up), and using bitmap data for all of the art. I store a vector of bitmapDatas with different colors and pull the color I need from the vector to color a square for a particle (bullets, hit particles, etc). Bullets are purple rgb(255, 0, 255), and what I would like to do is make a trail from each bullet that fades into another color. I was extremely interested when I saw this example, but unfortunately have no idea how they even began to program the smoke (trail) of these bullets.

http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/bulletml_applet_e.html

Right now my bullets have a speed and a direction that I can easily update, change direction/speed, etc midflight. And what I have been doing for a trail is just slowly fading out the bitmap of the bullets as time passes.

Not looking for code per say, just an overview of how to go about doing this if anyone can help.

Evan Ward
  • 1,371
  • 2
  • 11
  • 23

2 Answers2

1

A pretty simple way you can go about doing this is to draw the trailing bullet particles (or a copy of the bullet works too) onto an effects buffer bitmapData at the position of the bullet which will be applied to your final render every update. Then either reduce the opacity of that buffer each frame or apply a blurring filter or something to that effect, depending on how you want it to look as it fades.

MasterRoro
  • 203
  • 3
  • 13
  • I actually am doing this for fading, but what i would like to do is be able to set the trail color for specific bullets. Not sure if i'm going to need to create another vector for past locations and just draw over every point, or if there is a better way to do it. – Evan Ward Aug 05 '14 at 01:02
  • Have you considered applying a colorMatrixFilter to the bitmapData while it fades? You can gradually alter the color of the trail that way. – MasterRoro Aug 05 '14 at 01:07
  • I have not, have never really used matrices. I'll look into that. – Evan Ward Aug 05 '14 at 01:11
0

Well, I would look if i can use Memento pattern to "remember" bullet movement. Then some code to color bullet trail. Using this pattern would let You easily color trail "in time".

Graphitt
  • 11
  • 2