Learning Kyra: Some Tidbits of Info

The Learning Kyra series to date:

  1. Learning Kyra
  2. Learning More Kyra
  3. Learning Kyra: Attack of the Clones
  4. Learning Kyra: Tiles and Z-Ordering
  5. Learning Kyra: Hit Detection

I’ve spent some time just reading through the documentation for SDL and Kyra. I’ve also tried to pick up what I can at Kyra’s forums on SourceForge.

For instance, GlDynArray has been removed from the library for the next update. I can substitute std::vector<> though, which for all intents and purposes means very little has changed except for a redirection/abstraction. For now, I need to use it when doing hit detection, but I shouldn’t rely on it for my own code.

I was thinking about the need for more complex animations and Actions for an individual sprite. For example, a sprite may have a standing animation. When you press the space bar, an attack animation should run, but I might not want it to loop over and over. Was I going to have to keep track of how many frames of animation there were for a given Action in order to make sure it doesn’t loop?

Nope! Turns out that Kyra’s KrSprite class has functions for determining the number of frames for an animation and for getting the current frame. Now I can do something like the following:

if ( theSprite->Frame() >= numFrames )
// then the ATTACKING animation is over and should change state

I also found that a sprite can clone itself. In my June GID, I had these fuzzy creatures multiplying, but I loaded in a resource from a file and created a sprite from the resource. I originally thought that I could optimize it by storing the resource to be used later, but I could further optimize by just using the Clone() function to create a new sprite. I could also use GetResource to get a pointer to the resource used by an existing sprite if I really needed it.

I want to work on some code to test what I’ve learned to see how well it works. I can get something substantial completed this week.

1 comment to Learning Kyra: Some Tidbits of Info

  • Kyra Game Framework
    I just found another game developer working on “alternative” platforms. Gianfranco Berardi is targeting Linux as well as Windows and has been writing about his learning the Kyra Game Framework.
    Kyra looks very interesting, unfortunately a…

Twitter: gbgames

  • RT : I've read so many bad takes on the CDPR crunch situation that I really need to address them. This is a thread, and my last ta…
  • RT : Soltaire fans: We teamed up with some other great solitaire devs on Steam and made this 5 game bundle which you can get for…
  • RT : Everyday I'm mad that we have a leader who has allowed and enabled the government to commit genocide* and am also mad tha…