colour effects

Archives Forums/BlitzPlus Programming/colour effects

gingerprince(Posted 2003) [#1]
I`m wanting to use Fastpixelwrite/read to create a nice `laser` effect for a 2d game ( as in JETPAC or the arcade version of DEFENDER )
What i`m looking for is a way of calculating the fading/pulsing of colours to get a smooth transition from one colour to another over a fixed period of time.

eg.dark torquoise to light torquoise then fade back to black(transparent)
over ...say 1 second

Then use the same routine to do say... red to bright yellow then
back to black (transparent)

Hope this makes sense ...

Any ideas please

GP


WolRon(Posted 2003) [#2]
Don't know what you would need ReadPixelFast for? Just create a function in your loop that increments every frame to another slightly variant color. You can do this with either an algorithm to compute the values or read in the values with a data statement.


Ross C(Posted 2003) [#3]
i agree, readpixelfast is pretty slow. maybe for a couple of pixels it will be ok. there are quite a few examples of using readpixel fast and write pixel fast to produce transparency.


WoeIsMe(Posted 2003) [#4]
On a similar note, does anyone have any idea of how to create an effect of light from a small (flaming) torch in B2D? I've never quite managed to work this one out.


WolRon(Posted 2003) [#5]
does anyone have any idea of how to create an effect of light from a small (flaming) torch in B2D

Well, you would have to decide how you want to do it first.

If where the flame is, it's a static area of the game then you could just use an animation to display your flame.

If the area is dynamic then you would first have to use ReadPixelFast to acquire the image information from underneath where the flame would be and store it in a temporary array (or image). Then mathematically (add, multiply, whatever) alter the color of the pixels in the array according to the information in another array (or image, but array wouldn't require a ReadPixelFast) that contains a grayscale (or yellowscale, or whatever) image of your flame (as you can tell, I'm used to trying to cram as much information into one line (sentence) as possible).


Ross C(Posted 2003) [#6]
if it's only say 10 pixels or so, use readpixelfast and writepixel fast as Wolron says. But anything a bigger and you might see slowdown. ReadPixelFast is the big killer :)