Problem description:
Morning guys, this is more of a how-to question. I my game's TBS, I'm using a lot of animate() in order to move hud objects. Now I want to have a pointer hanging over one of thosehud objects, namely this one:
hud
fighter //used for showing mobs that are fighting onscreen
layer=MOB_LAYER+11
var/id
screen_loc="12:5,10:16"
The problem is that I animate its movement quite a lot. Now I tried getting the coords of the image with f.id.screen_loc, but they are the same as when it spawned, the animation doesn't seem to be counting that as changing screen_loc. I tried with pixel_x and pixel_y, but it game me no change.
So, what vars are actually changed when I use, let's say this:
animate(fighter,transform=matrix(10,5,MATRIX_TRANSLATE)*0.75, time=2, loop=0, easing=LINEAR_EASING)
and how do I access them? I mean, it doesn't seem to be pixel_x/y or screen_loc.
And how do I access the Height/Width of an icon in a hud object? I tried fighter.icon.Width but it didn't work and told me the proc doesn't exist.
In your call to animate(), you animate "fighter" by setting "transform" to a matrix. The variable changed is "fighter.transform".
animate() is simply a way to make clients see a change in appearance occur smoothly over time.
The equivalent without animate() is this, which happens instantly:
I'm not sure why, but some people seem to be conflating animate() and atom.transform. They're two completely separate features; animate() can be used to change an atom's transform, but it's the transform var that's being changed and causes the actual visual effects like sliding, scaling, rotating.
(By the way, "loop=0" and "easing=LINEAR_EASING" are the default values for those arguments, so you don't have to specify them.)
As for actually getting the position, it requires some math and knowledge of the matrix datum; all of which is described in the DM Reference pages about the matrix and transform.