Forum
![>](img/i_next.png)
![>](img/icons/cs2d.png)
![>](img/i_next.png)
![>](img/i_next.png)
What's the best way to implement an animation ?
7 replies![To the start](img/i_first.png)
![Previous](img/i_prev.png)
![Next](img/i_next.png)
![To the start](img/i_last.png)
The only way I can think of is using image function to show different images over a period of time. What other way to implement images is there? I suppose you could do the same with map entities but you can't control as much.
I am not aware of any other ways to even implement an animation so I can't say that there's a better way to do it than what I described. It's the only option out there.
If you're asking how exactly to implement it with lua, I'd probably load the image frames first and then juggle with their transparency. That way you wouldn't have to make images every time you want to show an animation.
![cs2d lua hook](img/i_codehelp.png)
![cs2d lua hook](img/i_codehelp.png)
![cs2d lua hook](img/i_codehelp.png)
Don't use
![cs2d lua cmd](img/i_codehelp.png)
edited 1×, last 20.05.16 09:06:57 pm
![cs2d cmd](img/i_codehelp.png)
Each function consists of methods, instructions and so forth that are either small or big. Since, for example, we want to implement an animation, you wouldn't simply just use the
![cs2d lua cmd](img/i_codehelp.png)
![•](img/dot.gif)
![user](img/i_friend.png)
![cs2d lua cmd](img/i_codehelp.png)
1
local img = image("<spritesheet:PATH:FRAMEW:FRAMEH[:MODE]>", ...)
![cs2d lua cmd](img/i_codehelp.png)
1
imageframe(img, 2)
![user](img/i_friend.png)
![thread](img/i_forum.png)
![news](img/icons/news.png)
Well with the power of spritesheet image and hooks, you can create an animation. Note that in multiplayer your animation might look weird.
![To the start](img/i_first.png)
![Previous](img/i_prev.png)
![Next](img/i_next.png)
![To the start](img/i_last.png)