Posted By: Stansmedia
Retina Burn/Flash Bang - 02/11/06 18:37
Code:
Put this at the top of your code, and when you want the magic to happen, just call the function:
Code:
in your code. Make sure you dont have it in a loop, and you create the images i mentioned in comments.
The bigger the screen size, the longer it takes to capture the screen.. Theirs a small delay for me on 640x480 and 800x600 but after that it gets pretty laggy.
// A white pcx, probably 1280x960 so its big enough for any screensize
bmap white_flash = <white.pcx>;
bmap screen_shot_map = <emptypanel.pcx>;// A 640x480 empty PCX
bmap screen_shot_map2 = <emptypanel2.pcx>;// A 800x600 empty PCX
bmap screen_shot_map3 = <emptypanel3.pcx>;// A 1024x768 empty PCX
bmap screen_shot_map4 = <emptypanel4.pcx>;// A 1280x960 empty PCX
panel respawn_flash
{
bmap = white_flash; // compass_map as panel background
pos_X = 0; pos_y = 0;
layer = 4; // we want the flash in front of the burn image
flags = VISIBLE,TRANSPARENT;
}
// copies the screen into a bitmap
function grab_screen() {
if(video_mode == 6) // 640x480
{
bmap_for_screen (screen_shot_map, 1, 0);
}
if(video_mode == 7) // 800x600
{
bmap_for_screen (screen_shot_map2, 1, 0);
}
if(video_mode == 8) // 1024x768
{
bmap_for_screen (screen_shot_map3, 1, 0);
}
if(video_mode == 9) // 1280x960
{
bmap_for_screen (screen_shot_map4, 1, 0);
}
wait (1); // wait 1 frame until the bitmap can be saved
}
panel respawn_burn
{
bmap = screen_shot_map;
pos_X = 0; pos_y = 0;
layer = 3; // we want the burn behind the flash
flags = VISIBLE,TRANSPARENT;
}
function flash()
{
if(video_mode == 6) // 640x480
{
respawn_burn.bmap = screen_shot_map;
}
if(video_mode == 7) // 800x600
{
respawn_burn.bmap = screen_shot_map2;
}
if(video_mode == 8) // 1024x768
{
respawn_burn.bmap = screen_shot_map3;
}
if(video_mode == 9) // 1280x960
{
respawn_burn.bmap = screen_shot_map4;
}
respawn_burn.alpha = 100;
respawn_flash.alpha = 100;
}
starter respawn_panel_control
{
while(1)
{
if(respawn_burn.alpha > 0)
{
respawn_burn.alpha -= time*2;
}
if(respawn_flash.alpha > 0)
{
respawn_flash.alpha -= time*3;
}
wait(1);
}
}
Put this at the top of your code, and when you want the magic to happen, just call the function:
Code:
grab_screen();
flash();
in your code. Make sure you dont have it in a loop, and you create the images i mentioned in comments.
The bigger the screen size, the longer it takes to capture the screen.. Theirs a small delay for me on 640x480 and 800x600 but after that it gets pretty laggy.