Search Results

Saturday, February 18, 2012

Video Tutorial - 2D Sprites in the BGE

Hey. So, someone from the BlenderArtists forum requested that I make a tutorial about implementing 2D sprites in the BGE, which I did yesterday.


14 comments:

  1. Hi SolarLune, I just follow your tutorial
    but terminal gives me a error every frame:

    ValueError: gameOb.replaceMesh(value): KX_GameObject, requested name "PlayerSmile1" did not match any KX_MeshProxy in this scene

    Any step is wrong or...?
    BTW, I am running Blender 2.62 on a intel Mac.

    ReplyDelete
    Replies
    1. Well, a first guess is that there's no mesh named 'PlayerSmile1' in your scene (on a hidden, or active layer). You might want to make all sprites, put them in a group, and simply add a group instance of them all into each game scene. It's easier than trying to figure out which sprites you might have missed, and allows you to organize your sprites easier (across different scenes and layers, for example).

      Delete
    2. By the way, by 'mesh', I mean the actual mesh - not the object itself. Make sure the >mesh< of a player smile sprite frame is named 'PlayerSmile1', for example.

      Delete
    3. Thanks, now it works.

      The truth, I am new to Blender
      and mixed what object is and what mesh is.

      Your work is really cool, and I like "Soldier".
      I will try to build one like that, :D

      Delete
  2. This is exactly the sort of tutorial I needed. Thanks! I am also new to blender, but I'm excited by the plethora of uses for it (game development and design for rapid-prototyping, in particular); plus, I'm beginning to learn some python, so BGE is somewhat of a godsend, having sought to break into game development for some time now.

    I had a quick question about how my sprite renders. Though I've untoggled mipmaps, the resolution of my sprite is severely diminished in 3d view, but it looks normal in UV mapping: https://picasaweb.google.com/lh/photo/0BGA94obE2zkgDNC6YhizrVW0DEaEXHmW_EwbO5ZCUY?feat=directlink (not my design, by the way)
    I thought it had something to do with scaling in 3d view, but it seems to render the same way at any scale.

    Thanks in advance, and keep the tutorials coming!

    ReplyDelete
    Replies
    1. Thanks for thanking me. :) The problem you're experiencing is due to the fact that the texture is not sized to a power of 2. If it's not sized to a power of 2 (i.e. 128x128, 256x256x 512x256, etc.), Blender will interpolate it oddly. I believe that you can have rectangular sheets, but the width and height sizes should still be powers-of-two.

      Delete
    2. Thanks for that. It looks like I should have dug a bit deeper though: http://blenderartists.org/forum/showthread.php?227805-Mini-Tutorial-About-Pixel-Perfect-Sprites-in-the-BGE

      Seems you've got it all pretty well covered.

      Delete
  3. hey solarlune i cant find were the sprites module is could you please help me

    ReplyDelete
    Replies
    1. Sure. At the top, there's a section named "BGE Resources". In that small list, there's a "2D Sprites" entry. Click on that to find the latest entry at the top (there's only one there currently, which is the latest verrsion).

      Here's a direct link, as well:

      http://solarlune-gameup.blogspot.com/2012/01/2d-sprites-v182.html

      Delete
  4. I can't seem to get it to work. I followed the tutorial exactly and have even tried using the same object and mesh names.
    I don't get any errors and when I used the 'print' function, it was able to find the object, yet I can't get it to animate?

    ReplyDelete
    Replies
    1. Odd. Are you running the script continuously (with the true pulse setting in the Always sensor on)?

      Delete
    2. true pulse seemed to help, looks like the script is actually running now ^^"

      had a couple other errors but I've figured them out now!

      4 years using blender but the game engine in it still completely throws me...

      Thanks for all your help and your games and tutorials are fantasmic.
      best BGE tutorials I've found.
      keep doing what you're doing ^^

      (PS. I miss Sparky :3 what happened to that kooky, radioactive pup?)

      Delete
  5. hiii.
    Ur tutorials are very impressive.
    I have a man character which have armature.Can u tel me the script so that i can move my character...

    ReplyDelete
  6. My sprite is shrinking when the animation plays...any reason for this?

    ReplyDelete