Game maker sprite sheet tutorial




















If you select multiple files, they will be added as separate frames also called sub-images of the sprite and they should all be the same size for best results. If you wish to import a sprite strip or create a new image or set of image frames then you need to click on the Edit Image button to open the Image Editor.

We won't go into any details about the image editor as we have a tutorial on how to use it and all the tools are explained in the manual, but we will briefly explain how to add a sprite strip to create multiple sub-images - simply open the Image Editor, goto the Image menu and select Import From Strip , then select your image file to import. You will be shown options for how to split the sprite into frames before it is imported.

All sprites are stored on texture pages also known as texture atlases , so if you have 20 sprites in your game, they will all be placed on a single texture page. This is a standard optimisation for storing and using graphics, but it does mean that you need to set a couple of things up. Basically, sprites go onto a texture page with a certain number of pixels as padding around the edge.

This is done so that when scaling up or down to non-integer values the image uses the correct pixels, so an image that is to be tiled will have the edges horizontal or vertical added to by the edges from the opposite side, while if no tiling is selected the sprite will be clamped and the edges pixels will be repeated smeared. The following image illustrates this:. The option Separate Texture Page will add the sprite to a single texture page only for it in general you'd use this only with 3D or shaders , and you can also choose a specific Texture Group to have it assigned to see the manual for more details on these aspects of the sprite editor.

The last two texture options can generally be left unchecked, as they relate to certain visual artifacts that can show up when a sprite is added to a texture page. By selecting Pre-multiply Alpha you will be telling GameMaker Studio 2 to "fix" the semi-transparent pixels of your sprite by pre-multiplying it with the matte colour of the alpha channel before placing it on the texture page - this should only be enabled if you have issues when placing sprites with feathered or ant-aliasing edges into your game, and isn't guaranteed to fix these issues you may need to re-edit them in the sprite editor or some other image processing software.

As for Edge Filtering , this option is specifically for when you have linear interpolation enabled for your game and you are seeing "halos" of colour around your sprites. This is caused by the hardware interpolating from multiple source texels on the texture page all at once, and can be particularly obvious when you scale games up in resolution. Enabling this will filter the edge pixels to take on the colour of the nearest full alpha sprite pixel and so blend the interpolated pixels without the halo that was present previously.

If you've added an animated sprite, ie: one with a number of image frames, then you will see each frame of the animation shown in the Sprite editor, and you can click on any of them to select it to be shown in the main preview window. Above the preview and frames window you have buttons to Play the animation, loop or ping-pong the animation when previewing.

Beside these controls you can set the animation speed too. This value is based on the game frames a game frame is the time it takes to do one full game "loop" , so if you have, for example, a game fps frames per second of 60, and set the animation speed to 10, the animation will loop 6 times every second. Setting this value here will affect how the animation will look in the game, and is not just for preview purposes. It's worth noting that you can set the animation to run either using frames per second, or frames per game frame, so choose carefully which one you use as 15 frames per second is not the same as 15 frames per game frame!

In the middle of the editor you have a bar for defining the sprite origin and the collision mask we'll cover the collision mask in next page of the tutorial :. By default it is the top left corner of the sprite but it is often more convenient to use the center it, or you may want some other point on the sprite. To change it, you can set the origin manually by clicking in the sprite preview image which will move the origin cross indicated in the image above to the point you clicked, or you can input different values for x and y in the corresponding boxes.

For fixed placement and to make things easier there is a drop down menu with a number of preset positions that you can choose from:. Note that you can even set an origin outside the area of sprite by using negative numbers for left and up or positive numbers larger than the sprite width and height for right and down , which can be very useful when dealing with objects that need to be drawn with composite sprites.

The final thing to talk about in this tutorial is the ability to set the collision mask for a sprite. The collision mask is the area that GameMaker Studio 2 uses to calculate when two instances with sprites assigned are in collision or not and trigger a Collision Event.

For shame! Anyway, this update isn't about Christmas, that's not for another 2 months yet. At the same time, though, we bring you presents every week and month of the year I'm gonna have to re-evaluate my holiday traditions, here Should I tell you what's inside, though?

Ahh, what the heck. I've been good this year, so I can afford to cheat a little. It's hard to even pick out some Honorable Mentions that's what I'm calling the shout-outs from now on, patenting it Maybe a little bit of Castlevania?



0コメント

  • 1000 / 1000