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

The Archive Base Latest Questions

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

I want to draw multiple players on the client. It works fine without the

  • 0

I want to draw multiple players on the client. It works fine without the foreach rotations, but when i add the foreach rotations it updates both players with eachothers rotation instead of the player who the rotation is meant to be for.

foreach (var kvp in positions)
{
    foreach (var kvr in rotations)
    {
        // draw player
        spriteBatch.Draw(texture, kvp.Value, null, Color.White, 
        kvr.Value, new Vector2(texture.Width / 2, texture.Height / 2), 1f, 
        SpriteEffects.None, 1f);
    }
}

Each player has an unique ID which I store as key inside BOTH dictionaries.
Is there a way that i can combine these dictionaries to achieve the correct result?

Right now Dictonary positions contains (long,Vector2(x,y)) where long is the unique user ID
and the rotations contains (long, float) where long is the same user ID as in positions and float is the rotation.

Edit:
This works fine but doesn’t update the rotation as it’s set.

foreach (var kvp in positions)
{
    // draw player
    spriteBatch.Draw(texture, kvp.Value, null, Color.White, 1f, 
    new Vector2(texture.Width / 2, texture.Height / 2), 1f, 
    SpriteEffects.None, 1f);
}
  • 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-05T03:43:04+00:00Added an answer on June 5, 2026 at 3:43 am

    Is it not as simple as:

     foreach (var kvp in positions)
            {
                kvr = rotations[kvp.Key];
                // draw player
                spriteBatch.Draw(texture, kvp.Value, null, Color.White, 
                kvr.Value, new Vector2(texture.Width / 2, texture.Height / 2), 1f, 
                SpriteEffects.None, 1f);
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to draw multiple canvases on a single canvas using drawImage() method but
I want to draw multiple circles on a map, using the Google Maps API
I want to draw some text on the wallpaper and make it move, but
I want to set up multiple stencils in OpenGL and then draw into multiple
I want to draw multiple filled ellipses on/in some panel. Drawing single one isnt
I want to add multiple columns in UITableView. I have created one CustomeTableCell with
I want to Draw multiple line Graph with each line have different color and
i want to develop a windows application in c++ that could be draw multiple
I want to draw a polygon by connecting markers in googlemap.Time is associated with
I want to draw text over 3D point. The text request 2D points rect

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.