Panel Fading Problems

Posted By: xbox

Panel Fading Problems - 06/23/08 01:06

Hi, i know this has been asked and solved a billion times before but i searched and can't find it and i just can't figure it out. How do you make a panel fade away. I have the "logolite.pcx" as my splash screen, then my title screen comes up which is a black background and letters. I have my black background (which by the way is i bmp) set as a panel with the alpha of 100. Here is my code.
Code:
 bmap startup_screen = <startup.bmp>;
panel start_screen
{
bmap = startup_screen;
alpha = 100;
flags = transparent, refresh;
}

function main()
{
...
...
start_screen.visible = on;
fade();
...
...
}

function fade()
{
while (start_screen.alpha > 0)
{
start_screen.alpha -= time;
wait(1);
}
} 


when my start up screen shows, "logolite.pcx" is still visible in the background due to the "transparent" flag, which i read in the manual, has to be set in order for this to work.

WTF am i doing wrong?
Posted By: xbox

Re: Panel Fading Problems - 06/23/08 01:08

Oh and it still DOESN'T FADE AWAY
Posted By: JazzDude

Re: Panel Fading Problems - 06/23/08 03:13

Code:
bmap screen_fade = <black_total.pcx>;	
panel fade_pan
{
	bmap = screen_fade;
	pos_x = 0;
	pos_y = 0;
	layer = 10;
	flags = refresh,d3d;
}

function fade_in()
{
	bmap_for_screen(screen_fade,1,0);
	fade_pan.bmap = screen_fade;
	//Now show the screenshot:
	fade_pan.alpha = 100;
	fade_pan.visible = on;
	wait(5);
	//Now fade the screenshot out:
	fade_pan.transparent = on;

	while(fade_pan.alpha > 0)
	{
		fade_pan.alpha -= 10*time_step;
		wait(1);
	}
	fade_pan.visible = off;
} 


Place this function before the panel you wish to fade into.
Posted By: Helghast

Re: Panel Fading Problems - 06/23/08 08:01

set it's alpha to 99 before you start fading, that should work.

regards,
Posted By: xbox

Re: Panel Fading Problems - 06/23/08 16:27

it still doesn't work
Posted By: xbox

Re: Panel Fading Problems - 06/23/08 22:21

Which would be better, if i tried even harder to get the panel fading to work, or if i used windows movie maker and made a short mpg clip of the bmap fading like i want it?
Posted By: Joozey

Re: Panel Fading Problems - 06/23/08 23:36

Try harder, definately.
Posted By: xbox

Re: Panel Fading Problems - 06/25/08 17:43

Yeah, i have tried every thing i could possibly think of and nothing is working.
i have even tried to set the panel its self to alpha 50 and run it without using the fading functions but there is still no change. This is what i tested.
Code:
 bmap startup = <startscreen.bmp>;
panel start_up
{
bmap = startup;
alpha = 50;
flags = transparent, refresh;
}

function main()
{
...
start_up.visible = ON;
} 


It acts like it completely ignores the alpha line and just displays what it wants to.
Posted By: xbox

Re: Panel Fading Problems - 06/25/08 17:44

Yeah, i have tried every thing i could possibly think of and nothing is working.
i have even tried to set the panel its self to alpha 50 and run it without using the fading functions but there is still no change. This is what i tested.
Code:
 bmap startup = <startscreen.bmp>;
panel start_up
{
bmap = startup;
alpha = 50;
flags = transparent, refresh;
}

function main()
{
...
start_up.visible = ON;
} 


It acts like it completely ignores the alpha line and just displays what it wants to.
Posted By: badapple

Re: Panel Fading Problems - 06/26/08 03:13

dont use alpha inside panel brackects

put it in function main maybe
start_up.alpha=50;
Posted By: Poison

Re: Panel Fading Problems - 06/26/08 11:08

btw, xbox why have you posted it twice?
Posted By: xbox

Re: Panel Fading Problems - 06/26/08 17:07

@Poison: Because my "Reply" and "Edit" button won't work. When i click Reply, it shows everything but the box to type the message. When i hit edit, it does the same thing. But when i posted my first response, i was using "Quick Reply" and forgot to unclick "Add Signature" so i clicked back on my browser which, took the post away then i unclicked the box and hit submit again and there were two posts.
Posted By: flits

Re: Panel Fading Problems - 06/26/08 20:43

i gues the background isnt refreshd so u need to load a lvl ore use vec_set(screen_color,vector(8,8,8));
Posted By: halfpint

Re: Panel Fading Problems - 06/27/08 06:17

I got this to work

Code:
var video_mode = 7;
var fade_speed = 10;

bmap background = "background.bmp";//back panel
bmap background1 = "background1.bmp";//above panel
bmap start_norm = "start_norm.bmp";
bmap start_roll = "start_roll.bmp";
bmap mouse = "mouse.bmp";//mouse picture

function main()
{
	wait (3);
	mouse_map = mouse;
	mouse_mode = 3;
	while(1)
	{
		mouse_pos.x = pointer.x;
		mouse_pos.y = pointer.y;
		wait(1);
	}
}

panel background_1//starting background picture
{
	bmap = background;
	layer = 1;
	button ( 300, 300, start_roll, start_norm, start_roll, fadein,NULL,NULL);
	flags = VISIBLE;
}

panel background_2
{
	bmap = background1;
	layer = 2;
	button ( 300, 200, start_roll, start_norm, start_roll, fadeout,NULL,NULL);
	alpha = 0;//starts at 0 alpha
	flags = TRANSLUCENT;//translucent allows the alpha to work
}

function fadein
{
	background_2.visible = ON;
	while ( background_2.alpha < 100)
	{
		background_2.alpha += 10*time;//if alpha is not at 100 increase it
		wait(1);
	}
}

function fadeout
{
	while ( background_2.alpha > 0)
	{
		background_2.alpha -= 10*time;//if alpha is not 0 decrease it
		wait(1);
	}
	background_2.visible = OFF;//make sure to turn off the top panel otherwise the
										//bottom panels button wont work
}


Hope this helps.
Posted By: xbox

Re: Panel Fading Problems - 06/27/08 16:39

OMG, it still doesn't work!!!!!!!!! WTF.

Since i can't make new forums, (because my browser is being retarded) i need to ask something else. Is it possible, and if so, How, to load different parts of a huge level at certain times with out taking certain parts away. I know if you make a script so when you hit a block it start up the next level and closes out of the level you are on, but i need it to load parts of the levels, preferibly wmb's and close out of others.

Thanks for all of the Help too.
Posted By: halfpint

Re: Panel Fading Problems - 06/27/08 21:50

how does it not work?
are you getting an error?
does the panel not show at all?
do the panels switch but dont fade?
just screaming OMG IT DOESNT WORK doesnt really help anyone who might be trying to help you.
Posted By: xbox

Re: Panel Fading Problems - 06/28/08 01:52

@halfpint: completley sorry for not specifying. I was in a rush and forgot to. But, with the script you gave me, the panels switch, but they dont fade. Don't know if it makes a difference or not but i am using A6 Pro. Like i said before, i have played with the alpha values before, but no matter what the value is set at, if the flag visible is set, it is 100% visible.

Once again, seriously sorry.
Posted By: testDummy

Re: Panel Fading Problems - 06/29/08 22:16

The 'solution' was probably found in the snippet offered by user JazzDude, or in product 'version-conflicts'.
Arr.
Posted By: xbox

Re: Panel Fading Problems - 06/30/08 01:11

can you give me a link to the snippet or tell me where it is?
Posted By: DJBMASTER

Re: Panel Fading Problems - 06/30/08 01:22

well here is my example... it works but the code could be optimized a little.

here> http://www.djbm.kawanda.net/fade_test.zip
Posted By: xbox

Re: Panel Fading Problems - 07/05/08 18:28

I found my problem, its a problem with the video/graphics card. i tried the fade_test packet and it worked on a good computer and in A7, keep in mind i have A6 Pro. So i hope when i finish the game the panel fading works well.

Also, now i have a slight situation. I have two gun action that i wrote, and what i want is when you have that gun out, a string appears with the name of the gun. When you switch the guns, (Q and E), the gun names will switch too. Can somebody please help me out.
Posted By: DJBMASTER

Re: Panel Fading Problems - 07/05/08 19:07

Ok here is an example of the top of my head...

1) Create a variable to act as counter.
2) Create a TEXT object with the string set as the longest gun name.
3) Create a function for the Q and E keys, which inside increments the counter.
4) Check the counter number against gun number or something
5) Finally change the TEXT object's string by using str_cpy( my_text.string[0], "Gun name here!!!" );

Here is an example to clear things up. Just copy all of this into a blank WDL file and then run it. Press Q & E and the weapon names will switch.

Code:
var gun_number=1;

TEXT gun_label
{
pos_x=0;
pos_y=0;
string="Rocket Launcher";
flags=VISIBLE;
}

function check_weapon()
{	
if(gun_number==1){str_cpy(gun_label.string[0], "Machine Gun");}
if(gun_number==2){str_cpy(gun_label.string[0], "Shotgun");}
if(gun_number==3){str_cpy(gun_label.string[0], "Rocket Launcher");}
if(gun_number==4){str_cpy(gun_label.string[0], "Shock Rifle");}
if(gun_number==5){str_cpy(gun_label.string[0], "Railgun");}
}

function prev_weapon()
{	
if (gun_number==5){gun_number=1;}else{gun_number+=1;}	
check_weapon();
}

function next_weapon()
{
if (gun_number==1){gun_number=5;}else{gun_number-=1;}
check_weapon();
}


function main()
{
vec_set(screen_color,vector(255,0,0)); // set background to prevent blur rendering
check_weapon();
on_q=prev_weapon;
on_e=next_weapon;
}





I've built this example with 5 weapons although it is easy to add more.

Just make sure that the TEXT object's string is set to the longest name of a weapon.
Posted By: xbox

Re: Panel Fading Problems - 07/06/08 00:56

It works correctly if i do what u said and put it in a separate file. But i tried using the code in my current project and it doesn't work. I have the two weapons, and the first line of each says this,
Code:
 action ak47
{
gun_number = 1;
...
}

action mp5
{
gun_number = 2;
...
}

Now when i start the game, the AK47 string loads along with the gun, but when i pick up the mp5, the string does not update. (the check function of mine is the same as yours).

Any ideas?
Posted By: DJBMASTER

Re: Panel Fading Problems - 07/06/08 03:00

No, don't call it straight away in the action.
When you pick up a certain weapon, set the gun_number and then call the check function.
Posted By: tD_Datura_v

Re: Panel Fading Problems - 07/06/08 05:41

An icky alternative, for those that don't want it (probably most).
Code:

var gun_id  = 0;
define guns_max = 8;  // only 8 guns in this game
TEXT gun_strs {
	pos_x = 0;
	pos_y = 0;
	strings = guns_max;
	string = "Mental Manni's Middle Finger";
	string = "Machine Gun";
	string = "Shotgun";
	string = "Rocket Launcher";
	string = "Granny Panties";
	string = "Bear Trap";
	string = "Rolling Papers";
	string = "Bob Saget's Decapitated Head";
}

// add to above
TEXT gun_display {
	pos_x = 0;
	pos_y = 0;
	strings = 1;
}
function gun_show(gunn_id) {
	gunn_id %= guns_max;
	str_cpy(gun_display.string[0], gun_strs.string[gunn_id]);
	return(gunn_id);
}
function gun_next() {
	gun_id += 1; gun_id = gun_show(gun_id);
}
function gun_prev() {
	gun_id -= 1; gun_id = gun_show(gun_id);
}

define _gun_id, skill?;
function gun_grab_event() {
	my.event_impact = NULL;
	gun_show(my._gun_id);
	my._gun_id = -1;
}
function gun_spawn(gunn_id);
	my._gun_id = gunn_id;
	my.enable_impact = on;
	my.event_impact = gun_grab_event;
	while(ME != NULL) {
		if (my._gun_id <= -1) {
			break;
		}
		wait(1);
	}
	ent_remove(me);
}

Just ignore that, if appropriate.
Posted By: xbox

Re: Panel Fading Problems - 07/06/08 23:11

First of all, i have my ammo panel and my health panel. Currently, they both display there values and thats it. So can any one give me any ideas on what to add to the two panels to make it look better. I spent about an hour in photoshop designing the two panels, just to only put two different variables in them, all in all , They look pretty BLANK.
Posted By: xbox

Re: Panel Fading Problems - 07/06/08 23:13

Sorry for double posting, my edit button won't work. Can any one tell me what AUM the "endless level" is in? Thanks, it would be greatly appreciated.
Posted By: DJBMASTER

Re: Panel Fading Problems - 07/08/08 15:27

Infinite terrain/levels > AUM 44
© 2024 lite-C Forums