2D character sprites

Hello everyone!

Finally I managed to make a working 2D sprite character, those like of old PSX video games like Xenogears, Final Fantasy Tactics and also like Ragnarok Online, between others.

So what does it do:
-basically you got your 2D character that can move on a 3D scene, but if you rotate the camera, the sprite will change simulating volume.
-npcs are working now, they move using a defined path using IPO or they can walk randomly using a python AI script, this must applied to the npc collision cube, and automatically the script will correctly understand with direction is the npc is facing and if it must trigger or not the walking animation based on the collision cube movements.

http://7341359744818482357-a-1802744773732722657-s-sites.googlegroups.com/site/bgeatelier/2d-sprite-sytem/2DSpriteCloudGL.gif?attredirects=0&auth=ANoY7cotmetqdt1EmxshPzSTNX0JAcZgcmru7FPCDrz0lJyJQLUmf-98Hq-uHQMby_0J-plMTfCr38VHMGBBYeXIVNaV0-FTX5bx6ZOQMvpfd6VkU9S3tdi2C--HYIqNYYPue9u2wG9CB0z_Tyc5wENE_ftlFydxxibKoTK_XAkRsQGZUj15k7h-c5mmxWcCiYa4cAxge7jiaD6yX15KOKg7Ms18FUB51rQv6ghQ9ZqsJv2i6nzkZUE%3D

http://lh4.ggpht.com/_4CponSgbSCo/SV64W_ACDhI/AAAAAAAAABY/yRlbuZ4HwNA/2DSpriteCloudGL.gif

It can be downloaded from here:

Piece of the code is based on the 5 on 1 tileset animation made by Doc Holiday.

This example is a bit harsh since I used only 4 direction (front, left, right and back).

In current version most bugs are solved, check out for version 5.

Keys:
arrows keys for movement
Control ad ALT key to rotate camera

Enjoy, it’s free to use but don’t forget to put me on the credits if used :smiley:

this is very cool! where’d you get the textures and stuff? i like them. it reminds me alot of Game Boy Advance/SNES games and their quest for “3D”. :stuck_out_tongue: wow, this is very awesome. tho maybe you could fix the whole moving tree thing. its like ghost or something. and that stair problem as well. but, still very cool!

edit: another bug… you can fly! when you walk up the steps, and off that ledge, the physics don’t push you down… and, maybe a jump function?

where’d you get the textures and stuff?

From google, look for “tileset”, normally related to RPGMaker stuff, some people has made some free to use ones.

tho maybe you could fix the whole moving tree thing. its like ghost or something. and that stair problem as well

The tree is mostly a decoration, but yeah I forgot to make it not-walkthrough ^^, but the stairs sliding is a bit more confusing to solve, if I use Dloc the character goes through walls and if I change the floor’s friction, it will hardly move using LinV…

another bug… you can fly!

HAHAHAHAHA, didn’t see that coming XD That’s a LinV problem, should be easy (?) to solve.

Thanks for the comment Zymn.

just had a thought. you could remake that Sonic Robo-Blast game or whatever. you know, that DOOM Sonic mod. :stuck_out_tongue: because, this is pretty much how it works… anyways, no prob, man. i can’t wait for more updates!

Thats awsome! I might try that out sometime. That would be cool to make a Final-Fantasy-Style RPG using that method. I might just look into that someday. I love drawing so that would be fun to make my own sprites. XD

Does this acctually have walking animations? Thats a whole lot of sprites (a walking animation from every angle)!

Looks solid- only 2 issues.
-First a small one: I recommend using a higher camera angle with that sprite, as it’s more of a top-down view of the person. Looks like they’re tilting toward the camera as it is.
-And a slightly larger bug: when I hit a direction, the sprite moves accordingly. When I let go, the idle image is facing the opposite direction it should be (if I walked away from the camera the idle is facing toward it, etc).

Other than that, it worked great. Keep up the good work : )

-And a slightly larger bug: when I hit a direction, the sprite moves accordingly. When I let go, the idle image is facing the opposite direction it should be (if I walked away from the camera the idle is facing toward it, etc).

Yeah, that one is getting on my nerves, it is caused by a math error if you check the console, but I’m sure there isn’t any math errors… Because of it, in some circunstances the script fails and on that frame facing positions bugs out.

-First a small one: I recommend using a higher camera angle with that sprite, as it’s more of a top-down view of the person. Looks like they’re tilting toward the camera as it is.

Haha, true :smiley:

Does this acctually have walking animations? Thats a whole lot of sprites (a walking animation from every angle)!

