ID:156421
 
i made that when the user dbl clicks a turf a obj moves there but i want the obj to change of icon when it reaches there, because if i use the sleep(..) thing it can change the icon when they way to get there or after it reaches.
Help Please
Instead of using walk_to() or walk_towards(), construct a while() loop that uses step_to() or step_towards(), so that you can know when it reaches the destination.
In response to Garthor
ok but how would it be? i can change the walk_to for step_to and then how can i make the code to know when it is in the turf the usr dblclicked?
In response to Garthor
Ok i wanted that when u dbl click a turf a obj goes there and when theh obj gets there the icon changes... someone told me to use while() and step_to() and step_towards() but i don't know how to do that its the same for me i was using walk_towards and then sleep(..) but its bad cause sometimes the icon changes when the obj is about to get there or sometimes after...
Help Please
In response to Zosthy
When the location of the object is the destination.
In response to Garthor
turf
DblClick()
for(var/obj/bigball/K in world)
if(K.Gowner == usr)
walk_towards(K,src,0)
if(get_step(K,src) > 1)
K.overlays += new/obj/ball
but the obj dont change when it reaches the turf the usr dblclicked.
some idea on how can i make the code?
i want the code to change the icon of the obj when it reached the turf.
Thanks
In response to Zosthy
oh iz u making teh dbz game wif da codes?

1. Use [dm] [/dm] tags to encase your code.

2. Why are you using a for() loop, to loop through every bigball object in the world? Just have an Owner variable for the object.

3. If you want to change the icon of something when you step on it, you would do that in an Entered() procedure, and change the icon_state of it.

4. You don't just will the code to do things. You have to learn and put in time and effort, or no-one will care about what you made or try it.
In response to OrangeWeapons
That's not what he said at all for your 3rd bullet or list item or whatever you want to call it. He wanted it to change its icon state when it reaches its destination.