Screen Flash
by Howard Dortch · in Torque Game Engine · 05/31/2004 (1:27 pm) · 5 replies
Well I finally got Lightning to work but it's missing something. Usually when lightning strikes in the real world you not only see the strike but a light flash as well. I noticed you can do flash in red for when the player gets hit so I assume that same mechanism can be used to make a white flash for lightning.
Now for the problem. Since the lightning is a random event seems run from a magic callback, how would I see if a lightning stike event occurred and where in the code would I parse for the event? Or is there some way to burry a function called flashScreen() when a lightning bolt happens?
Now for the problem. Since the lightning is a random event seems run from a magic callback, how would I see if a lightning stike event occurred and where in the code would I parse for the event? Or is there some way to burry a function called flashScreen() when a lightning bolt happens?
#2
06/02/2004 (5:00 am)
Problem is I dont know how to get notified that a bolt is currently being rendered. Optimization here says not to render if it's not in the view frustum but I should still get a flash and sound. So what mechanism is there to tell me that?
#3
If it is, then you can trap/trace it in game.cc :)
06/02/2004 (5:56 am)
@Howard, not too sure if this is useful, but there is a whiteout full-screen effect in game.cc (look for whiteout or something). I've yet to try trace where it is set, but it sounds like it may be your lightning flash.If it is, then you can trap/trace it in game.cc :)
#4
The engine is yours.. extend, extend, extend...
- Brett
06/02/2004 (7:01 am)
I would look at the lightning code and extend it, as necessary, to create the screen flash for you. Or you could have it call into (I think game.cc) and update the renderWorld (I think, again) method to render a screen flash in white.The engine is yours.. extend, extend, extend...
- Brett
#5
06/02/2004 (7:07 am)
The flash() part probably isn't the problem, it's more of WHEN does it flash and how do I know within the script. I looked at the code in the engine and dont see a way to hook a method like Lightning::onStrike(){doFlash();}
Torque Owner Stefan Lundmark