ID:907250
 
(See the best response by Kozuma3.)
Problem description:
In my game I need to make half the screen black for instance.


x|y
i need to make x and why go black seperately.
Look into HUDs abit, search up screen_loc aswell. You could make whatever part of the screen you want blacked out with a plain black icon and x,y to x,y.
Best response
Using the client's screen you can overlay an object/Turf/Etc to block portions of the screen.

obj/HUD
Block
icon='icon.dmi'
icon_state="block"
layer=MOB_LAYER+1
New(client/C,_loc)
src.screen_loc="1,1 to [_loc]"
C.screen+=src


mob/verb
Block_Hor()
for(var/obj/HUD/Block/B in src.client.screen){del B}
var/Size=src.client.view
if(findtext(src.client.view,"x"))
Size=text2num(copytext(src.client.view,1,findtext(src.client.view,"x")))
else Size=(Size*2)+1
new/obj/HUD/Block(src.client,"[Size],[round(Size/2)]")
Block_Vir()
for(var/obj/HUD/Block/B in src.client.screen){del B}
var/Size=src.client.view
if(findtext(src.client.view,"x"))
Size=text2num(copytext(src.client.view,1,findtext(src.client.view,"x")))
else Size=(Size*2)+1
new/obj/HUD/Block(src.client,"[round(Size/2)],[Size]")
In response to Kozuma3
As I was advised, and will now advise you; please do not post copy/paste-able codes in the developer help section.

Anyway, I'm pretty sure your code is clunky and un-needed. You can offer two locations when assigning screen_loc to an obj. So you would only have to provide two locations, "[x1],[y1] to [x2],[y2]" is easiests and simplest.
In response to NNAAAAHH
NNAAAAHH wrote:
As I was advised, and will now advise you; please do not post copy/paste-able codes in the developer help section.

Anyway, I'm pretty sure your code is clunky and un-needed. You can offer two locations when assigning screen_loc to an obj. So you would only have to provide two locations, "[x1],[y1] to [x2],[y2]" is easiests and simplest.

I knew I forgot something :P , Fixed.

And I'm just showing him an example. He himself would have to edit my example thus at least teaching him something about DM if he is just going to copy/paste.
In response to Kozuma3
Your edit now only provides the option to cover the screen from the lower left corner to the provided loc. I set out to help the person asking for it, and end up helping someone providing the code for the person.

I understand your train of thought, but it's wrong. He would simply have to make a few alterations, he would not have to understand the code you have provided to use it. Which makes it copy/paste-able.