Thursday, July 24, 2014

Information on .XNA 4.0 Sprite Sheets

NTOE This is more like notes to myself, and for anyone else who may be interested.  This will be technical and dry, but useful for studnets.

 ADDITIONAL NOTE I mention Animation class (Animation.cs) fairly often.  I didn't want to discuss all of that here.  I will put up my code for the Animation class and go through it.  I might not make sense until I put up the main game.cs as well.  But there are many .xna tutorials for creating animations on the web.  Please Google those tutorials if you need the help.  I just wnated this to focus on building graphics.  Even if you are an artist an not a programmer, this will hep you understand what a programmer needs so all you'll have to do is hand them your art work. ;)  I can put a list of resources for people wanting to learn how to program. 

SPRITE SHEETS

The max size of an .xna sprite sheet is the standard 2048 x 2048.  (Which seems small to me, at least for world maps and things).  I don't think there is really a minimum size for your sprite sheet.

These sheets generally should be saved as .png or tiff (for 3-D)

The best way to move through a sprite sheet is through an Animation class built in the .xna game itself.  You can create a class that is designed to play certain animations and or move to a new sheet for really long 30 fps (frames per second) games.  Most Windows Phone games run at 12, anything more is simply a waste because the phone cpu cannot handle it.  But that means for a 'pretty' cell phone game, all you needs is 12 frames... as opposed to say StreetFighter4's 60 fps.  Most .xna games run at 30-32 fps.  So if you divide 2048/32 is roughly the size you can make your graphics for ONE row of a spritesheet.  (This also happens to equate to 32 frames for a single row)  Or a spritesheet that is 32 x 2048.  A loooong skinny rectangle sprite sheet.  (This could simplify things for people wanting to build a simple animation class.

You can make your Animation class run though an array that can take the entire sheet, 2048/32 * 2048/32.  So one sheet row can hold  a single frame of 64 x 64 pixels.  If we stick to this formula, it will make hit boxes, programming and our animation class very simple to make.

One graphic at 64x64 pixels :  I drew the border so you can see it, the graphic below doesn't have a border because .xna would show it in the game. 

For my particular game and Aimation class
 I'm using this formula.
A graphic i made for my test game at 32 x 64:   saved a .png with transparency.
This has a simple two frame animation that uses an animation class I made for my game.
I could easily expand this to 32 x ; 96(three frames), 32 x 128 (four frames), 32 x 160 (five frames) etc...

If I really want to be fancy, i can create a graphic 64 x 64  of a player character or a boss:
Example: 64x64(one frame); for the blink 64 x 128 (second frame)
It's a failry easy process.  And because it's a multiple of 32 (32x2 = 64) it makes all of the previous math and Animation class (and eventually your hit detection and collision etc...) should fit fairly easy.

If anyone else has more reosurces/information or details e-mail me or post in the comments and I'll add it to this post :)


I am currently building mini games ...

...for my 'pocalypse pony.

Due to some advice and being a gamer myself, I decided to add a few random things to break up all of the shooting.
I had two ideas:

One is a simple pong like game.  It involves a spike paddle and a babyhead as a ball.  I want the backgournds to be happy and rainbowy as the head smashes through glass and stuff!  I imagine it'd be a secondary game itslef, or could be played for points and lives and power-ups.

Two  I want to create a button mash mini game, where 1-4 players vs computer(?) are powering up there Pocalypse pony and the winner would get points, lives etc and a rewarding cut scene of their character shooting a beam of energy into a city annihilating it!  What do you think?  I want to add pics as I complete these.  The sad things is that they may not make it into the final product, but at least i am learning and would have a few games to use for my portfolio!

*Hint hint* http://onikage123456.wix.com/gamedesignerbilly#!-3dwork/ckljMy wix portfolio page
Also, I wnat to upload some sketches and spritesheets that I am slowly working on.

My new web page:  --NA atm --

Remember FAIL HARD, FAIL OFTEN!

This might be considered Three; but, I do want to attempt one of the old school pseudo-3d levels.  (I'm trying to keep it traditional 2-D art style even though .xna is really a 3-D program).

Thursday, June 12, 2014

Hello!

I am trying to get back into blogging and art, and I feel that this is a great way to motivate myself and let people see the inside mind of a slacker, illustrator, gamer extraordinaire! 

I have been creating games with 4.0 .XNA for awhile and I am working on two atm (which isn't such a bad idea).  If you get stressed or run into a hurddle, it sometimes easier to focus on a different sitation.  And sometimes working on the other, you cna find a solution for your other game.  It's like painting, it's nice to have a couple going at once.  (Also gives you something to do while the damn oil dries!)

I would like to upload pics of my work and source code and create blogs when I become stumped.  And share the adventure along the way, (also this will keep my source code //much much, cleaner)

The Key to success is to FAIL many, many many times!

Alos, I tend to abuse ()'s alot.  I'm not the greatest writer :)

And if anyone has heard anything about xbox one and if they are going to revive/change .xna please let me know.  Thank You!