Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Ginger_till_i_dye on Mon 23/03/2020 13:07:21

Title: Black Screen with text
Post by: Ginger_till_i_dye on Mon 23/03/2020 13:07:21
Hello - I'm having trouble on getting an effect I want - Any tips or directions would be useful

I am trying to have the player click on a hotspot, have the screen fade to black, display a message, fade back in to the same screen
I tried:

function hHotspot1_Interact()
{
FadeOut(4);
Display("Message");
FadeIn(4);
}

but this doesn't display the message (assumedly because of the Faded out screen)
Tinting the screen doesn't go dark enough :/

Please and Thank You
Title: Re: Black Screen with text
Post by: Slasher on Mon 23/03/2020 13:10:50
Could try a black gui with a label. set transparency to 100 and then make visible and fade in and out with tween transparency... and clickable set to false.

Example:

In this instance make a gui named gBlack screen sized, set clickable to false and its transrancy to 100.

Code (ags) Select

gBlack.Transparency=100;
gBlack.Visible=true;
gBlack.TweenTransparency(1.3, 0, eEaseInEaseOutTween, eBlockTween); // Tween Module
Display("You manage to find a space in the tent where snow hasn't laden.");    // I use Display and not label in this case
gBlack.TweenTransparency(1.3, 100, eEaseInEaseOutTween, eBlockTween);  // Tween Module
gBlack.Visible=false;


Title: Re: Black Screen with text
Post by: ManicMatt on Mon 23/03/2020 13:47:28
If you're not comfortable with using a GUI, you can make an object sprite that's just pure black the same size as the screen and have that change transparency. The baseline would need to be in front of everything else though, and it would need to be set to visible = false initially.

Alternatively, just have it change rooms if you have fade transitions between rooms and just have a black room.

Slasher: Doesn't tween code require the Tween module?
Title: Re: Black Screen with text
Post by: Slasher on Mon 23/03/2020 13:56:06
If its for one room then an object may be better as Matt described.. though watch it's Baseline...

The Tween Module is a 'must have' for practically all games...
Title: Re: Black Screen with text
Post by: TheManInBoots on Mon 23/03/2020 15:10:18
Instead of using tween, you can simply create the fade in/out of the gui or object, by looping the objects/guis transparency up/down with a 'while' function.
e.g.

Code (ags) Select

while(gBlackGui.Transparency>0)
{
gBlackGui.Transparency=gBlackGui.Transparency-4;
Wait(1);
}


This makes the black gui that was initially set to 100% Transparency fade in.
Title: Re: Black Screen with text
Post by: ManicMatt on Mon 23/03/2020 15:36:33
Quote from: Slasher on Mon 23/03/2020 13:56:06
The Tween Module is a 'must have' for practically all games...

Unless you know something I don't, I wouldn't assume they have Tween installed. Especially if they need help with making a black screen, I think tweening is too advanced for them as it's very code intensive and wouldn't recommend it to anyone starting out or not very good with coding, like myself! Haha.
Title: Re: Black Screen with text
Post by: Slasher on Mon 23/03/2020 15:57:32
I find the Tween module very useful and once you have it you just need one line of code to run basically...

Its a tool to make life easier.. If you have a car you should have some tools to fix it, or would you try to fix it with other stuff?

Beginners should be made aware of tools available and do their own research..

I think there was talk at one time to include certain modules/plugins in the AGS folder.. Or even within a custom Template..
Title: Re: Black Screen with text
Post by: TheManInBoots on Tue 24/03/2020 17:40:26
Quote from: ManicMatt on Mon 23/03/2020 15:36:33
Quote from: Slasher on Mon 23/03/2020 13:56:06
The Tween Module is a 'must have' for practically all games...

Unless you know something I don't, I wouldn't assume they have Tween installed. Especially if they need help with making a black screen, I think tweening is too advanced for them as it's very code intensive and wouldn't recommend it to anyone starting out or not very good with coding, like myself! Haha.
I'm really glad that there are some people with a healthy common sense.
That's very valuable advice you give ManicMatt: Be aware on what level of knowledge people are on, to best help them!
Title: Re: Black Screen with text
Post by: ManicMatt on Tue 24/03/2020 20:20:46
Thanks. If the tweening code was too confusing for me - someone who has made 4 full AGS games, - Well, you get the picture.
Title: Re: Black Screen with text
Post by: TheManInBoots on Sat 04/04/2020 01:00:38
Yeah I get it.

I've seen you have three of your games listed on this web site.
I'm gonna check them out when I get to it.
Title: Re: Black Screen with text
Post by: ManicMatt on Sat 04/04/2020 09:34:03
Whoops! I forgot to make a game entry for my latest game, I'm glad you said 3 games haha!