ID:165753
 
Well,I've been pondering at this for quite some time now.Let'a get help from u guys!

Well,what I'm trying to figure out is,how to make the screen fade as seen in kajika's Shade's Adventures

thanks in advance

-Meta
If I was at home than I would see the fade effect but one method you could do is use a dither-type fade.

Hope you know what dithering is..

First, let's say we have 4 stages of the fade: (Nothing aka 100% dither..yes, I know this termanology is wrong -> )75% dither -> 50% -> 25% -> 0% (pure black)

Within each stage, more pixels will show and the more darker the icons will get:
 ---
|   |
|___|
  100%

 ---
|   |
|X__|
  75%

 ---
|  X|
|X__|
 50%
 ---
|  X|
|X_X|
 75%

 ---
|X X|
|X X|
 ---
 100%


Obviously that'll look a lot better in a 32x32 icon instead of a 4x4
 ________
|X      X|
| X    X |
|  X  X  |
|   X   X|
| X  X X |
|X    X  |
|    X X |
|___X___X|

Er...yeah... anyways, crappy drawing aside, please note that in each stage (except for 100% where the there's no pixels and 0% which everything is black/white [assume black for black fade-in effect]), every other pixel is coloured in. 75% would be a light-grey shade (as it's near transparency), 50% will be grey, 25% will be dark grey and 0% will be pure black.

When you draw it, it will look like it'll do no shade in effect but you'll be surprised when you test it out.

Now for a simple procedure:
Efx
parent_type=/obj//defines the parent as /obj rahter than /datum..despite technecalities
Fade
icon='Fade.dmi'
layer=1000//We need pure opacity, meaning it must block everything!
mouse_opacity=0//So the mouse can not read the name of this object, ignoring as if it didn't ecisted
icon_state="0"//lets say that the icon states in the icon file are 0,1,2,3,4: 0->100%, 1->75%, 2->50%, 3->25%, 4->0%
screen_loc = "SOUTH,WEST to NORTH,EAST"//Yes, this will be a HUD object. This line effectively makes it appear on the person screen, no matter what the client.view is

client/proc/Fade(wait_time=30)//wait 1time default is 3 seconds of darkness
var/Efx/Fade/F=new//creates a new instance of the fade object
screen+=F//adds the object to the persons screen
for(var/i=0 to 4)//fade in sequence, from 100%->0%
F.icon_state="[i]"
sleep(1)//delay this if neccessary to see a proper, smoother transaction.. forgot what it should be... anyways
sleep(wait_time)//screen is dark for the appropriate time entered
for(var/i=0 to 4)
F.icon_state="[4-i]"
sleep(1)
screen-=F//gets rid of the object
del F//no longer needed


mob/verb/Fade_Effect() src.client.Fade()


When I have the chance, I'll try making an example but meh..

- GhostAnime

-------------
Edit:

Okay, I seriously don't know what I was on again... or had last night... anyways... the shades should be nearly the same (no drastic change like how I stated before with the light grey... that gives a misty type of look), a better method I found as to use a dithered black icon and use that... er here is an example (in the demo, the verb is called Quick Fade Effect):
client/proc/Fade(wait_time=30)//wait 1time default is 3 seconds of darkness
var/Efx/Fade/F=new//creates a new instance of the fade object
screen+=F//adds the object to the persons screen
F.icon_state="3"//3 => black dithered icon
sleep(2)//delay this if neccessary to see a proper, smoother transaction.. forgot what it should be... anyways
mob.sight|=BLIND//You can either make a black icon state and change F to it or do this cheaper method :)
sleep(wait_time)//screen is dark for the appropriate time entered
mob.sight&=~BLIND//takes off blind
F.icon_state="3"
sleep(2)
screen-=F//gets rid of the object
del F//no longer needed


Example can be found at http://members.byond.com/GhostAnime/files/Fade%20Screen.zip

Again, I am not sure if this is what you wanted but it is one method for a fade effect >_>
In response to GhostAnime
Would you mind if I used this as well? This could come in handy on countless occasions.
In response to KirbyRules
I do not mind, that's why I made it public (though I doubt I will make a hub for it, no need in my point of view..)

Just note of how the colour of the dithered icon effects the overall presentation. The icon state "1" (light grey) seems to give a misty-type of look for example, so shades do matter >_>

- GhostAnime
In response to GhostAnime
Yay! Just to note, I changed it around a little:

var/global/fading=0
Efx
parent_type=/obj
Fade
icon='Fade.dmi'
layer=100000
mouse_opacity=0
icon_state="0"
screen_loc = "SOUTH,WEST to NORTH,EAST"
client/proc/Fade(wait_time=1,quickfade=0,icsts=4)
if(fading)return
fading=1
var/Efx/Fade/F=new
screen+=F
if(quickfade)
F.icon_state="[round(icsts/2+(icsts/4))]"
sleep(2)
F.icon_state="[icsts]"
else
for(var/i=0 to icsts)
F.icon_state="[i]"
sleep(1)
sleep(wait_time)
if(quickfade)
F.icon_state="3"
sleep(1)
else
for(var/i=0 to icsts)
F.icon_state="[4-i]"
sleep(2)
screen-=F
del F
fading=0


Now all they have to do is change the parameters around a little and they can have as many iconstates as they want without having to change the overall proc. :P