How to progressively reveal an image (ala C&C)
BlitzMax Forums/BlitzMax Programming/How to progressively reveal an image (ala C&C)
| ||
never mind, please delete this post. |
| ||
Do you mean invisible to visible? You can use SetAlpha to set transparency. |
| ||
I'd like to resurrect this post because I'm doing something similar. I want to load my program, and upon the loading, slowly fade in a small title image in the middle of the screen that just has the name of the program and my name. In my code below, I'm referring to this as "titleTag". I guess my problem is that the SetAlpha is affecting everything, not just the one image (titleTag). Not only that, but nothing is fading in anyway, so I was wondering if people knew how to go about this.SetClsColor(159, 182, 205) 'Gray background For Local i:Int = 0 To 100 SetAlpha(i *.01) DrawImage(titleTag, 512, 384) Delay 10 SetAlpha(1) Next |
| ||
Here you go, you can extend a TFaderImage that draws an image instead of a rect too. |
| ||
I have come to the conclusion that you are a magician. Thank you so much! Something I notice about your code in comparison to mine is that when you want to accomplish something, almost always it involves complex types and very few lines of code in the game loop. I guess I am still trying to adjust to the object-oriented method of programming and thinking in terms of the most basic objects, what their most basic functions should be, and then adding to it. It's a bottom-up approach whereas I think of things top-down...I get a great idea, think about what makes it great, and then instantly try to implement it, usually using some sort of hack, but mostly procedural programming techniques. Your style is much more elegant and portable and I hope I can achieve that style eventually. -muffins |
| ||
muffins, You need to set blend mode to ALPHABLEND, for alpha to work properly. You also need to call "flip" to update the screen. Graphics 400,400 Global titleTag:TImage = LoadImage("superlogo.png") SetBlend ALPHABLEND ' <-- Without this alpha does not really work SetClsColor(159, 182, 205) 'Gray background For Local i:Int = 0 To 100 Cls SetAlpha(i *.01) DrawImage(titleTag, 100, 100) SetAlpha(1) DrawText("INTRO",100,100) Flip 0 ' <-- this updates the screen Delay 50 Next End |