It sure has, it can walk, it uses 16 frames (4 direction x 4 frames walk) that texture is a 256x256 (but loads of space is unused because of the power of 2 sized texture… but thinking it well I could have used a 128x256 too…)

Haha! that’s awesome :smiley: great work man

I really like this expansion on Doc Holidays classic. It greatly expands the uses of animated tile textures.

I was thinking- Blender now has the ablility to give each mesh multiple UV’s
If you could find a way to control two UV’s of the same mesh separately with Tile Tex
then you could do some great effects.

For example: In your first UV set you have your sripte’s walk cycles and so on.
In the second UV set you could have FX cycles like splashes, flashes, ect.
This way you could trigger your FX sprites on the same mesh on any action and it would blend perfect, without the need to spawn new object sprites or draw extra walk and jump cycles with the effects in them. You see what I mean?

In any case, this implementation is awesome.

Great!

I’m proud of you.

Looks cute!
Nice work!

Nice … .

looks nice! (though you might want to use a different type of force other than linV, because it causes you to float!)

I made one these a while ago, and actually managed to find it. I was inspired by Myth II…
http://www.mediafire.com/?sharekey=a76e45249cf7932691b20cc0d07ba4d220e3adbb5b73b3bd

maybe I’ll go back in and clean it up, since I used a lot of logic bricks.

It looks amazing ! I can’t download it now, but will try in a few days… Does it use a lot of resources? Could it be a way to use as less polygons as possible for small objects?

Does it use a lot of resources?

Actually it uses a plane for the character, plus a box to make collitions (and another plane for the shadow). Assuming that you don’t need collition nor shadow it would be 1 quad. I don’t think the script is too heavy, got to test it with loads of 2D character on screen XD

I was thinking- Blender now has the ablility to give each mesh multiple UV’s
If you could find a way to control two UV’s of the same mesh separately with Tile Tex
then you could do some great effects.

Yeah that actually sounds interesting, but I would leave it mostly to change details on the sprites, like diferent weapons on the hand, and leave the special effects separated so they can be made as particles or even on real 3D :smiley:

And to everyone else thanks, later I’m uploading a bug fixed and optimized version.

Hello everyone interested, there’s a new version of this, it’s the test number 4.
Changelog:
-changed the movement from logicbricks to python script, doing this gravity got solved (Yay) and we got diagonal movement! Also it stops sliding away from the stairs ^^
-new version of the angle script, angle3, is optimized and there is no need for a aditional dummy object anymore
-added a bridge and a floating cube with uses friction to stop the character from falling
-removed GLSL scene and the old versions of the script
-some improvement on graphics

To-do:
-testing NPCs (i think it should work easily)
-try making the character do a trick (using another charset so it blinks or waves the hands, something like that)

Very cool stuff. One thing I noticed was that if you’re holding up or down then hit left or right, the sprite changes to a diagonal facing. However, while holding left or right, and then hitting up or down, the sprite doesn’t change, so it looks odd. Also, the trees look a little strange since they are rotating to follow the camera, but I can’t think of a way to make it less noticeable.

Again, very cool stuff :wink:

One thing I noticed was that if you’re holding up or down then hit left or right, the sprite changes to a diagonal facing. However, while holding left or right, and then hitting up or down, the sprite doesn’t change, so it looks odd.

Mmmm… yeah I know what you mean, but it’s a hardware issue, it comes by the way the keys of the keyboard are detected by the computer.

By the way I made a new Version, NPCs are done and working!!

Check out the version 5of this test!!

ChangeLog:

-Made npc versions of both “angle” and “CGLHoliday” script
-both scripts are robust enough to detect automatically the orientation and, if in movement, animation of the NPCs
-to make the npc move so everything works, you got to take the collision cube of the NPC, only that, and give it an IPO animation (on axis X and Y only unless you want it to fly :P) or giving it an AI that makes it walk randomly through space.
-the only important note is that the NPC SHALL NOT ROTATE, only translate, the rotation will screw up the npc automatic orientation.

Nice ( and smooth) sprites movements!
But if you press, for ex. " up" and “right” arrow keys at the same time, the sprite moves in diagonal direction?!
Is this the “good” behavior?
Keep blending!
Bye

But if you press, for ex. " up" and “right” arrow keys at the same time, the sprite moves in diagonal direction?!
Is this the “good” behavior?

Yeah, that is the idea, the first version was orthogonal only, and I didn’t like that result.
Besides, this kind of system are better looking when you have a charset with diagonals, but I didn’t got one so I worked with 4 only :smiley: