This tutorial we will discuss in detail the steps to make sprite sheets. Actually we have discussed the sprite sheet at the previous tutorials. What is meant by the sprite sheet is a collection of images from one image file. For example, in the previous tutorial, we give you the support files, one of the contents of that file named sprites.png, on file, there are many images that we can choose freely, and we put on our game application window, and it is purpose of the sprite sheet.
Actually, you can already use it, consider again our previous post, it's just that we need to do to be easy for us in making a game, the key for the sprite sheet are on srcX, srcY, widht, height on drawfiles function. As we have described in our post Basic Programming In SDL, the key in making sprite sheets is SDL_Rect. You can just give detemine the position of each image for drawfiles, and that's it.
Now you have successfully created a sprite sheet. Easy right? Why it easy, because we have give to you a general function for drawfiles, so that you can use that function for sprite sheet.
For best performance, you should write to canon1 drawfiles first, then later for the bazooka. This means canon1 will be drawn first and then bazooka. In the next tutorial we'll rotate canon1, if we draw a bazooka first, then the result is less good. If you want to get a script for this tutorial, please download the script sprite sheets here.
For best performance, you should write to canon1 drawfiles first, then later for the bazooka. This means canon1 will be drawn first and then bazooka. In the next tutorial we'll rotate canon1, if we draw a bazooka first, then the result is less good. If you want to get a script for this tutorial, please download the script sprite sheets here.
Post a Comment