Better effect when the player hit the ennemy

BlitzMax Forums/BlitzMax Beginners Area/Better effect when the player hit the ennemy

hub(Posted 2010) [#1]
Hi !
i'm searching a better and fast method to display an sprite effect when the player shoot hit the sprite ennemy ship (hImage) but not destroy it yet (shield).

i've this :
SetColor 0,255,0
SetAlpha 0.8
SetBlend LIGHTBLEND
DrawImage hImage, mx#, my#, frame
SetBlend (ALPHABLEND)
SetColor 255,255,255
SetAlpha 1.0
DrawImage hImage, mx#, my#, frame


is there a better method ? i can't reproduce old school effect when the sprite was completely white !


Kryzon(Posted 2010) [#2]
Bump. I'm interested in this too.

Is there a procedural way of making a sprite go full flat-colored without you actually having to clone every frame of every sprite and filling it with a flat color in an image editor?


ima747(Posted 2010) [#3]
This thread might be of some help.

http://www.blitzbasic.com/Community/posts.php?topic=91711


Kryzon(Posted 2010) [#4]
After reading that, I can think of making a blank image the same size as the sprite, then filling it with the color you want, then copying the original sprite frame's alpha channel.


ima747(Posted 2010) [#5]
I would personally use white rather than your final color then you can set the color before you draw the sprite, which would allow you to change colors on the fly for some other effects, like flash between red and yellow etc. Combine with blend mode changes and alpha etc. For more effect options all without any real overhead.


Kryzon(Posted 2010) [#6]
Well, if you have the alpha-channel copied alright, it all requires you to fill the entire image with the color you want. No need for blending (other than turning on Alpha Blending so just the 'shape' of the sprite is shown, not a flat-colored rectangle).


hub(Posted 2010) [#7]




How to adapt this code when you use several frames ?

hope DrawImage WhiteImageWithAlpha,PosX,PosY, Frame <----- this !

Last edited 2010


hub(Posted 2010) [#8]

YES !

Last edited 2010


Jesse(Posted 2010) [#9]
I like it like this.