Search Results

Search found 22794 results on 912 pages for 'xna content pipeline'.

Page 16/912 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • XNA VertexBuffer.SetData performance suggestions

    - by CodeSpeaker
    I have a 3d world in a grid layout where each grid cell contains its separate vertex and index buffer for the mesh/terrain of that cell. When the player moves outside the boundaries of his cell, i dynamically load more cells in his walking direction based on his viewing distance. This triggers x number of vertex and indexbuffer initializations depending on how many cells that needs to be generated and causes the framerate to drop annoyingly during this time. The generation of terrain data is handled in a separate thread and runs smoothly. The vertex and index buffers are added during the update cycle of the game loop. I´ve tried batching the number of cells to be processed to avoid sending too much data at once into the buffers, which worked ok at a shorter viewing distance (about 9 cells to process), but not as well at greater distances with around 30 cells to process. Any idea how i can optimize this?

    Read the article

  • XNA - positioning after rotation

    - by DijkeMark
    I have a turret with a 2 gunbarrels. The turret rotates towards my mouse. So far no problem. When it creates a few bullets and positions them at the end of the gun barrels. Here is the problem. It only works the moment the gun is point upwards. The moment it rotates the end of the gun barrels have moved ofcourse, thus the bullets don't spawn at the end of the gun battels, but at the place the where the gun barrels are when the turret is pointing upwards. How can I check where the end of the gun barrels are the moment it rotates? Thanks in Advance, Mark Dijkema PS. If you need code please let me know, I didn't post any yet, because I didn't what code you would need.

    Read the article

  • XNA Monogame GameState Management not deserilaizing

    - by Pectus Excavatum
    I am having some trouble serializing/deserializing in a little game I am doing to teach myself monogame. Basically, I am using the gamestatemnanagement resources common to monogame (screen manager etc). Then I am serializing my screen manager component and all associated screens in the OnDeactivated method: protected override void OnDeactivated(Object sender, EventArgs args) { foreach (GameplayScreen screen in mScreenManager.GetScreens()) { DataManager.SaveData(screen.Level.LevelData); } mScreenManager.SerializeState(); } The Save data bit is to do with something else. Then I then override OnActivated to de serialize protected override void OnActivated(Object sender, EventArgs args) { //System.Diagnostics.Debug.WriteLine("here activating"); mScreenManager.DeserializeState(); } However, when this runs it just loads a blank screen - it goes into the game initialize and the game draw method, but doesnt go down into the screens initialize or draw methods. I have no idea why this might be - any help would be greatly appreciated. I am not the only one who has encountered this - I found this post also - https://monogame.codeplex.com/discussions/391117

    Read the article

  • XNA Spritebatch sorting by texture vs depth

    - by Motig
    I am refining my 2D game engine, and I want to look in to sorting sprite batches by texture (because I'm quite often using the same textures repeatedly). However, I also want to retain a few 'layers' of depth (i.e. ground < buildings < units < GUI etc). My question is, which of the following is the best approach (in terms of performance)? Create multiple SpriteBatches and Begin() and End() them in order; or... Create a single SpriteBatch and call Begin() and End() multiple times, once for each layer (in order)?

    Read the article

  • XNA 2D vehicle wall collisions

    - by mike
    I am attempting to implement collisions for my truck game, where the truck can drive around the world and hit walls surrounding the level and various randomly placed walls within the level. I am able to get direct collisions working correctly. However, it is getting very complicated and tricky very quickly. I am trying to accommodate various other collisions such as when a truck is against the wall then turns an adjacent direction or when they reverse into a wall. Both of these result in a slight collision as the image of the truck flips around to the direction the player wants to move. All of this has resulted in a whole lot of if statements to check how I should be fixing the collision. This in turn makes the player jump to random locations and "teleport" around corners, etc. The rest of my game is fine, I am not completely new to game development or C# for that matter. It's just the logic of collisions. Any ideas on how I can approach this? Image of the collisions I am trying to resolve: http://tinypic.com/r/2qtflvq/6

    Read the article

  • Microsoft XNA code sample wont work with blender model

    - by FreakinaBox
    I downloaded this code sample and integrated it into my game http://xbox.create.msdn.com/en-US/education/catalog/sample/mesh_instancing It works with the model that they supplied, but throws and exception whenever I use one of my models. The current vertex declaration does not include all the elements required by the current vertex shader. TextureCoordinate0 is missing. I tried pluging my model into their original source code and same thing. My model is an fbx from blender and has a texture. This is the function that throws the error GraphicsDevice.DrawInstancedPrimitives( PrimitiveType.TriangleList, 0, 0, meshPart.NumVertices, meshPart.StartIndex, meshPart.PrimitiveCount, instances.Length );

    Read the article

  • Scripted Motion Paths (?) (XNA)

    - by Peteyslatts
    Ok, so the title isn't the greatest because this is a lot more general. Say I want to have the player be able to hit A and have their ship model roll to the right, and shift to the right of the screen, while the camera stays centered. Would I do that through programming (ie. set waypoints for the model and keep the camera focus still) or do it through animation ( so the ship model actually rolls and moves right, and just play those frames)(I actually don't know how to do this kind of 3D animation yet, haven't looked into it. Adding it to my To Do List) This is a really vague question I know, I'll try and answer any questions. Thanks, Peter

    Read the article

  • Trouble with collision detection in XNA?

    - by Lewis Wilcock
    I'm trying to loop through an list of enemies (enemyList) and then any that have intersected the rectangle belonging to the box object (Which doesn't move), declare there IsAlive bool as false. Then another part of the code removes any enemies that have the IsAlive bool as false. The problem im having is getting access to the variable that holds the Rectangle (named boundingBox) of the enemy. When this is in a foreach loop it works fine, as the enemy class is declared within the foreach. However, there are issues in using the foreach as it removes more than one of the enemies at once (Usually at positions 0 and 2, 1 and 3, etc...). I was wondering the best way to declare the enemy class, without it actually creating new instances of the class? Heres the code I currently have: if (keyboardState.IsKeyDown(Keys.Q) && oldKeyState.IsKeyUp(Keys.Q)) { enemyList.Add(new enemy(textureList.ElementAt(randText), new Vector2(250, 250), graphics)); } //foreach (enemy enemy in enemyList) //{ for (int i = 0; i < enemyList.Count; i++) { if (***enemy.boundingBox***.Intersects(theDefence.boxRectangle)) { enemyList[i].IsDead = true; i++; } } //} for(int j = enemyList.Count - 1; j >= 0; j--) { if(enemyList[j].IsDead) enemyList.RemoveAt(j); } (The enemy.boundingBox is the variables I can't get access too). This is a complete copy of the code (Zipped) If it helps: https://www.dropbox.com/s/ih52k4e21g98j3k/Collision%20tests.rar I managed to find the issue. Changed enemy.boundingBox to enemyList[i].boundingBox. Collision works now! Thanks for any help!

    Read the article

  • XNA - Detect click on triangle/circle form of a texture

    - by chr1s89
    How can i detect clicks on a texture (will be a button in my game) that has a form of a triangle or circle. I know only the rectangle solution where u can use the positions + the width/height but this dont work for that because clicks will be detected at the transparent pixels. I heard of pixel-perfect collision is it the right way for this? It would be great if someone can give me a example for such a solution or other.

    Read the article

  • XNA 4.0 - container with content, that can slide (C#)

    - by DijkeMark
    I got an idea, but I got no idea on how to make it. Okay, so here is the deal. I want a container which can contain certain objects (These objects will draw the sprites/graphics). But because of different screen sizes, I want to be able to scale the containers width and height. But I do not want the objects in the container, that go outside of the container, because of the scaling to be visible. Because I want the objects all to be positioned horizontaly to eachother and I want a horizontal sliderbar, so I can slide from left to right within the container. I wonder if anyone could point me in the right direction. Thanks in Advance, Mark

    Read the article

  • If and else condition not working properly in xna [closed]

    - by user1090751
    I am developing chess like game and i wanted to show error message if user try to place any player inside the box which is not empty. For example in certain place if there is empty then the object(2d object) is placed else it should show error message. However in my program it is showing message everytime i.e when i place object on empty place then also it is showing error message. Please see the below code: protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); // TODO: Add your update logic here for (int i = 0; i < 25; i++) { MouseState mouseState; mouseDiBack = false; mouseState = Mouse.GetState(); if (new Rectangle(mouseState.X, mouseState.Y, 1, 1).Intersects(rect_arr[i])) { background_color_arr[i] = Color.Red; } else { background_color_arr[i] = Color.White; } if (new Rectangle(mouseState.X, mouseState.Y, 1, 1).Intersects(rect_arr[i]) && (mouseState.LeftButton == ButtonState.Pressed)) { if (boxes[i] != "goat" && boxes[i] != "tiger") { place = i; if (turn == "goat") { boxes[i] = "goat"; turn = "tiger"; } else { boxes[i] = "tiger"; turn = "goat"; } } else { errMsg = "This " + i + " block is not empty to place " + turn + ". Please select empty block!!"; } } } base.Update(gameTime); }

    Read the article

  • The Minimalist Approach to Content Governance - Create Phase

    - by Kellsey Ruppel
     Originally posted by John Brunswick. In this installment of our Minimalist Approach to Content Governance we finally get to the fun part of the content creation process! Once the content requester has addressed the items outlined in the Request Phase it is time to setup and begin the production of content.   For this to be done correctly it is important the the content be assigned appropriate workflow and security information. As in our prior phase, let's take a look at what can be done to streamline this process - as contributors are focused on getting information to their end users as quickly as possible. This often means that details around how to ensure that the materials are properly managed can be overlooked, but fortunately there are some techniques that leverage our content management system's native capabilities to automatically take care of some of the details. 1. Determine Access Why - Even if content is not something that needs to restricted due to security reasons, it is helpful to apply access rights so that the content ends up being visible only to users that it relates to. This will greatly improve user experience. For instance, if your team is working on a group project many of your fellow company employees do not need to see the content that is being worked on for that project. How - Make use of native content features that allow propagation of security and meta data from parent folders within your content system that have been setup for your particular effort. This makes it painless to enforce security, as well as meta data policies for even the most unorganized users. The default settings at a parent level can be set once the content creation request has been accepted and a location in the content management system is assigned for your specific project. Impact - Users can find information will less effort, as they will only be exposed to what they need for their work and can leverage advanced search features to take advantage of meta data assigned to content. The combination of default security and meta data will also help in running reports against the content in the Manage and Retire stages that we will discuss in the next 2 posts. 2. Assign Workflow (optional depending on nature of content) Why - Every case for workflow is going to be a bit different, but it generally involves ensuring that content conforms to management, legal and or editorial requirements. How - Oracle's Universal Content Management offers two ways of helping to workflow content without much effort. Workflow can be applied to content based on Criteria acting on meta data or explicitly assigned to content with a Basic workflow. Impact - Any content that needs additional attention before release is addressed, allowing users to comment and version until a suitable result is reached. By using inheritance from parent folders within the content management system content can automatically be given the right security, meta data and workflow information for a particular project's content. This relieves the burden of doing this for every piece of content from management teams and content contributors. We will cover more about the management phase within the content lifecycle in our next installment.

    Read the article

  • 45° Slopes in a Tile based 2D platformer

    - by xNidhogg
    I want to have simple 45° slopes in my tile based platformer, however I just cant seem to get the algorithm down. Please take a look at the code and video, maybe I'm missing the obvious? //collisionRectangle is the collision rectangle of the player with //origin at the top left and width and height //wantedPosition is the new position the player will be set to. //this is determined elsewhere by checking the bottom center point of the players rect if(_leftSlope || _rightSlope) { //Test bottom center point var calculationPoint = new Vector2(collisionRectangle.Center.X, collisionRectangle.Bottom); //Get the collision rectangle of the tile, origin is top-left Rectangle cellRect = _tileMap.CellWorldRectangle( _tileMap.GetCellByPixel(calculationPoint)); //Calculate the new Y coordinate depending on if its a left or right slope //CellSize = 8 float newY = _leftSlope ? (calculationPoint.X % CellSize) + cellRect.Y : (-1 * (calculationPoint.X % CellSize) - CellSize) + cellRect.Y; //reset variables so we dont jump in here next frame _leftSlope = false; _rightSlope = false; //now change the players Y according to the difference of our calculation wantedPosition.Y += newY - calculationPoint.Y; } Video of what it looks like: http://youtu.be/EKOWgD2muoc

    Read the article

  • flicker when drawing 4 models for the first time

    - by Badescu Alexandru
    i have some models that i only draw at a certain moment in the game (after some seconds since the game has started). The problem is that in that first second when i start to draw the models, i see a flicker (in the sence that everything besides those models, dissapears, the background gets purple). The flicker only lasts for that frame, and then everything seems to run the way it should. UPDATE I see now that regardless of the moment i draw the models, the first frame has always the flickering aspect What could this be about? i'll share my draw method: int temp = 0; foreach (MeshObject meshObj in ShapeList) { foreach (BasicEffect effect in meshObj.mesh.Effects) { #region color elements int i = int.Parse(meshObj.mesh.Name.ElementAt(1) + ""); int j = int.Parse(meshObj.mesh.Name.ElementAt(2) + ""); int getShapeColor = shapeColorList.ElementAt(i * 4 + j); if (getShapeColor == (int)Constants.shapeColor.yellow) effect.DiffuseColor = yellow; else if (getShapeColor == (int)Constants.shapeColor.red) effect.DiffuseColor = red; else if (getShapeColor == (int)Constants.shapeColor.green) effect.DiffuseColor = green; else if (getShapeColor == (int)Constants.shapeColor.blue) effect.DiffuseColor = blue; #endregion #region lighting effect.LightingEnabled = true; effect.AmbientLightColor = new Vector3(0.25f, 0.25f, 0.25f); effect.DirectionalLight0.Enabled = true; effect.DirectionalLight0.Direction = new Vector3(-0.3f, -0.3f, -0.9f); effect.DirectionalLight0.SpecularColor = new Vector3(.7f, .7f, .7f); Vector3 v = Vector3.Normalize(new Vector3(-100, 0, -100)); effect.DirectionalLight1.Enabled = true; effect.DirectionalLight1.Direction = v; effect.DirectionalLight1.SpecularColor = new Vector3(0.6f, 0.6f, .6f); #endregion effect.Projection = camera.projectionMatrix; effect.View = camera.viewMatrix; if (meshObj.isSetInPlace == true) { effect.World = transforms[meshObj.mesh.ParentBone.Index] * gameobject.orientation; // draw in original cube-placed position meshObj.mesh.Draw(); } else { effect.World = meshObj.Orientation; // draw inSetInPlace position meshObj.mesh.Draw(); } } temp++; }

    Read the article

  • Question about Target parameter of Matrix.CreateLookAt

    - by manning18
    I have a newbie question that's causing me a little bit of confusion when experimenting with cameras and reading other peoples implementations - does this parameter represent a point or a vector? In some examples I've seen people treat it like a specific point they are looking at (eg a position in the world), other times I see people caching the orientation of the camera in a rotation matrix and simply using the Matrix.Forward property as the "target", and other times it's a vector that's the result of targetPos - camPos and also I saw a camPos + orientation.Forward I was also just playing around with hard-coded target positions with same direction eg 1 to 10000 with no discernible difference in what I saw in the scene. Is the "Target" parameter actually a position or a direction (irrespective of magnitude)? Are there any subtle differences in behaviors, common mistakes or gotchas that are associated with what values you provide, or HOW you provide this paramter? Are all the methods I mentioned above equivalent? (sorry, I've only recently started and my math is still catching up)

    Read the article

  • How can I test different TV display types for my XBLIG game?

    - by Steve Dunn
    The XBLIG submission check-list says to ensure that all important stuff critical to game-play be visible in the 'TitleSafeArea'. I've received a bug report during play-test of my game (Crazy Balloon Lite) that says parts of my scrolling 2D map are only half visible (i.e. chopped at the left of the screen). I've tested my game myself on a 47" TV and also a 19" VGA monitor, both of which look fine. The bug report says the issue occurs on a standard 20" TV. My question is: without buying different sizes of TVs, is there a way to test what my game will look like on different sized displays?

    Read the article

  • When does depth testing happen?

    - by Utkarsh Sinha
    I'm working with 2D sprites - and I want to do 3D style depth testing with them. When writing a pixel shader for them, I get access to the semantic DEPTH0. Would writing to this value help? It seems it doesn't. Maybe it's done before the pixel shader step? Or is depth testing only done when drawing 3D things (I'm using SpriteBatch)? Any links/articles/topics to read/search for would be appreciated.

    Read the article

  • Isometric algorithm producing tiles in wrong draw order

    - by David
    I've been toying with isometric and I just cant get the tiles to be in the right order. I'm probably missing something obvious and I just can't see it. Even at the risk of looking stupid, here's my code: for (int i = 0; i < Tile.MapSize; i++) { for (int j = 0; j < Tile.MapSize; j++) { spriteBatch.Draw( Tile.TileSetTexture, new Rectangle( (-j * Tile.TileWidth / 2) + (i * Tile.TileWidth / 2), (i * (Tile.TileHeight - 9) / 2) - (-j * (Tile.TileHeight - 9) / 2), Tile.TileWidth, Tile.TileHeight), Tile.GetSourceRectangle(tileID), Color.White, 0.0f, new Vector2(-350, -60), SpriteEffects.None, 1.0f); } } And here's what I end up with: messed up map Yep, bit of an issue. If anyone could help, I'd appreciate it.

    Read the article

  • Isometric algorithm [fixed]

    - by David
    so i've been toying with isometric and i just cant get the tiles to be in the right order. im probably missing something obvious and i just cant see it... but even at the risk of looking stupid, heres my code. for (int i = 0; i < Tile.MapSize; i++) { for (int j = 0; j < Tile.MapSize; j++) { spriteBatch.Draw( Tile.TileSetTexture, new Rectangle( (-j * Tile.TileWidth / 2) + (i * Tile.TileWidth / 2), (i * (Tile.TileHeight - 9) / 2) - (-j * (Tile.TileHeight - 9) / 2), Tile.TileWidth, Tile.TileHeight), Tile.GetSourceRectangle(tileID), Color.White, 0.0f, new Vector2(-350, -60), SpriteEffects.None, 1.0f); } } and heres what i end up with delicious messed up map yep, bit of an issue. so if anyone could help, i'd appreciate it. edit* works now <_<

    Read the article

  • Rotate 3D Model from a custom position

    - by Nipuna Silva
    I have a 3D Model like above in which i want to rotate it from a given location(pointed in red) but I can only rotate it from the middle. How can I rotate it from a custom point. Edit: I successfully able to rotate the model from the below position by getting the radius of the model and applying it to the world matrix Vector3 point = new Vector3(-radius, 0, 0); world = Matrix.CreateTranslation(-radius, 0, 0); But now I cannot change the position of the object and it always centered in middle of the screen. I think that's because i applied the above code. How can I place it anywhere I want?

    Read the article

  • Texture2D.GetData fails to return pixel colour data

    - by Chris Charabaruk
    Because I'm using sprite sheets instead of an individual texture per sprite, I need to pass in a Rectangle when calling Texture2D.GetData() in my collision detection for per-pixel tests. Unfortunately, without fail I get an ArgumentException percolated down from an internal method inside the Texture (not Texture2D) class. My code for getting the texture data looks like this: public override Color[] GetPixelData() { Color[] data = new Color[(int)size.Product()]; Rectangle rect = new Rectangle(hframe * (int)size.X, vframe * (int)size.Y, (int)size.X, (int)size.Y); #if DEBUG if (sprite.Bounds.Contains(rect) && sprite.Format == SurfaceFormat.Color) #endif sprite.GetData(0, rect, data, 0, 1); return data; } Even with the check to ensure I'm grabbing a valid rectangle and that the texture format matches what I'm trying to get, I still get that exception, claiming "The size of the data passed in is too large or too small for this resource." Unfortunately, the debugger won't let me check the locals within the Texture.ValidateTotalSize() method where the exception originates. Has anyone else had this problem and knows how to fix it? I'm relying on AABB testing only for now, but that doesn't really work for some of my game's entities due to odd shapes, rotation and scaling.

    Read the article

  • Why is my model's scale changing after rotating it?

    - by justnS
    I have just started a simple flight simulator and have implemented Roll and pitch. In the beginning, testing went very well; however, after about 15-20 seconds of constantly moving the thumbsticks in a random or circular motion, my model's scale begins to grow. At first I thought the model was moving closer to the camera, but i set break points when it was happening and can confirm the translation of my orientation matrix remains 0,0,0. Is this a result of Gimbal Lock? Does anyone see an obvious error in my code below? public override void Draw( Matrix view, Matrix projection ) { Matrix[] transforms = new Matrix[Model.Bones.Count]; Model.CopyAbsoluteBoneTransformsTo( transforms ); Matrix translateMatrix = Matrix.Identity * Matrix.CreateFromAxisAngle( _orientation.Right, MathHelper.ToRadians( pitch ) ) * Matrix.CreateFromAxisAngle( _orientation.Down, MathHelper.ToRadians( roll ) ); _orientation *= translateMatrix; foreach ( ModelMesh mesh in Model.Meshes ) { foreach ( BasicEffect effect in mesh.Effects ) { effect.World = _orientation * transforms[mesh.ParentBone.Index]; effect.View = view; effect.Projection = projection; effect.EnableDefaultLighting(); } mesh.Draw(); } } public void Update( GamePadState gpState ) { roll = 5 * gpState.ThumbSticks.Left.X; pitch = 5 * gpState.ThumbSticks.Left.Y; }

    Read the article

  • Proper way to use a RenderTarget2D to draw multiple textures?

    - by TheBroodian
    In the process of trying to resolve a split screen issue, I've been trying to use a RenderTarget2D to draw a portion of my scene to a Texture2D, and then again to another Texture2D, but the end result of both Texture2D's is coming out the same. Can anybody tell me what I'm doing wrong? Texture2D camera1Render; Texture2D camera2Render; GraphicsDevice.SetRenderTarget(RenderTarget); GraphicsDevice.Clear(Color.Transparent); map.Draw(mapDisplayDevice, Camera1, new Location(0, 0), false); camera1Render = RenderTarget; GraphicsDevice.Clear(Color.Transparent); map.Draw(mapDisplayDevice, Camera2, new Location(0, 0), false); camera2Render = RenderTarget; SetRenderTarget(null);

    Read the article

  • Smooth waypoint traversing

    - by TheBroodian
    There are a dozen ways I could word this question, but to keep my thoughts in line, I'm phrasing it in line with my problem at hand. So I'm creating a floating platform that I would like to be able to simply travel from one designated point to another, and then return back to the first, and just pass between the two in a straight line. However, just to make it a little more interesting, I want to add a few rules to the platform. I'm coding it to travel multiples of whole tile values of world data. So if the platform is not stationary, then it will travel at least one whole tile width or tile height. Within one tile length, I would like it to accelerate from a stop to a given max speed. Upon reaching one tile length's distance, I would like it to slow to a stop at given tile coordinate and then repeat the process in reverse. The first two parts aren't too difficult, essentially I'm having trouble with the third part. I would like the platform to stop exactly at a tile coordinate, but being as I'm working with acceleration, it would seem easy to simply begin applying acceleration in the opposite direction to a value storing the platform's current speed once it reaches one tile's length of distance (assuming that the tile is traveling more than one tile-length, but to keep things simple, let's just assume it is)- but then the question is what would the correct value be for acceleration to increment from to produce this effect? How would I find that value?

    Read the article

  • why are my players drawn to the side of my viewport

    - by Jetbuster
    Following this admittedly brilliant and clean 2d camera class I have a camera on each player, and it works for multiplayer and i've divided the screen into two sections for split screen by giving each camera a viewport. However in the game it looks like this I'm not sure if thats their position relative to the screen or what The relevant gameScreen code, the makePlayers is setup so it could theoretically work for up to 4 players private void makePlayers() { int rowCount = 1; if (NumberOfPlayers > 2) rowCount = 2; players = new Player[NumberOfPlayers]; for (int i = 0; i < players.Length; i++) { int xSize = GameRef.Window.ClientBounds.Width / 2; int ySize = GameRef.Window.ClientBounds.Height / rowCount; int col = i % rowCount; int row = i / rowCount; int xPoint = 0 + xSize * row; int yPoint = 0 + ySize * col; Viewport viewport = new Viewport(xPoint, yPoint, xSize, ySize); Vector2 playerPosition = new Vector2(viewport.TitleSafeArea.X + viewport.TitleSafeArea.Width / 2, viewport.TitleSafeArea.Y + viewport.TitleSafeArea.Height / 2); players[i] = new Player(playerPosition, playerSprites[i], GameRef, viewport); } //players[1].Keyboard = true; } public override void Draw(GameTime gameTime) { base.Draw(gameTime); foreach (Player player in players) { GraphicsDevice.Viewport = player.PlayerCamera.ViewPort; GameRef.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, player.PlayerCamera.Transform); map.Draw(GameRef.spriteBatch); // Draw the Player player.Draw(GameRef.spriteBatch); // Draw UI screen elements GraphicsDevice.Viewport = Viewport; ControlManager.Draw(GameRef.spriteBatch); GameRef.spriteBatch.End(); } } the player's initialize and draw methods are like so internal void Initialize() { this.score = 0; this.angle = (float)(Math.PI * 0 / 180);//Start sprite at it's default rotation int width = utils.scaleInt(picture.Width, imageScale); int height = utils.scaleInt(picture.Height, imageScale); this.hitBox = new HitBox(new Vector2(centerPos.X - width / 2, centerPos.Y - height / 2), width, height, Color.Black, game.Window.ClientBounds); playerCamera.Initialize(); } #region Methods public void Draw(SpriteBatch spriteBatch) { //Console.WriteLine("Hitbox: X({0}),Y({1})", hitBox.Points[0].X, hitBox.Points[0].Y); //Console.WriteLine("Image: X({0}),Y({1})", centerPos.X, centerPos.Y); Vector2 orgin = new Vector2(picture.Width / 2, picture.Height / 2); hitBox.Draw(spriteBatch); utils.DrawCrosshair(spriteBatch, Position, game.Window.ClientBounds, Color.Red); spriteBatch.Draw(picture, Position, null, Color.White, angle, orgin, imageScale, SpriteEffects.None, 0.1f); } as I said I think I'm gonna need to do something with the render position but I'm to entirely sure what or how it would be elegant to say the least

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >