ID:1101255
 
Keywords: edge, map, movement, pixel
(See the best response by Rotem12.)
I'm trying to figure out how to prevent mobs from walking off the edge of the map in my project that uses pixel movement.
Best response
You can find a nice pixel movement library by Forum_account here.

Basically it depends on how your pixel movement code works.

You can simply block movement if the next step will result beyond the edges:
// west and south edges
if(move_x+x < 0 || move_y+y < 0)
// return or some other action when player attempts to move outside the bounds

//east and north edges
if(move_x+x > world.maxx || move_y+y > world.maxy)
// return or some other action when player attempts to move outside the bounds

// move_x being the amount of pixels you're moving and x is x and step_x(same for y).


Another option is to place dense objects around the edges or the area you wish to block.
Well, with a small project of mine, when using native pixel movement, it wotn let my bounding box overlap the edge. So I would have to assume you're using an icon_size bigger than your bounding box? You'll have to increase the bound_width and bound_height to prevent that. If you're going for the more 'artsy', I guess, route and have a icon that's top-half is a non-dense overlay; You may wish to add in a extra dense turf to the top of the maps.
Thanks guys. I am using Forum_account's lib, but hadn't yet wrapped my head around it completely.
I have. Pushing myself into playing around with icon sizes.