Image manipulation & Kyra

  • Wojtek Dabrowski


    I have some sprites and some textures. now I need to put the textures on the sprites, but so that they are only visible in certain places, where the sprite has a special color.

    Any ideas how this might be possible? If it can't be done with Kyra by combining sprites, is there a way to intercept the sprites between them being loaded and them getting into the vault, to do some processing? Or would I have to mess around with Kyra's code to do this kind of thing?

    Thanks a lot in advance,

    • Lee Thomason

      Lee Thomason - 2006-01-06

      Wojtek --

      I'm not exactly sure what you mean...what do you mean by texturing a sprite? could you give a specific example?


    • Gianfranco Berardi

      I think the idea is that you have an image that would only draw over certain areas of the sprite.  So if the sprite had a line of blue, and you wanted to draw a solid green texture on top of the sprite, the only part that is changed is the blue line, which is now green.

      Obviously if you have more complex textures, you can make more interesting "skins" for your sprite.  Is that about right, Wojtek, or did I misunderstand?

    • Lee Thomason

      Lee Thomason - 2006-01-10

      GB & Wojtek --

      Ah, that makes sense. I've run into that scenario myself. Kyra can't do skinning in the style you ask about, but you do have some options.

      To give a specific example, lets talk about a fighter plane - a basic aluminum fighter that you want to have a variety of decals on. (The same technique applies to clothing and weapons for animated characters.)

      The first thing you need to do is split the fighter plane into 2 images - the fighter and the decal - and load that as 2 sprites. The decal will be a child KrSprite of the plane. That way it draws on top, and when you animate the plane the decal is automatically dragged along for the ride.

      Option #1: Colorizing. Without changing the decal sprite at all, you can change its color using KrImNode::SetColor(). If you just need different teams this may be sufficient.

      Option #2: Decaling. If you need truly different decals, then you can create more source art in different colors and textures. The existing child decal can be deleted and replaced with a new one, to change the look at any time.

      hope that helps,


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks