Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8086491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:28:01+00:00 2026-06-05T18:28:01+00:00

I have a cloud and a man sprite, these are both drawn separately but

  • 0

I have a cloud and a man sprite, these are both drawn separately but for some reason they are drawing together and overlapping and then positioning themselves at the defined places for both of the sprites.

My sprites class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace MarioFake
{
class Sprites
{

    public Vector2 MarioPosition = new Vector2(200, 200);
    private Texture2D MarioStill;

    public Vector2 LargeCloudPosition = new Vector2(100, 100);
    private Texture2D LargeCloud;

    public void LoadContent(ContentManager theContentManager, string theAssetName)
    {
        MarioStill = theContentManager.Load<Texture2D>(theAssetName);
        LargeCloud = theContentManager.Load<Texture2D>(theAssetName);
    }

    public void Draw(SpriteBatch theSpriteBatch)
    {
        theSpriteBatch.Draw(MarioStill, MarioPosition, Color.White);
        theSpriteBatch.Draw(LargeCloud, LargeCloudPosition, Color.White);
    }

}
}

and my drawing method in my Game class:

    protected override void Draw(GameTime gameTime)
    {
        graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();

        MarioStill.Draw(this.spriteBatch);
        LargeCloud.Draw(this.spriteBatch);

        spriteBatch.End();

        base.Draw(gameTime);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T18:28:04+00:00Added an answer on June 5, 2026 at 6:28 pm

    The sprite class doesn’t need to hold information for both Mario and the cloud, if you create a generic sprite class like this ..

      public class Sprite
        {
            public Vector2 Location;
            public Texture2D Texture;
    
            public void Draw(SpriteBatch spriteBatch)
            {
                spriteBatch.Draw(Texture, Location, Color.White);
            }
        }
    

    you can create your mario and clouds like this.

    Sprite Mario = new Sprite() { Location = new Vector2(200, 200), Texture = Content.Load<Texture2D>("MarioTexture") };
    Sprite Cloud = new Sprite() { Location = new Vector2(100, 100), Texture = Content.Load<Texture2D>("CloudTexture") };
    

    and draw them as you previously did.

                Mario.Draw(spriteBatch);
                Cloud.Draw(spriteBatch);
    

    Here is an example of a full game class that demonstrates loading and rendering both sprites.

     public class Sprite
        {
            public Vector2 Location;
            public Texture2D Texture;
    
            public void Draw(SpriteBatch spriteBatch)
            {
                spriteBatch.Draw(Texture, Location, Color.White);
            }
        }
    
        public class Game1 : Microsoft.Xna.Framework.Game
        {
            GraphicsDeviceManager graphics;
            SpriteBatch spriteBatch;
    
            List<Sprite> sprites;
    
            Sprite mario, cloud;
    
            public Game1()
            {
                graphics = new GraphicsDeviceManager(this);
                Content.RootDirectory = "Content";
            }
    
            protected override void LoadContent()
            {
                spriteBatch = new SpriteBatch(GraphicsDevice);
    
                // Create the sprites.            
                sprites = new List<Sprite>();
                mario = new Sprite() { Location = new Vector2(100, 100), Texture = Content.Load<Texture2D>("MarioTexture") };
                cloud = new Sprite() { Location = new Vector2(200, 200), Texture = Content.Load<Texture2D>("CloudTexture") };
                sprites.Add(mario);
                sprites.Add(cloud);
            }
    
            protected override void Draw(GameTime gameTime)
            {
                GraphicsDevice.Clear(Color.CornflowerBlue);
    
                spriteBatch.Begin();
                foreach (var sprite in sprites)
                    sprite.Draw(spriteBatch);
                spriteBatch.End();
    
                base.Draw(gameTime);
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have some video files on Rackspace Cloud Files but since I use
I have a problem with Google Cloud Print. It works perfectly, but it's a
I have a web service which queries the cloud for some data and then
I have seen on our cloud servers, there is some text printed on the
I have a LAMP server with 256MB RAM (poor man's server in cloud). I
I have a cloud point obtained from photogrammetry from a person's back. I'm trying
I have mysql DB on cloud linux server. I am able to connect db
I have a problem in a cloud server Fedora 16 x64. I've installed PostgreSQL
I have been reading up on Cloud computing on here and still not getting
I have a series of Rackspace Cloud Files CDN URLs stored which reference an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.