Adding an Additional frame to "PlayerAnimations.MOVE"

15 views
Skip to first unread message

Joe Ford

unread,
Apr 20, 2014, 8:40:23 PM4/20/14
to replica-island-...@googlegroups.com
Right now the Andou's Move animation is dictated by this piece of code from the GameObjectFactory class (among others):

            SpriteAnimation angle = new SpriteAnimation(PlayerAnimations.MOVE.ordinal(), 1);
            angle.addFrame(new AnimationFrame(
                    textureLibrary.allocateTexture(R.drawable.andou_diag01),
                    Utils.framesToTime(24, 3), pressAndCollectVolume, basicVulnerabilityVolume));


I'd like to add a second Move frame by adding something like this:

            angle.addFrame(new AnimationFrame(
                    textureLibrary.allocateTexture(R.drawable.andou_diag02),
                    Utils.framesToTime(24, 3), pressAndCollectVolume, basicVulnerabilityVolume));
            idle.setLoop(true);


(and then obviously updating ".ordinal(), 1);" to ".ordinal(), 2);")

But the code above simply skips the first frame, goes directly to the second frame, and STAYS on the second frame for as long as I'm continuing to move.

On the other hand, when i implemented something similar for the Idle animation frames (for example, now Andou's Idle animation could include two images to give the effect like he's blinking etc), it worked fine. 

Can someone tell me how I can add a second frame to the Move animation? I suspect there's something dictating how long this set of frames lasts, and I can't seem to find out what.

Thanks!
Joe




Joe Ford

unread,
Apr 20, 2014, 8:54:46 PM4/20/14
to replica-island-...@googlegroups.com
Looks like I didn't play around enough before posting. I have part of the problem solved. Changing the two Utils.framesToTime(24, 3) lines to to 0.5f shows me BOTH frames. Now my only issue is they're not repeating.  

Joe Ford

unread,
Apr 20, 2014, 8:58:20 PM4/20/14
to replica-island-...@googlegroups.com
And now i noticed I wrote "idle.setLoop(true);" instead "angle.setLoop(true);"  ~face palm~

Soooooo it's working as it should. I apologize if anyone wasted their time reading thing.   Maybe someone not familiar with changing the animations will find it helpful.

Bart Hirst

unread,
Apr 21, 2014, 11:55:06 AM4/21/14
to ReplicaIsland Coding Community
No problem at all Joe, thanks for posting

--
You received this message because you are subscribed to the Google Groups "ReplicaIsland Coding Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to replica-island-coding...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages