Forum
CS2D Scripts What's the best way to implement an animation ?What's the best way to implement an animation ?
7 replies 1
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.
Don't use timer for this task.
edited 1×, last 20.05.16 09:06:57 pm
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 image Lua function from CS2D library but also other functions to make work at the fullest an animation. With that being said, if I was in your place I'd refuse to use this hook for such tasks since it occupies each frame thus leading to instant lags.
Edit: VADemon ninja'd me on this one. But just a side note, the only way round to make an animation (at least a simplest one) is to stick with map entities unfortunately.
1
local img = image("<spritesheet:PATH:FRAMEW:FRAMEH[:MODE]>", ...)
1
imageframe(img, 2)
Well with the power of spritesheet image and hooks, you can create an animation. Note that in multiplayer your animation might look weird.
1