Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
TNT animator studio Events not triggered - Gideros Forum

TNT animator studio Events not triggered

DoradoLabDoradoLab Member
edited March 2014 in General questions
Hi Greg/All,

I am new to TNT Animator Studio.
I am tried with all its properties and methods. Its awesome... But my worry is i just want a property of (currentFrameNumber) option to be enabled and also i am not getting how to use the Events. I tried the example 2 but my Event is not triggered as well the animation is not stopping in the End. Please can you give me clear vision how to deal with stop animation and Events .. It will be really helpful for me to complete my project.

With regards,

DoradoLab

Likes: DoradoLab

+1 -1 (+1 / -0 ) Share on Facebook

Comments

  • ar2rsawseenar2rsawseen Maintainer
    edited March 2014 Accepted Answer
    Hello @DoradoLab
    I just checked and they work
    here is the small example on how to use them:
    local function is32bit()
    	return string.dump(is32bit):byte(9) == 4
    end
     
    if is32bit() then
    	require("tntanimator32")
    else
    	require("tntanimator64")
    end
     
    -- just read texture pack
    local crockTexturePack = TexturePack.new("crock.txt", "crock.png")
    local background = Bitmap.new(Texture.new("logo.png"))
     
    -- init texture animation loader and read animations... 
    local crockLoader = CTNTAnimatorLoader.new()
     
    -- read nimation infos 
    crockLoader:loadAnimations("crock.tan", crockTexturePack, true)
     
    CPlayer = Core.class(Sprite)
     
    function CPlayer:init(playerType)
    	self.lastDirection = 1
    	self.anim = CTNTAnimator.new(crockLoader)
    	self.anim:addEventListener("ANIM_START", function(e)
    		print("ANIM_START")
    	end)
    	self.anim:addEventListener("ANIM_STOP", function(e)
    		print("ANIM_STOP")
    	end)
    	self.anim:addEventListener("ANIM_CHANGE", function(e)
    		print("ANIM_CHANGE")
    	end)
    	self.anim:setAnimation("CROCK_IDLE_DOWN")
    	self.anim:playAnimation()
        self.anim:addToParent(self)
    	Timer.delayedCall(5000, function()
    		self.anim:stopAnimation()
    	end)
    end
     
    local crock = CPlayer.new()
    crock:setPosition(application:getContentWidth()/2, application:getContentHeight()/2)
    stage:addChild(crock)
    Output is:
    ANIM_CHANGE - when animation set
    ANIM_START - when started playing
    ANIM_STOP - when stopped playing
    And I've attached modified (basically cut down) example2 projec to let you try it ;)

    zip
    zip
    TNTAnimatorStudio_EventExample.zip
    268K
  • I am trying you example. And let you know the status... Please do help me if am not getting...

    Thanks

    DoradoLab
  • Hi,

    I have tried it's working and got to know what was my mistake. I should have been used Timer to stop animation. So now from your example i got to know it. But the problem is i am not getting how to adjust it to my number of frames exactly to stop it...

    Do you have any method to calculate the total time for the required frame to play and stop it after that time slab.

    Please reply ...

    Thanks and Regards,

    DoradoLab
  • ar2rsawseenar2rsawseen Maintainer
    I think it can be done like this:
    local frames = self.anim:getFrameCount()
    local timeToEnd = self.anim:getSpeed()*frames
    Timer.delayedCall(timeToEnd, function()end)
    In similar way you can control on which frame to pause/stop the animation

    Additionally I think you could mark specific frame as stop frame in TNT Animator Studio, which should also cause the animation to stop on that specific frame
  • you can retrive current animation frame with

    "function CTNTAnimator:getCurrentFrame()"

    and/or with editor you can mark a frame with "stop" property and event will be raised on that frame...

    just like in example 5

    :)

    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • Apollo14Apollo14 Member
    edited April 18
    UPDATE: UH, I found an old discussion with released full version of tntanimator.lua
    Now examples work!


    Hey guys! I'm trying TNT animator studio now. For some reason I can't make any of the old examples work.
    gproj-file from this post: http://giderosmobile.com/forum/discussion/comment/35539/#Comment_35539
    I'm getting error:
    main.lua is uploading.
    Uploading finished.
    error loading module 'tntanimator32' from file '.\tntanimator32.lua':
    .\tntanimator32.lua: bad code in precompiled chunk
    stack traceback:
    main.lua:6: in main chunk
    How to make it work? Can somebody share a quick basic gproj example that actually works?
    THX!
    (i guess something is broken inside encrypted tntanimator64.lua file?)



    tntanimator.lua-screenshot.png
    1453 x 666 - 42K
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
Sign In or Register to comment.