Sprites

2D Sprites

A sprite is a two-dimensional image which is used to represent an object within a game. These sprites are normally part of a larger image and from within code the image that's needed can be pulled out. In many cases a sprite will be animated from whats called a sprite sheet. This sprite sheet with have the different poses for say a walk cycle. The developer will then in code have a source rectangle that will encompass the 1st image and then if the player walks right or left the rectangle will then move to the next image in the walk cycle.


Sprites are normally used to display a character or animated object they also help the coder to have many objects on screen at the same time to save memory. This is achieved by creating a class of the object say we have a ship sprite and this ship needs to shoot some photon cannons it would be a bit boring if we could only shoot one and it would be very inefficient if we loaded a new projectile every time we pressed the fire button. So we created the class of photon cannon and in the class we can have properties to define some characteristics like width and height and whether its left the screen. We check weather its left the screen because even if its off screen the object is still taking memory so we can have a bool data type called isAlive and then switch it to false.

Lets look at some examples of sprite sheets and a screen shot of the games they relate to. This one is Akuma from Street Fighter. As you can see Akuma is in the middle of his dragon punch you can see the frames of this on the forth line down of the sprite sheet and the fifth image along from the left.




Here is Sonic Advance 2 as you can see the sheets can get very big and complicated. It also get very easy to get lost where the animations start and finish.













Isometric in reference to computer graphics is when an image is rotated slightly to reveal other facets and giving the impression of been 3D. Isometric is mistakenly used as it is really a diametric projection but for the sake of keeping in line I will stick to the term Isometric.

Isometric sprites and game environments were commonly used because the computer had to do less calculations due to the fact that parallel projected objects do not change size as they move about.

An isometric cubeIsometric tiles or images are squares that are rotated a little, If we have an isometric cube the angle between each point is 120° this is just a basic look at an isometric cube and the maths involved is out of the scope of this article.




Isometric graphics have been around since around 1982 with Sega's Zaxxon, Zaxxon was an isometric shooter that was released to the arcade. Zaxxon was also one of the first games to use shadows so it was really cutting edge.









Another game that was popular in the 80's was Q'bert, It had a pyramid constructed from isometric cubes. The player had to navigate around the pyramid this was also released in 1982, So as you can see isometric graphics has been around for a very long time and is still used today.

Today's isometric games are usually used on handheld consoles because of the fact the developer can make game levels and object look 3D without using lots of processing power.





As you can see games that run on machines with grater power than a console also use these sort of graphics. Take Sim City 4 it looks fantastic an was played on the PC and was released in 2003 and used good use of isometric graphics.





Last but not least we had Diablo which was a massive game made by Blizzard in the late 90's, I had fantastic graphics and game play for it time. As with all the games listed here it looks 3D but in fact the sprites and the levels were 2D.




Textures

Textures are used to give the a virtual 3d object the visual aperiance of being real, These textures are normaly photographic images of materials to give the best results. 2d and 3d textures both use UV coords, 3d texture coords are (0-1, 0-1, 0-1).

You can make a texture yourself by taking a photograph of concreate, tarmac or even a dishcloth, sometimes effects are made with canvas and paint, then photographed to use in Photoshop.