ID:264797
 
Code:In this code, the skill was to leave in line with the usr that is an icon of 52x52
and the icon of 152x173.

 usr.overlays+='Test.dmi'
flick("Skill1",usr)
usr.frozen=1
for(var/mob/M in oview(4))
var/damage=usr.Int*2+usr.bonusatack
M.hp-=damage
M.Death()
usr.frozen=0
usr.frozen=0
sleep(20)
usr.overlays-='Test.dmi'


Problem description: when usr will use the skill, the skill becomes misaligned.
And the icon of the skill is in size larger than the standard Byond, only it is not divided.
It is only a state icon.
Example:

++++++++++ Skill>
usr>

How do I align to the skill?


What?
Things don't automatically align themselves. You either need to move it in the icon editor (and you can do the movement with pixel collision if you want), or look up pixel_x and pixel_y. If you can't figure that out, I suggest starting here, because it seems from the way you're asking your question that you haven't.
yea, and i'm pretty sure to center large icons each pixel value has to be something like :

width-width of icon
height-height of icon

pixel_x : -1(width/4)
pixel_y : -1(height/4)
In response to Masschaos100
                usr.overlays+=/obj/Skill
flick("Skill1",usr)
usr.frozen=1
for(var/mob/M in oview(4))
var/damage=usr.Int*2+usr.bonusatack
M.hp-=damage
M.Death()
usr.frozen=0
sleep(20)
usr.overlays-=/obj/Skill
obj
Goukakyuu
icon='Skills/Test/Test.dmi'
density=1
pixel_x = -1//(width/4)
pixel_y = -1//(height/4)


<code problem>I created one and put the obj pixel_x and y -1
The icon stays the same dir of the player, but does not stay in line looks like: http://img545.imageshack.us/img545/8138/bugc.png </code problem>
In response to CopyNinja_Hell
its not just -1. Have you taken algebra? Actually Im pretty sure i learned this before that but the negative one means you have to multiply it to the other numbers. I don't feel like explaining math right now so...
In response to Masschaos100
In my experience, centering large icons uses this formula:

pixel_x = (world.icon_size/2)-(width/2)
pixel_y = (world.icon_size/2)-(height/2)

Using an icon of the size 48x48 on a normal world with the default icon_size of 32, it'd be

pixel_x = 16-24 //evaluates to -8
pixel_y = 16-24
In response to Kaiochao
for my 216x216 icon all i had to do was

pixel_x = -54
pixel_y = -54

and it centered fine :P
In response to Masschaos100
Masschaos100 wrote:
for my 216x216 icon all i had to do was

pixel_x = -54
pixel_y = -54

and it centered fine :P

Hmm, have they increased the -32 to 32 limit since I've last used it?
In response to OrangeWeapons
Haha, yes. They increased it a whoooole lot.