client
Move ()
point
var/x
var/y
turf/Click (location, control, params)
..()
var/dest = new (x * world.icon_size, y * world.icon_size)
var/paramslist = params2list (params)
var/px = text2num (paramslist ["icon-x"])
var/py = text2num (paramlist ["icon-y"])
dest.x += px
dest.y += py
walk_to (usr, dest)
Problem description:
Well I have been searching around and studying the snippets about this but I can't understand the most of them. I don't need Pathfinding cause the walk_to intelligence is enough for my design. I just need to click on a turf and the player move to it.
I've tryed different methods and the best I got was from:
turf/Click (location, control, params)
..()
walk_to (usr, src)
But the player do not stay on top of the turf clicked. Its like it colide with the turf i'm clicking.
I saw an example using the client drag and other using complex pixelmovement calculation (i'm newb so it looks complex to me). And I tried to use locate (dest) but the player walks randomly and awkwardly.
What I need to know:
Whats the best aproach for this simple click movement? (Im using the step_size for speed and don't care if the movement is not pixel precise)
Why no Pathfinding?
Cause I'm using the visibility of the player like in roguelikes instead of opening the view of the world. Since you can't see behind a wall you cant click behind it so I don't need a code to find a better way around walls.
Why not copy/paste snippets?
The ones I found do things too complex for my own capabilities of using it. They normally are not for the same purpose I'm looking for. And I'm not copying codes that I don't understand completly, the ones I understand I rewrite it.
Thanks in advance.
Split params, text to string and point is a datum. Datums don't take procedures.
What's wrong with this?
!?