ID:1278578
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
I'd like a built-in method to cause a mover to move to a specific absolute pixel coordinate relative to a certain part of its bounding box, taking obstacles into account.

A built-in method is necessary because it would utilize pixel movement's built-in pathfinding.

Using absolute pixel coordinates is very necessary. This is how I've been finding them:
var const/tile_width  = 32
var const/tile_height = 32

atom
proc/px(p) return (x - 1) * tile_width + p * width()
proc/py(p) return (y - 1) * tile_height + p * height()

proc/width() return tile_width
proc/height() return tile_height

movable
px(p) return ..() + bound_x + step_x
py(p) return ..() + bound_y + step_y

width() return bound_width
height() return bound_height

...which leads me to the syntax for positions relative to an object's bounding box:
/*
Examples of the absolute pixel coordinates relative to an object's bounding box
(using the above procs)
(px(), py()) = bottom-left
(px(0.5), py(0.5)) = center (for topdown stuff)
(px(0.5), py()) = bottom-center (for side-map stuff)
*/


I would definitely like to be able to align the center of an object at a point, taking obstacles into account. Currently, all you can do is have the bounding box barely touch that of another object. Or if collision isn't important, make the involved objects 1x1 and center their icons.

This proc could be called walk_to_point(), or walk_onto(), or something.
I agree. This would be quite useful.