ID:158032
 
I've stumbled across this problem many times, and recently had to come back to it.
How would I go about flicking say, a top layer of the icon? If it's y-offset is 32.
Why don't you put the full icon into one instead of using multiple tiles?
The icon state of any overlays will match the base object's icon state, including from flick(), provided no icon_state is set for the overlays.
In response to Howey
Here's some code I just whipped together:

world/mob = /mob/Guy1

mob/Guy1
icon = 'Guy1.dmi'
icon_state="bottom"

mob/Login()
usr.loc = locate(1,1,1)
usr.overlays += /obj/Guy1_Standing

obj
Guy1_Standing
icon='Guy1.dmi'
icon_state="top"
pixel_y = 32
Guy1_Walking
icon='Guy1.dmi'
icon_state="top"
pixel_y = 32
Guy1_Punching
icon='Guy1_Punching.dmi'
icon_state="punchup"
pixel_y = 32
turf
bg
icon ='Map.dmi'

mob/verb
Punch()
flick("punchup",usr)


I tried your method, Garthor, where they both use the same icon state. It doesn't work.
In response to Kirone
You must've misinterpreted what I've said. For example, this is what I mean:

obj/testthing
icon = 'moboverlay.dmi'

mob
New()
overlays += /obj/testthing
verb/test()
flick("test", src)


Note that the obj has no icon_state specified. As a result, its icon_state will match the base object's, even when flick()ing. What this means, however, is that it needs its own, separate icon file.
In response to Garthor
I'm not sure I completely understand-- in the tests I've done with your code and mine, the bottom icon only flicks.

Here is my new revamped code:
mob
New()
usr.icon = 'Guy1.dmi'
usr.overlays += /obj/Guy1_Standing
Login()
src.loc = locate(1,1,1)
verb/Punch()
flick("punch",src)


obj
Guy1_Standing
icon='Top.dmi'
icon_state="top"
pixel_y = 32
Guy1_Walking
icon='Top.dmi'
icon_state="top"
pixel_y = 32
Guy1_Punching
icon='Top.dmi'
pixel_y = 32
In response to Kirone
As I've said, if you have an icon_state="anything" line, it will not work, as the icon_state will always match that. However, if you do not have that line, the icon_state will instead match that of the base object.
In response to Kirone
Your overlays have specified icon states.

Garthor is saying that in order for your overlay to flick with your icon, it must have no icon state specified.
In response to Kirone
Kirone wrote:
I'm not sure I completely understand-- in the tests I've done with your code and mine, the bottom icon only flicks.

Here is my new revamped code:
mob
> obj
> Guy1_Standing
> icon='Top.dmi'
> icon_state="top" //THERES AN ICON STATE DEFINED HERE
> pixel_y = 32
>


that's your problem.