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 8294945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:24:46+00:00 2026-06-08T14:24:46+00:00

I’m using XNA and C#. I have a problem with calling a vector variable

  • 0

I’m using XNA and C#.

I have a problem with calling a vector variable from my particleEmitter. I can draw the particle just fine if it is static or not moving. And when I have a vector variable that is set to a fixed position of (x,y) it’s okay and draws on the screen. But if I have a vector variable that has been set to move in the x or y axis it does not draw at all.

Declared variables:

Vector2 shipPos;
float shipMovement;
ParticleEngine particleEngine;

And a method that loads stuff about what should happen with the vectors and the way it should behave:

public void loadEmitter(GameTime gameTime)
{
    shipMovement = 2f;
    shipPos.Y -= shipMovement;          
    particleEngine.EmitterLocation = new Vector2(shipPos.X,shipPos.Y);
}

I’m trying to get particleEngine to trail the movement of a ship. What I can’t seem to do is get it to draw when I set this up to happen.

Other info: ParticleEngine is a class in itself and basically sets some parameters about how the particles I will be drawing should behave. I have other screens with the spritebatch Begin and End calls. Other than that, here’s the code for my main class:

namespace PlanetDrill2
{
class LaunchScreen : Screen
{
    Texture2D LaunchScreenTexture;
    Texture2D shipLaunch;

    Vector2 shipPos;
    float shipMovement;
    ParticleEngine particleEngine;

    Vector2 smokePos;

    public LaunchScreen(Game game, SpriteBatch batch, ChangeScreen changeScreen)
        : base(game, batch, changeScreen)
    {            
    }

    protected override void SetupInputs()
    {
        base.SetupInputs();
    }

    public override void Activate()
    {
        base.Activate();
    }

    public void LaunchShip()
    {
    }

    public void loadEmitter(GameTime gameTime)
    {
        shipMovement = 2f;
        shipPos.Y -= shipMovement;        
        particleEngine.EmitterLocation = new Vector2(shipPos.X,shipPos.Y);
    }

    protected override void LoadScreenContent(ContentManager content)
    {
        LaunchScreenTexture = content.Load<Texture2D>("launchTest");
        shipLaunch = content.Load<Texture2D>("shipLaunch");

        List<Texture2D> textures = new List<Texture2D>();
        textures.Add(content.Load<Texture2D>("smoketexture"));
        particleEngine = new ParticleEngine(textures, new Vector2(0, 0));
        base.LoadScreenContent(content);
    }

    protected override void UpdateScreen(GameTime gameTime, DisplayOrientation screenOrientation)
    {
        //if (gameTime.TotalGameTime.Seconds>10)
        //{
        //    changeScreenDelegate(ScreenState.UMA);
        //}


        loadEmitter(gameTime);
        particleEngine.Update();
        base.UpdateScreen(gameTime, screenOrientation);
    }

    protected override void DrawScreen(SpriteBatch batch, DisplayOrientation screenOrientation)
    {
        batch.Draw(LaunchScreenTexture, Vector2.Zero, Color.White);
        batch.Draw(shipLaunch, new Vector2(80, 450) +shipPos, Color.White);
        particleEngine.Draw(batch);
        base.DrawScreen(batch, screenOrientation);
    }

    protected override void SaveScreenState()
    {
        base.SaveScreenState();
    }
} // end class LaunchScreen
} // end namespace PlanetDrill2
  • 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-08T14:24:48+00:00Added an answer on June 8, 2026 at 2:24 pm

    From here

    batch.Draw(shipLaunch, new Vector2(80, 450) +shipPos, Color.White);
    particleEngine.Draw(batch);
    

    It looks like you are drawing the ship relative to [80, 450], but you are not applying this offset to the particleEngine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I am currently running into a problem where an element is coming back from
I have thousands of HTML files to process using Groovy/Java and I need to
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a bunch of posts stored in text files formatted in yaml/textile (from

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.