ID:2318146
 
Code:
animate(src, transform = matrix()*size, time = time)

if(size==3)
//Reposition character otherwise they can escape the world / get through walls
var/turf/Tile = get_step(usr.loc,NORTH)
if(!Tile.density) //If the tiles density = 0
src.y+=1;
//Set up bounds for new character size of 3
bound_y = -32 //Bounds position bottom of feet for x3 (Works because step is default to 32)
bound_height = 64


Problem description:

So I'm attempting to scale my icon in-game as a "Giant" form however my character ends up standing on walls or outside the map.



My current solution is to just use a size of three instead however I'm finding this too large for the game world.(code above)

Using the same method of changing the bounds results in disabling gliding as the game is using tile movement.

Is it possible to scale upwards and keep the base in position of bottom left corner of the tile.
Try adjusting the pixel_x and pixel_y offsets after scaling.
In response to Spunky_Girl
Spunky_Girl wrote:
Try adjusting the pixel_x and pixel_y offsets after scaling.

This is pretty awful advice. You should be scaling the bounds along with the transform matrix, otherwise collisions will bork. pixel_x and pixel_y are purely visual effects, so the bounding box will be out of place.

What you should change is the atom's physical position -- I assume just x / y because you're using tiles.
In response to Unwanted4Murder
If he adjusts the pixel_x and pixel_y, as well as the bounding box, he'd be fine. Having to change the location after scaling is counter-intuitive.
In response to Spunky_Girl
What is counter intuitive is not being able to set your own pivot point so that this isn't an issue in the first place. Between the two options, I'd say changing physical location is smarter than changing offsets. I don't typically work in tiles though. I suppose YMMV, but this seems like a no brainer to me.

Edit: Might be worth mentioning that I have a library for scaling bounds and I use Kaiochao's Pixel Positions for easy positioning functions, so those two things may influence my opinion a bit.
It's not about the physical location, that is me in the same position as the tiny version. Just my icon itself overlaps over the wall.

Also attempted pixel_x earlier and it messes up movement also (disables glide)
Well yeah, because you're scaling the atom and the pivot point for transform scaling in BYOND is the middle of the atom. Like I said, move the physical location and there will be no overlap.
Ok so, I actually have no idea on how to do what you are suggesting. (Tbh I still don't really know what you are suggesting)

Could you point me in the right direction on where to research this one?

Login to reply.