<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - isAnimationOver?(help)]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=854&amp;type=atom"/>
	<updated>2013-10-25T05:36:44Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=854</id>
		<entry>
			<title type="html"><![CDATA[Re: isAnimationOver?(help)]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=5806#p5806"/>
			<content type="html"><![CDATA[<p>Maybe the functions are not in the right place. Just to be sure:</p><p>- all the code above must be put outside of onSceneUpdate()<br />- inside onSceneUpdate() call the Animate(obj) function</p>]]></content>
			<author>
				<name><![CDATA[com3D]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1488</uri>
			</author>
			<updated>2013-10-25T05:36:44Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=5806#p5806</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: isAnimationOver?(help)]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=5796#p5796"/>
			<content type="html"><![CDATA[<p>ugh! I was sure that would work, but now it doesn&#039;t both animations again, just loops one. I will go to another project for now, maybe it will come to me. Thanks com3D.</p>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2013-10-25T00:14:11Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=5796#p5796</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: isAnimationOver?(help)]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=5768#p5768"/>
			<content type="html"><![CDATA[<p>This should do the trick :</p><div class="codebox"><pre><code>walk_animation = 0
transition_animation = 1
idle_animation = 2
speed = .3
btn = &quot;W&quot;

function Walk(obj)
    changeAnimation(obj,walk_animation)
end

function Transition(obj)
    changeAnimation(obj,transition_animation)
    if isAnimationOver(obj) then
        transitioning = false
    end
end

function BeIdle(obj)
    changeAnimation(obj,idle_animation)
end

function Animate(obj)
    if isKeyPressed(btn) then
        Walk(obj)
        setAnimationSpeed(obj,speed)
        walking =true
        transitioning = true -- get ready for transition
    end
    
    if onKeyUp(btn) then
        if transitioning then Transition(obj)
        else BeIdle(obj) end
    end
end</code></pre></div>]]></content>
			<author>
				<name><![CDATA[com3D]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1488</uri>
			</author>
			<updated>2013-10-24T06:10:21Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=5768#p5768</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: isAnimationOver?(help)]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=5761#p5761"/>
			<content type="html"><![CDATA[<p>Looking at the Animate function I got the animations to play in sequence but now when I press the key I get a freeze frame of the idle animation:</p><div class="codebox"><pre><code>walk_animation = 0
transition_animation = 1
idle_animation = 2
speed = .3
btn = &quot;W&quot;

function Walk(obj)
    changeAnimation(obj,walk_animation)
end

function Transition(obj)
    changeAnimation(obj,transition_animation)
end

function BeIdle(obj)
    changeAnimation(obj,idle_animation)
end

function Animate(obj)
    if isKeyPressed(btn) then
        Walk(obj)
        setAnimationSpeed(obj,speed)
        walking =true
    end
    
    if onKeyUp(btn) then
        Transition(obj)
        transitioning=true
    end
    
    if isAnimationOver(obj) then
        transitioning = false
    
    elseif not transitioning then
        BeIdle(obj)
    end
end</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2013-10-23T21:43:07Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=5761#p5761</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: isAnimationOver?(help)]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=5760#p5760"/>
			<content type="html"><![CDATA[<p>Here is another iteration I have to test:</p><div class="codebox"><pre><code>walk_animation = 0
transition_animation = 1
idle_animation = 2
speed = .3
btn = &quot;W&quot;


function Walk()
    changeAnimation(obj,walk_animation)
end

function Transition()
    changeAnimation(obj,transition_animation)
end

function BeIdle()
    changeAnimation(obj,idle_animation)
end

function Animate(obj)
    if isKeyPressed(btn) then
        Walk()
        setAnimationSpeed(obj,speed)
        walking =true
    
    elseif onKeyUp(btn) then
        Transition()
        transitioning=true
    end
    
    if isAnimationOver(obj) then
        transitioning = false
    end
    
    if not transitioning then
        BeIdle()
    end
end

function onSceneUpdate()
    Animate(person)
end</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2013-10-23T21:25:19Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=5760#p5760</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: isAnimationOver?(help)]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=5759#p5759"/>
			<content type="html"><![CDATA[<p>I wasn&#039;t able to get it to work, so I reformatted my code:</p><div class="codebox"><pre><code>person = getObject(&quot;Person&quot;)

walk_animation = 0
transition_animation = 1
idle_animation = 2

function Walk()
    changeAnimation(obj,walk_animation)
end

function Transition()
    changeAnimation(obj,transition_animation)
end

function BeIdle()
    changeAnimation(obj,idle_animation)
end

function Animate(obj)
    if isKeyPressed(anim_btn) then
        Walk()
        setAnimationSpeed(obj,anim_speed)
    end
    
    if onKeyUp(anim_btn) then
        Transition()
        BeIdle()
    end
end

function onSceneUpdate()
    Animate(person)
end</code></pre></div><p>So the conditions I want is that if a key is pressed I want to play the walk animation. If the key is released I want the character to play a transition animation and then an idle animation, and keep doing the idle animation until the key is pressed again.</p><p>How would I set the conditionals up in the Animate() function exactly?&nbsp; I know I have to use isKeyPressed().</p>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2013-10-23T21:01:05Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=5759#p5759</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: isAnimationOver?(help)]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=5757#p5757"/>
			<content type="html"><![CDATA[<p>Currently your animation 2 is only played 1 frame (just after animation 1 is over), then on the next scene update you loop back to animation 1 because onKeyUp condition is satisfied.</p><p>You could do something like :</p><div class="codebox"><pre><code>if isAnimationOver(anim_object) then anim3=true end</code></pre></div><p>and add:<br /></p><div class="codebox"><pre><code>elseif anim3 then
        changeAnimation(anim_object,2)
        setAnimationSpeed(anim_object,.3)
end</code></pre></div>]]></content>
			<author>
				<name><![CDATA[com3D]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1488</uri>
			</author>
			<updated>2013-10-23T19:58:12Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=5757#p5757</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[isAnimationOver?(help)]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=5752#p5752"/>
			<content type="html"><![CDATA[<p>I can&#039;t seem to understand how isAnimationOver() works. How do I get animations to play in succession? Here is the code:</p><div class="codebox"><pre><code>function Animate(anim_object,anim_walk,anim_btn,anim_speed)--,anim_sound)
    if isKeyPressed(anim_btn) then
        idle = false
        walking = true
        changeAnimation(anim_object,anim_walk)
        setAnimationSpeed(anim_object,anim_speed)
        --playSound(anim_sound)
        
    
    elseif onKeyUp(anim_btn) then
        idle = true
        walking = false
        changeAnimation(anim_object,1)
        
        if isAnimationOver(anim_object) then
            changeAnimation(anim_object,2)
            setAnimationSpeed(anim_object,.3)
        end
        --stopSound(anim_sound)
    end
end</code></pre></div><p>I want the character to play a certain animation when a key is released. And then, after it plays that animation, I want it to play another animation (I would think this animation continues to play).</p><p>However, in this code, the first animation plays and the next animation never plays, it just keeps playing the first animaton (animation 1).</p>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2013-10-23T19:10:47Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=5752#p5752</id>
		</entry>
</feed>
