ID:2381761
 
(See the best response by Konlet.)
Code:
obj
Attack
doryuheki
icon='Mud Wall.dmi'
icon_state="form"
density=1
New()
..()
spawn(5)
icon_state="idle"
var/turf/G = locate(x+1,y,z)
if(!G)G=locate(x,y,z)
for(var/turf/F in range(G,1))
if(F.density==0)
F.density=1
F.changed=1
sleep(1)
spawn(100)
if(src)
var/turf/H = locate(x+1,y,z)
if(!H)H=locate(x,y,z)
for(var/turf/F in range(H,1))
if(F.density==1&&F.changed)F.density=0
sleep(1)
continue
del(src)


Problem description:

my icon for the move its like 5 tiles in 1 and i wanted to know because the problem is that code its supposed to make a technique shield to block other attacks and only makes density like the bottom left of the object so its like 75% of the object doesnīt get density reason as anyone can see i try to make it so the range around the object gets all turfs in it with density but thatīs really not my goal.

If anyone know how i can get all the obj with density without having to break all the icon into parts, since that can be done easily easy but i will have to break the forming state and that it's really too much work and im no iconer


There are bound variables that you can modify if you want only a portion of the object to have density.

obj/example
bound_width = 16
bound_height = 16
i been trying to use bounds with

pixel_x=-32
pixel_y=-32
bound_x=8
bound_y=8
bound_width=16
bound_height=16


it kind of work it really detects all the icon now so density its there but it slowed down characters movement i never used bounds since its new to me i used to code over 3 years ago and i dont remember seeing this tags before if anyone can help me i also check the size of the icon its 132x132
In response to Destroior
Best response
The pixel_x and pixel_y atom variables will displace the icon but not their hitboxes. Only bound variables (bound_x,bound_y,bound_width,bound_height) will effect the hitbox bounds. Also, these variables shouldn't have any effect that would result in slowing down the character's movement..
thanks for your help i manage to do it once i understand the syntax i was using bounds_width,height unbalanced with with the x,y so they were unbalancing each other causing the game to break in speed completely i still dont understand they cause but now i balanced them and its good tkz for your help