ID:1930142
 
(See the best response by Kumorii.)
Hey so I basically am making a gate where you dbl click it, press yes and the icon animation of it going down happens, you go in, then it closes.
turf
Gate
icon = 'Gate.dmi'
icon_state = "Wall"
pixel_x = -32
density = 1
layer = MOB_LAYER+10
opacity = 1
DblClick()
switch(alert("Would you like to go in?",,"X","O"))
if("X")
density=0
opacity=0
icon_state = "Wall_Down"
sleep(50)
density=1
opacity=1
icon_state = "Wall_Up"
sleep(30)
icon_state = "Wall"
if("O")
return


The problem is that first it is only dense in one spot so you can walk on it, second the animation freaks out and goes up and down until the sleep(40) is over. What did I do wrong?

I suggest looking into bound_width and bound_height.
Turfs cannot have bound_width and bound_height. If you want the gate to be dense over multiple tiles, you need to make the gate an object, or you need to manually paint a bounding area using dense turfs over the other tiles the turf covers, or use dense area objects.
In response to Ter13
Ter13 wrote:
Turfs cannot have bound_width and bound_height. If you want the gate to be dense over multiple tiles, you need to make the gate an object, or you need to manually paint a bounding area using dense turfs over the other tiles the turf covers, or use dense area objects.

tl;dr: make your gate an obj and set bound_width/height to 32.
What should I do about the actual animation.
What do you mean the actual animation?
The gate going up and down. I keep trying to change the sleep() and it flips out. By doing the animation over and over.
Best response
In the icon editor open up the "wall_down" state and you should see a checkbox that says loop once or something along those lines. Set it to only loop the animation once and you're problem will be solved.
Giving turfs bounds was under consideration at one point and there are some partial options in the code to support it, but it was complicating the pixel movement rollout so it got scrapped. I've never ruled out bringing that to fruition but it's been very low-priority.
*Kurmorii fixed perfectly! Thank you!
Glad I could be of help. (: