ID:266009
 
I've noticed that using any icon procs is always a terrible idea, I once had a project where size constantly changed; most of the total cpu was from IconRsc.


I have a swing animation for weapons, and I want them to play frame-by-frame i.e:
for(var/frame=1 to animlength)
sleep(delay)
icon = icon('sword.dmi',"swing",frame,)


If I make sure to delete the atom whose icon is changing via the icon proc, will that help...

A better question:

Should I even be worried about this... at all? (yes swinging will happen very often)

Or should I just tediously go through and separate each icon's swing animations, frame by frame (including the fact there are two swings, obviously)
This here does exactly the same thing with less CPU usage and is more flexible in a sense.

while(Swinging)
icon = 'Swinging.dmi'
icon_state = "1"
sleep(1)
icon_state = "2"
sleep(1)
icon_state = "3"


You'll get something that looks exactly like any normal animation. I don't fully understand why you would want to do this but that's how I would do it.

In response to Kyle_ZX
Because I've alerady made the icons in a certain manner, and plus when I leave flicking up to BYOND problems generally ensue, but I could try it :D
In response to The Ending Cross
Yea, try it just with a few states to start with then go from there would be my advice. Don't want to disappoint yourself if it's not what you're looking for.
Don't create a new icon everytime you want to change it. You can continue using the for() loop, just make sure you name your icon_states swing_1 swing_2, etc, and just change your icon_state.
[edit]
This does require you to change how you have your icon set up, but this is the best way for now. We've been requesting this for quite some time.
In response to DivineTraveller
There's no creation of an icon here. It's simple editing of the icon state.
In response to Kyle_ZX
The Ending Cross wrote:
> for(var/frame=1 to animlength)
> sleep(delay)
> icon = icon('sword.dmi',"swing",frame,)
>


icon() creates a new icon every time it is used.
In response to DivineTraveller
O sorry, I see.
Maybe you are looking for flick() proc?