colour effects
BlitzPlus Forums/BlitzPlus Programming/colour effects
| ||
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 |
| ||
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. |
| ||
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. |
| ||
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. |
| ||
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). |
| ||
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 :) |