I am first year games design student and for my end of year project me and my classmates have to create a side-scrolling 2D Game, we are very inexperienced with this software. One thing we are having difficulties is to add a background for our first level, the level 1 was created on Photoshop and we was wondering how do you implement it into the game.
The steps to take are the following:
- Add the texture to your content using the pipeline tool
- Load the texture in your game using
ContentManager.Load<Texture2D>("texture");
(no extension!) - Create a SpriteBatch object. This should already be done in every template MonoGame installs. Using SpriteBatch is the easiest way to draw 2D textures in MonoGame.
- In your Draw method, call
SpriteBatch.Begin
to begin drawing sprites, draw your sprite using one of theSpriteBatch.Draw
overloads and finish drawing by callingSpriteBatch.End
.
If run into any trouble or something is unclear, feel free to ask a more specific question
Thank you for the support! I will get back to you if any problems!
i need your help with monogame please as i have a big problem
Maybe you must describe your problem or create a new topic
The problem is that my version of visual studio does not allow me to āresolveā certain pieces of code⦠example would be āTexture2Dā has a red line underneath and the program does not allow me to fix this which does not allow me to add a background
i did create a new Topic so check it out pls xox
If you are getting a āred lineā underlying an object this most often means that you are missing the required library references that the object uses.
For Monogame objects you commonly require the following āusingā statementsā¦
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
To be able to use these statements your project must reference the āMonogame.Frameworkā dllā¦