ID:266599
 
ya I'm just curious if someone could explain this to me...

What's the closest example to the pattern for... errr ok here's an example...

the way byond works is through 32x32 squares...

so you have s for squares
p for player which is still on a square...
s s s
s p s
s s s

now there's the general dirctions N/S/E/W/NE/SE/NW/SW
you all know that...
buuuuuuut
if I wanted to say make a click proc that had it so when you clicked a certain square it would shoot something at it...
what would be the pattern it would take?
for instance
s s s s s
s s s s2 s1
s s p s3 s
s s s s s
s s s s s

ok now where you clicked is s1...
how does byond figure to send the missle? Would it be between s2 and s3? or would it go with s3 and then to s1? or how does it do this?
It depends on how you're coding the movement.

BYOND's simplistic directional system determines that any object that's not exactly aligned to one of the four cardinal directions must be exactly aligned in one of the four diagonal directions. If you simply tell something to keep checking the direction between it and its target, step in that direction, and check again, it will move NE, SE, NW, or SW until it's aligned on either the horizontal or vertical axes, then move straight along the appropriate axis.

It's been a while since I've used step_to() or step_towards(), as my recent projects have all been either abstract/mapless, used very customized movement procedures, or didn't have any NPCs to require pathfinding, but I think these both use methods similar to the approach described above. I've heard that the missile() proc actually approximates a straight line in drawing the path of an object, but I haven't had much occassion to use this proc.
In response to Lesbian Assassin
hmm I've been having problems with sending missles where you Click... I mean I used the same code I did for the verb and just moved it over to click and specified when it shoots a missle and it shoots does damage and everything but the missle stays 1 block away from the usr... and doesn't go to where you clicked for some reason I'm gonna continue testing it and probably post in bugs section...

curious if anyone else has noticed this?