Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
TNT Animator pause... — Gideros Forum

TNT Animator pause...

Tom2012Tom2012 Guru
edited October 2012 in General questions
Hi,

When I add this to my spawner class, I get a slight pause each time it's run...
local animLoader = CTNTAnimatorLoader.new()
animLoader:loadAnimations("Animations/atlas-2-animation.tan", atlas, true)
local anim = CTNTAnimator.new(animLoader)
anim:setAnimation("CAVEMAN_FALLING")
anim:addToParent(anim)
self:addChild(anim)
self.myAnimation = anim;
anim:playAnimation()
How would I alter the code so that it wasn't loading the whole atlas each time?

It works if I make aninLoader a global, but trying to avoid that.

Thanks

Tom

Comments

  • GregBUGGregBUG Guru
    edited October 2012
    Hi! tom!

    i really need to see your class to try to help you, anyway

    you should avoid to call
    local animLoader = CTNTAnimatorLoader.new()
    animLoader:loadAnimations("Animations/atlas-2-animation.tan", atlas, true)
    local anim = CTNTAnimator.new(animLoader)
    when you spawn a new object...

    generally i load my anim gfx not inside critical loops of my game and free it
    in the same manner.

    :)
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • Hi Greg :-)

    I found that if I put this part on a scene:
    -- Setup animation loaders for atlases
    animLoader = CTNTAnimatorLoader.new()
    animLoader:loadAnimations("Animations/atlas-2-animation.tan", Atlas2, true)
    And this bit on the class that does the spawing:
    local anim = CTNTAnimator.new(animLoader)
    anim:setAnimation("CAVEMAN_FALLING")
    anim:addToParent(anim)
    self:addChild(anim)
    self.myAnimation = anim;
    anim:playAnimation()
    Things work great.

    And another HUGE thank you for both TNT Animator and your particle engine. I use them both a great deal.
Sign In or Register to comment.