1
I’m trying to insert a PNG image in my game, but I’m not getting it, the image is in Content/alien.png
, with the code below:
Texture2D alien;
.
.
.
protected override void LoadContent ()
{
spriteBatch = new SpriteBatch (GraphicsDevice);
Content.RootDirectory = "Content";
alien = Content.Load<Texture2D>(@"alien");
}
When I run the game, the error message appears:
Microsoft.Xna.Framework.Content.Contentloadexception: Could not load alien Asset as a non-content file! ---> Microsoft.Xna.Framework.Content.Contentloadexception: The directory was not found. ---> System.IO.Directorynotfoundexception: Could not find a part of the path "/home/Leonardo/Documentos/Mono/Maisum/Maisum/bin/Debug/Content/alien.xnb". At System.IO.Filestream.. ctor (System.String path, System.IO.Filemode mode, System.IO.Fileaccess access, System.IO.Fileshare share, System.Int32 bufferSize, System.Boolean Anonymous, System.IO.Fileoptions options) [0x001cf] in :0 at System.IO.Filestream.. ctor (System.String path, System.IO.Filemode, System.IO.Fileaccess access, System.IO.Fileshare share) [0x00000] in :0 at at (wrapper remoting-invoke-with-check) System.IO.Filestream:. ctor (string,System.IO.Filemode,System.IO.Fileaccess,System.IO.Fileshare)
At System.IO.File.Openread (System.String path) [0x00000] in :0 at Microsoft.Xna.Framework.TitleContainer.Openstream (System.String name) [0x00029] in :0 at Microsoft.Xna.Framework.Content.Contentmanager.Openstream (System.String assetName) [0x0002e] in :0 --- End of Inner Exception stack trace --- at Microsoft.Xna.Framework.Content.Contentmanager.Openstream (System.String assetName) [0x00053] in :0 at Microsoft.Xna.Framework.Content.Contentmanager.Readasset[T] (System.String assetName, System.Action1[T] recordDisposableObject) [0x00073] in <c33f6c525d914593acc9b590397e7c2b>:0 --- End of inner exception stack trace --- at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T] (System.String assetName, System.Action
1[T] recordDisposableObject) [0x0012b] in :0 at Microsoft.Xna.Framework.Content.Contentmanager.Load[T] (System.String assetName) [0x00068] in :0 at Game1.Loadcontent () [0x0002e] in /home/Press release/Documents/Mono/Maisum/Maisum/Game1.Cs:46 at Microsoft.Xna.Framework.Game.Initialize () [0x0004d] in :0 at Maisum.Game1.Initialize () [0x00002] in /home/Leonardo/Documentos/Mono/Maisum/Maisum/Game1.Cs:35 At Microsoft.Xna.Framework.Game.Doinitialize () [0x00011] in :0 at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.Gamerunbehavior runBehavior) [0x00033] in :0 at Microsoft.Xna.Framework.Game.Run () [0x0000c] in :0 at Maisum.Program.Rungame () [0x00010] in /home/Press release/Documents/Mono/Maisum/Maisum/Program.Cs:31 at Maisum.Program.Main (System.String[] args) [0x00001] in /home/Press release/Documents/Mono/Maisum/Maisum/Program.Cs:55
Probably and error is because it expects a file . xnb, but I have only one . png, because on Linux I did not find a way to convert. Could someone help me?
Information: Linux Elementary OS Freya Monodevelop 5.10 Monogamy