Hello!!, it's a noob question but... i just watch some examples with movie clip, but they use individual images for every frame, my question is... is there a way to use that class but with a sprite sheet? or i just have to do it in some other ways? thank you in advance
Comments
Basically, there're 4 ways to play animations:
1) Old "MovieClip" class: http://docs.giderosmobile.com/reference/gideros/MovieClip#MovieClip
2) New "Another MovieClip" (compatible with TNT Animator): http://forum.giderosmobile.com/discussion/7549/another-movie-clip
3) @antix ' animation system (I've never tried it): http://forum.giderosmobile.com/discussion/comment/47115/
4) Spine/Dragonbones skeletal animation.
Likes: MoKaLux, LostVGM, antix
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: MoKaLux, LostVGM
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
There is also one more way to do animation, it is through a class called "gtween.lua".
You can do animation with only one sprite (image) and transforming this sprite like rotating , bouncing, pulsing, making biger smaller and on and on.. There are so many diffrent options inside the class you need to experiment it.
(Just to give you an idea let us suppose there is a door closed on scene and you want to open it by clicking on it. You can apply gtween on the door image with rotation and maybe a little bit transformation with angle to gave the 3d effect to make it open.)
In addition there is an example about gtween in the Gideros studio.
Take care
Likes: MoKaLux, LostVGM
Not to toot my own horn but my system is fairly easy to mash into an existing codebase. It can be optimised a little but performance is pretty good.
The drawback of everything mentioned besides Spine (and maybe TNT Animator) is that they are frame based. If your game starts to lag then the animations will become eratic as a result.
Spine is fantastic but its not overly performant when many objects are being animated at once. @Apollo14 made a test somewhere and you can find it on the forums if you search
Likes: LostVGM
watch?v=VovRIAI1cWoLikes: LostVGM
something like this:
local frames = 1
local duration = 0.07
local totalTime = 0
self.frames = {}
self.frames[1] = TextureRegion.new(texture, 0, 0, 40, 40)
self.frames[2] = TextureRegion.new(texture, 40, 0, 40, 40)
self.frames[3] = TextureRegion.new(texture, 80, 0, 40, 40)
self.frames[4] = TextureRegion.new(texture, 120, 0, 40, 40)
then to update the frames:
if self.movingR then
totalTime = totalTime + dt
if totalTime > duration then
self:setTextureRegion(self.frames[frames])
frames = frames + 1
totalTime = 0
end
if frames > 4 then
frames = 1
end
end
it works but i'm not sure if something could be wrong, also i don't know how to post code like oleg xD, oh and i'm going to check your videos , thank you again
Likes: LostVGM