|
1 |
| -# MonoGame.Aseprite |
| 1 | + |
2 | 2 |
|
3 |
| -MonoGame.Aseprite is an extension for [MonoGame Framework](http://www.monogame.net) to import the .json file produced by [Aseprite](http://www.aseprite.org) using the content pipeline, with a collection of classes to support rending the animation. |
| 3 | +# MonoGame.Aseprite |
| 4 | +MonoGame.Aseprite is an extension for the [MonoGame Framework](https://www.monogame.net) that allows you to import [Aseprite](https://www.aseprite.org) \*.ase/\*.aseprite files into your game project using the MGCB Editor (also known as the Content Pipeline Tool). |
4 | 5 |
|
| 6 | +No need to export a sprite sheet from Aseprite and have to deal with a PNG image file and a JSON file. With MonoGame.Aseprite the import process takes the single Aseprite file and generates a `AsepriteDocument` object, containing a `Texture2D` generated sprite sheet and all the data you need to animate those sweet pixels in game. |
5 | 7 |
|
6 |
| - |
| 8 | +MonoGame.Aseprite also provides an out-of-the-box AnimatedSprite class that can be used with the imported `AsepriteDocument` to get you started quickly if you prefer this as well. |
7 | 9 |
|
8 | 10 | ## Getting Started
|
9 |
| -MonoGame.Aseprite is distributed via NuGet as a NuGet package. It can be installed inot your existing MonOGame project using NuGet Package Manger in Visual Studio. You can also use the following commands to install it. |
10 |
| - |
11 |
| -**Package Manager** |
12 |
| -```PM> Install-Package MonoGame.Aseprite -Version 1.2.2 ``` |
13 |
| - |
14 |
| -**.Net CLI** |
15 |
| -```> dotnet add package MonoGame.Aseprite --version 1.2.2 ``` |
16 |
| - |
17 |
| - |
18 |
| -Once you've added the NuGet package, you'll also need to add a reference to **MonoGame.Aseprite.ContentPipeline.dll** in the Content Pipeline Tool. The location of this file after downloading the NuGet package is dependent on which version of MonoGame you are using. Please refer to the following [wiki page](https://github.com/manbeardgames/monogame-aseprite/wiki/downloading-and-adding-references) for information on doing this. |
19 |
| - |
20 |
| - |
21 |
| -## Usage |
22 |
| -The following is a brief explination of how to use this in your MonoGame project. |
23 |
| -[**For a more detailed explination, including images, please check the wiki**](https://github.com/manbeardgames/monogame-aseprite/wiki) |
24 |
| - |
25 |
| -* Export your spritesheet from Aseprite |
26 |
| - * Select Array for meta information not Hash |
27 |
| - * Frame Tags must be checked |
28 |
| - * Slices must be checked |
29 |
| - * Trim and Padding is currently not supported. These must be unchecked. |
30 |
| -* Add the exported spritesheet and associated .json file from Aseprite to your project using the MonoGame Pipeline Tool |
31 |
| - * The spritesheet can be imported normally using the Texture importer and processor |
32 |
| - * For the .json file, use the Aseprite Animation Importer and the Aseprite Animation Processor |
33 |
| -* Create a new AnimatedSprite object using the spritesheet and the animation definition. |
34 |
| - * The animation defintion is loaded in your game using the content manger. It loads the .json file you imported. |
35 |
| - |
36 |
| - ```csharp |
37 |
| - // Be sure to add the using statement at the top |
38 |
| - using MonoGame.Aseprite; |
39 |
| - |
40 |
| - ... |
41 |
| - |
42 |
| - // Load the .json file |
43 |
| - AnimationDefinition animationDefinition = content.Load<AnimationDefinition>("animationDefinition"); |
44 |
| - |
45 |
| - // Load the sprite sheet |
46 |
| - Texture2D spritesheet = content.load<Texture2D>("spritesheet"); |
47 |
| - |
48 |
| - // Create the AnimatedSprite based on the animation definition and the sprite sheet |
49 |
| - AnimatedSprite animatedSprite = new AnimatedSprite(spriteSheet, animationDefinition); |
50 |
| - ``` |
| 11 | +MonoGame.Aseprite is distributed via NuGet as a NuGet package. It can be installed into your existing MonoGame game project using NuGet Package Manger in Visual Studio. |
| 12 | + |
| 13 | +For **MonoGame 3.7.1** (.NET Framework >= 4.5) users, please refer to the [installation documentation here](https://manbeardgames.com/monogame-aseprite/getting-started/monogame37installation). |
| 14 | + |
| 15 | +For **MonoGame 3.8** (.NET Core) users, please refer to the [installation documentation here](https://manbeardgames.com/monogame-aseprite/getting-started/monogame38installation). |
| 16 | + |
| 17 | +## Example Usage |
| 18 | +The following is a quick example of using MonoGame.Aseprite in your game. |
| 19 | + |
| 20 | +**Add Using Statements** |
| 21 | +```csharp |
| 22 | +// Add using statements |
| 23 | +using MonoGame.Aseprite.Documents; |
| 24 | +using MonoGame.Aseprite.Graphics; |
| 25 | +``` |
| 26 | + |
| 27 | +**Load the Content** |
| 28 | +```csharp |
| 29 | +// Load the AsepriteDocument |
| 30 | +AsepriteDocument aseDoc = Content.Load<AsepriteDocument>("myAseFile"); |
| 31 | + |
| 32 | +// Create a new AnimatedSprite from the document |
| 33 | +AnimatedSprite sprite = new AnimatedSprite(aseDoc); |
| 34 | + |
| 35 | +``` |
| 36 | + |
| 37 | +**Update the AnimatedSprite Instance** |
| 38 | +```csharp |
| 39 | +sprite.Update(gameTime); |
| 40 | +``` |
| 41 | + |
| 42 | +**Drawing the AnimatedSprite** |
| 43 | +```csharp |
| 44 | +sprite.Render(spriteBatch); |
| 45 | +``` |
| 46 | + |
51 | 47 |
|
52 | 48 | ## What Next?
|
53 |
| -* Check out the [wiki](https://github.com/manbeardgames/monogame-aseprite/wiki) |
54 |
| -* Read about [using slices](https://github.com/manbeardgames/monogame-aseprite/wiki/using-slices-from-aseprite) if you plan to do that |
55 |
| -* Submit an [issue on GitHub](https://github.com/manbeardgames/monogame-aseprite/issues) |
56 |
| -* Hit me up on [Twitter @manbeardgames](https://www.twitter.com/manbeardgames) if you have questions |
| 49 | +* Read the [documentation](https://manbeardgames.com/monogame-aseprite). |
| 50 | +* Join the [Discord](https://discord.gg/8jFvHhuMJU) to ask questions or keep up to date. |
| 51 | +* Submit an [issue on GitHub](https://github.com/manbeardgames/monogame-aseprite/issues). |
| 52 | +* Follow me on [Twitter @manbeardgames](https://www.twitter.com/manbeardgames). |
| 53 | + |
| 54 | +## Patreon Support |
| 55 | +[](https://www.patreon.com/manbeardgames) |
| 56 | +If you would like, you can support me and this project on Patreon by clicking the image above. Thank you to all who support. |
| 57 | + |
| 58 | + |
57 | 59 |
|
58 | 60 |
|
59 | 61 |
|
60 | 62 | ## License
|
61 |
| -Copyright(c) 2018 Chris Whitley |
| 63 | +Copyright(c) 2020 Chris Whitley |
62 | 64 |
|
63 | 65 | Permission is hereby granted, free of charge, to any person obtaining a copy
|
64 | 66 | of this software and associated documentation files (the "Software"), to deal
|
|
0 commit comments