Controlling Background image with set color rgb
BlitzMax Forums/BlitzMax Beginners Area/Controlling Background image with set color rgb
| ||
Hi, I recently used the set color rgb command to make fireworks. It messes up the background images colors pretty bad. Without the rgb command I get snow instead of fireworks. Is there a way to get multicolored fireworks with out messing up the background images colors (graphics 1024,768) or using a blank screen only as the background? I refer to the sample fireworks program in the blitz max disk library. I would like to use one red/brown firework as an explosion for a bomb hit but I would need the background image to remain unaltered as well as have the hit be colored red/brown. What settings might allow this? Otherwise I will have a "snow" explosion. Gerald |
| ||
. |
| ||
Use setcolor rgb when drawing your fireworks, then do a setcolor 255,255,255 when you're done with the firework, before you draw your background again. |
| ||
You can use SetColor() anywhere in your code and as often as you want. So write... SetColor 255,255,255 DrawImage BackGround,0,0 ...before drawing the background and... SetColor 255,0,0 DrawImage Explosion,200,200 This will only change the colors of the following draw-command . |
| ||
This will only change the colors of the following draw-command . Better write: This will change tinting/color until next setColor(r,g,b) changes it to something else. Simplified: Like "SetAlpha" or "SetScale", "SetColor" changes things until it gets overwritten by itself again. bye Ron |
| ||
Hi, Thank you for the setcolor 255,255,255 command. It clears up the setcolor r,g,b problem for my background images, allowing use of a backbround with fireworks. How do you get control of the location of one to three firework explosions. I can't seem to set the x location. Where is the x# that the firework program uses defined? It does not seem to be defined/value set. Is it 0 by default? Gerald |
| ||
For numbers in BlitzMax "null" means "0" (good for Germans as "Null" is our word for "zero" :D) That also means that you have to pay attention to "if x = null" as it is the same as writing "if x = 0". FALSE and TRUE also operate as "0" and "1". You can even say 'If x then print "x is > 0"'. As soon as you progress in your BlitzMax/coding experience you will end up storing the data of firework-rockets as objects: Type TFireworkRocket field x:float,y:float field color:int field lifetime:int ... End Type local rocket:TFireworkRocket = new TFireworkRocket rocket.x = 1.2 ... bye Ron |
| ||
You can even say 'If x then print "x is > 0"'. Or even : 'If x then print "x is <> 0"' because negative x is also positive ;-) |
| ||
I wasn't sure without testing (had the <> in there at first). It is a bit pitty... else you could use "negative error codes" with simple checking "If not MyFunction() then ..." and if interested "result = MyFunction()". bye Ron |