Animations

14 replies [Last post]
Joined: 07/08/2011

I haven't been working too much lately and I apologize. School and all that. While trying to get back into it, I was thinking about what needed doing. I remembered I still needed to figure out a way to coordinate animations, so I begun work on that.

A few minutes got me this template:

<anim id="anim1" fcount="4" path="data/images/utility/anim1.png" loop="true">
    <frame order="1" x="0" y="0" w="150" h="150" time="1" />
    <frame order="2" x="150" y="0" w="150" h="150" time="1" />
    <frame order="3" x="0" y="150" w="150" h="150" time="1" />
    <frame order="4" x="150" y="150" w="150" h="150" time="1" />
</anim>

It goes along with this image which is 300x300 split into four perfect squares. I think it's pretty straightforward. "time" is in seconds.

Would this template work for you guys? If not, feel free to give suggestions. I want to find a template that would be good for everyone. Any questions are welcomed. This is what I'm hoping to finish for this weeks release, by the way.

EDIT: Oh, and Dear Esther was just released. This is the second release from Indie Fund!

Joined: 12/23/2010

I think this would work well: easy to understand, simple to use. What would make it even simpler would be if, once we actually start putting stuff together, someone makes a small app that generates such XML automatically, and you only need to input parameters. Things like x, y, w, and h would be much easier and simpler to acquire.

Also, don't forget that we'll likely need transparency. Or is that handled elswhere?

Joined: 07/08/2011

If you want the whole image for a frame, you put 0x/0y/300w/300h. I think putting a larger width and height would also take the whole image but it might allocate more memory than it needs.

That kind of tool sounds handy. I'll think about making one; I'm always worrying about what you all, the builders, would like to use for tools. For now I'll worry about the engine itself though.

Transparency is done according to opacity on the PNG itself.

Joined: 08/06/2010

Looks good. Is time an int or a double?

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 07/08/2011

Double obviously. An int would be ridiculous.

Joined: 08/06/2010

Just wondering if you planned some interpolation or something.

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 07/08/2011

A double would be easier. I could easily integrate it into the frame counter. I just have yet to create an algorithm for figuring out which frame to begin drawing the new image in.

Joined: 09/01/2009

RedTheGreen wrote:
An int would be ridiculous.

Not if it were a millisecond counter. Wink

I don't think SDL has a way to change alpha, but being able to keyframe an "active" flag or something like that may be a good idea (active=false means the object isn't drawn). This way you can make an object blink or stuff like that.

Joined: 08/06/2010

Well, if it were a millisecond counter, you might want an unsigned long long instead.

Actually, I take that back. Presumably everyone will have 32-bit computers. Tongue

But couldn't you do the "blinking" by blanking out every other frame?

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 07/08/2011

Exactly, the transparency is PNG-based, but I guess I can have an <emptyf> element that is a frame without any visual representation. That sound good?

Joined: 09/01/2009

32-bit computers? Both of mine are 64-bit.

Joined: 07/08/2011

Most of my friends have 32-bit. All three of mine are 64-bit though. I guess it depends on how you were raised. Wink

Joined: 08/06/2010

64-bit here as well. But we shouldn't rely on all our users to have it.

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 12/23/2010

Recently got 64-bit too. But all others in our family is 32-bit, and we only got 64-bit on this one because we realised that we weren't using our 4GBs of RAM, and we had to reinstall Windows anyway. When I get my own I'll probably only get 64-bit if I have more than 3GB of RAM, which is likely.

RedTheGreen wrote:
That kind of tool sounds handy. I'll think about making one; I'm always worrying about what you all, the builders, would like to use for tools. For now I'll worry about the engine itself though.

I might be able to make it in Adobe AIR, if/when we need it. Unless anyone else would rather do it. But as you said, we should get the engine done first: you might decide to change this method of animation altogether.

Joined: 07/08/2011

Sweet. When the next update arrives, we'll see if we like how it turned out.