Click here to Skip to main content
15,887,294 members
Everything / XNA

XNA

XNA

Great Reads

by Adam David Hill
All the juicy tricks and scandalous shortcuts which helped us ship our competition game on time
by Tyler Forsythe
IceCream1945 is a demonstration of XNA and the IceCream 2D library in a 2D top-down scrolling shooter similar to 1942 for the NES.
by Adam David Hill
Sensor-controlled XNA tunnel game with VR head-tracking.
by Simon Jackson
Some of the other frameworks which use XNA as a baseline.

Latest Articles

by Patchrick
Learn the basics of game development in C# and MonoGame
by Bruno Sonnino
MonoGame is an open source implementation of the XNA application programming interface (API).
by Geoff Arnold
fter participating in an earlier Intel contest, developer Dave Gannon took on these challenges, coming back with a vengeance with Wormhole Pinball, the winning app in the games category in the Intel App Innovation Contest 2013 in partnership with the Intel® Developer Zone.
by valentasm
Silverlight and XNA animation class with automatic animation and flexible sprites loading.

All Articles

Sort by Updated

XNA 

10 Jul 2017 by It's Eddie!
Hey Codeproject, I'm creating an isometric game but there is a problem with the mouse translations. I use a Matrix-based 2D camera for this, and this does not have any issues. I already know how to translate my "screen" position into a "world" position, but since I'm rendering in an isometric...
18 Apr 2016 by swapnil999
See,I have this code- if (RunsCollision.isrunnew == true) { i = 0; do { i += 0.1f; Game1.spriteBatch.Begin(); Game1.spriteBatch.DrawString(Game1.scorefont, runstoshow, new Vector2(200,...
18 Apr 2016 by Ronnie Kong
I know this is very late, but in case anyone reads this, or if you haven't figured it out yet; you should not be handling the timer in your draw routine. You're basically trying to sleep the thread here with your while loop. What would be more appropriate is using the Update() method which...
4 Aug 2015 by Patchrick
Learn the basics of game development in C# and MonoGame
19 Jun 2015 by pp2015
Hi,I have problem with my xna project, which is when I move my camera around the terrain objects that are fixed on the terrain, appear to be moving. They are indeed static, which I tested my reading their coordinates. It appears as if the "terrain is moving". Any advice?
16 Feb 2015 by littleGreenDude
Unfortunately the WP8 version of MonoGame doesn't support "Any CPU", so you have to switch back and forth between x86 (for running in theemulator) and ARM (for running on a real device, and for publishing to the store). Also found this...
14 Feb 2015 by littleGreenDude
I'm using VS 2012 update 4 and MonoGame 3.3.My game compiles, builds and runs on the emulators in debug mode. When I switch the compiler configuration to Release for Any CPU, I get error messages 'The type or namespace name 'Xna' does not exist in the namespace 'Microsoft' (are you missing...
11 Feb 2015 by CDP1802
No, there must not be a way, sorry. Not every possible mode must be available. That actually is determined by your graphics card drivers and monitor drivers. After moving on to Win 8, the old graphics mode was not available anymore and you now get the closest mode fitting to your...
29 Jan 2015 by CDP1802
It will simply not work, at least not yet. XNA is nothing else than a library, based on DirectX. The 'commands' you are looking for most probably don't exist in Xamarin yet, if they ever will. Simply recompiling the libraries will not be enough in this case. It would have to be ported to...
23 Jan 2015 by swapnil999
I recently developed an application on my computer using xna.Now i want to make this application on android.So,I downloaded Xamarin studio.I tried coding in it but it feels very different from xna. Xamarin studio doesn't even recognize commands like texture2d and spritebatch.!Now I cant...
26 Dec 2014 by swapnil999
So I have a game that I made 1-2 months ago.At that time when I placed my mouse at the bottom-right corner of the screen and checked the mouse's X and Y positions,it showed 1360 and 760(so my full screen size was 1360*760).Now I recently updated to Windows 8.But now When I place my mouse in the...
16 Nov 2014 by Andreas Gieriet
Given the plane vector [n] at a given point [p], and you have an object model at the absolute origin, and you want to render the object at point [p] aligned with the plane, then you must find the following transformation:T1 = rotate the absolute x-z plane around the absolute y-axis by the...
15 Nov 2014 by paulrm
The matrix code in my directX model from which I am creating the plane below looks like this;FrameTransformMatrix { 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 2750.0, 0.000163, 0.000143, 1.0;;}In C# I can create a plane from existing points in the...
2 Nov 2014 by Anthony Mushrow
If you're not familiar with the different matrices used in rendering and their purpose then I suggest you do some reading. But generally speaking you should have a Model matrix, a View matrix and a Projection matrix.The Model matrix represents the position of an object in the scene and is...
2 Nov 2014 by BillWoodruff
"in my game,I have drawn maybe 400-500 objects.Will I have to adjust all of them?It will surely take a lot of time."You absolutely will want to find a "general" solution that will take care of scaling your Window (or whatever XNA calls its display), and all the objects in it. I bet that can be...
1 Nov 2014 by OriginalGriff
"can you reply with an example"Assuming your screen is 1000 pixels wide:int x = 700; // BAD!int x = (WidthOfScreen * 700) / 1000; // Better!int xPercent = 70;int x = (widthOfScreen * xPercent) / 100; // Best!
1 Nov 2014 by swapnil999
See,I'm making a game for my computer project(in XNA 4).So,I do the programming at home and test it on the school computer in school.I placed several objects at many points in my game for example some at vector2(500,300),(700,1000) etc.All these items fit perfectly on my home computer's...
16 Oct 2014 by Bruno Sonnino
MonoGame is an open source implementation of the XNA application programming interface (API).
16 Oct 2014 by Geoff Arnold
fter participating in an earlier Intel contest, developer Dave Gannon took on these challenges, coming back with a vengeance with Wormhole Pinball, the winning app in the games category in the Intel App Innovation Contest 2013 in partnership with the Intel® Developer Zone.
14 Oct 2014 by Afzaal Ahmad Zeeshan
Who would like to join, your indi studio, specially for free? However, please go to a freelancer website, or try to discuss this job in lounge[^] you might be able to get some response. This space is for the Developers seeking help in their programming work.
2 Oct 2014 by CDP1802
Sorry for the late answer, but I hope I can still help. I had my own little GUI and 3D engine project going, but said goodbye to Mickeysoft when they abandoned XNA and wanted to have everything the Windows 8 way.There is no general answer to your question. It depends very much on how your UI...
16 Sep 2014 by swapnil999
I am learning about collision detection using rectangles.I created a simple project in which we control the player with arrow keys and if he touches the ball,a new ball will appear.However,a new ball does not appear when I touch the player with the ball.The code:Main game:using...
14 Sep 2014 by Richard MacCutchan
You could easily find the answer by reading some C# documentation, such as http://msdn.microsoft.com/en-us/library/aa691346(v=vs.71).aspx[^].
14 Sep 2014 by swapnil999
Quick question:What is the use and meaning of Color[,] and Color[]Can you explain with examples?
6 Sep 2014 by George Jonsson
First of all, true randomness does not guarantee that two numbers with the same value never occur in a sequence.For example, throwing a die is considered to be random, but you would not be shocked if you get three sixes in a row, right.That said, the solution to your problem is to store...
6 Sep 2014 by CPallini
The algorithm is in my tip: "Random extraction of 5 cards from a deck"[^].
6 Sep 2014 by swapnil999
I have a question today.Suppose I have 10 numbers in random class(1-10)and I print a random number 10 times.The output would be For example-579110143102You can see there are some numbers that have been printed more than once.I want to print all numbers without...
5 Sep 2014 by Dave Kreskowiak
Don't put your Random in the Ball class. Instead, pass it into the constructor. A better method would be to wrap the Random class in an Interface so you can supply various implementations of random number generators, especially useful for testing your application. This is called "dependency...
5 Sep 2014 by swapnil999
First my code:Main game class:using System;using System.Collections.Generic;using System.Linq;using Microsoft.Xna.Framework;using Microsoft.Xna.Framework.Audio;using Microsoft.Xna.Framework.Content;using Microsoft.Xna.Framework.GamerServices;using...
20 Aug 2014 by valentasm
Silverlight and XNA animation class with automatic animation and flexible sprites loading.
13 Jul 2014 by Francisco T. Chavez
I've been building a small racing game in C#, and I've hit a bit of a block when it comes to the impulse resolution of the car to car collisions. At the moment, the cars are able to hit and push each-other, but there's no resulting rotation from these collisions. The problem I'm having is...
8 Jul 2014 by Dimitris K.
This is a long standing bug that involves (as far as I can tell) OpenTk and MonoGame. Probably the best solution, for the time being, is to set the Window.AllowUserResizing property like so:public Game1(){ graphics = new GraphicsDeviceManager(this); Content.RootDirectory =...
2 Jul 2014 by Keith O. Williams
I have a ping pong game that I want to connect to a classic ping pong game, however I don't know who to connect the two together. How do I add menu items on the form for the bold sections of my code?Here is the code (I hope I done it right): Public Sub New() Title =...
27 Jun 2014 by Tolga Üstünkök
We are developing a GUI system. How can we handle the input of front panel, if it has also a panel under it? I mean, if i click on the front panel, the mouse input also effects on the lower panel. How can i avoid it? We searched that problem on the net. For example, z-indexing systems or...
12 May 2014 by qbao2291
I want to record sound from sound card. I think of using DirectSound but it's no longer support in Visual C#2012. Then I think of XNA but it seem that it only record from microfone (correct me if I 'm wrong). My question is: How can I record sound ( from microfone, external sound card connected...
15 Apr 2014 by Simon Jackson
A new breed of samples for MonoGame
25 Mar 2014 by afgar
I would like to randomly generate one string from array, i need only this.... im looking forward that you give me good information
25 Mar 2014 by afgar
Hello guys,I have one problem, i build one game, and for example, we have one string array:string[] words = {"one word", "seconds word", "third word", "fourth word ..."};i want to select randomly word in this array using Random class, but when i use this method:public string...
15 Mar 2014 by Deviant Sapphire
I've been Googling for a while, and I came across this. I'll be testing this out.private Bitmap ClippedBitmap(Bitmap texture, Point[] pointsArray, out Point position) { int minX = pointsArray.Min(x => x.X); int maxX = pointsArray.Max(x => x.X); int minY =...
15 Mar 2014 by Deviant Sapphire
Hey Codeproject,If I have a polygon that resembles a square with the cooardinates:0: 0, 01: 0, 322: 32, 323: 32, 0How would I fill those cooardinates(The square) with an existing Texture2D, and convert the polygon with the texture to another Texture2D?Here's what I...
18 Feb 2014 by Tuấn Anh Trần
I'm coding a game, i used Silverlight with XNAFile -> New -> Project -> Windows Phone XAML and XNA AppIn MainPage.xaml page I insert a Listbox control, it contain buttonsGrid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> ...
5 Feb 2014 by Dan Colasanti
This article describes my experience porting Invasion from XNA/WP7 to MonoGame/WP8 and includes Invasion's complete source code.
16 Jan 2014 by Abhishrek
Hello all,I wanted to look at an (Open Source) Visual Studio project which requires XNA framework 3.1 installed (and referred in project as below). So I went to MS website and...
13 Jan 2014 by Maximilien
Programming a game is easy.There are tons of toolkits available: http://en.wikipedia.org/wiki/List_of_game_engines[^].The main difficulty is creating and designing the game "experience" and this is done as far away from a computer as possible.Gameplay storyboarding, graphic design,...
12 Jan 2014 by C For Code!!!
HI guys,I know its not a good thing ask here but after searching a lot on Net I had to come here to ask.Apology in advance if you think its not a question to ask here.I want to learn game programming in c++.Please suggest me some go through series of turorials/books/Videos by series...
7 Jan 2014 by Masoud Darvishian
In this simple tutorial, we want to create a scrolling sprite-based star field background using Xamarin Studio and MonoGame.
10 Dec 2013 by Ron Beyer
Ok, you edited the question to make it ever so slightly different, but here is what is going on...if (bool232 == true)When that is true, it will start executing inside the if... next isif (gameTime.TotalGameTime.TotalSeconds >= 3)Here, if the TotalGameTime is over 3...
10 Dec 2013 by bowlturner
Well obviously the .TotalSeconds is greater than or equal to 3 at that point. My first check would be to see if TotalSeconds is returning milliseconds a 1000 milliseconds is much greater than 3. Or is the TotalSeconds being initialized correctly?
10 Dec 2013 by Member 10442210
if (bool232 == true) { if (gameTime.TotalGameTime.TotalSeconds >= 3) { this.Exit(); } } else { }For some reason this code is making my game exit...
10 Dec 2013 by bowlturner
As the others pointed out you are assigning true to your variable instead of comparing it.I also agree that if (bool232)is better than if (bool232 == true)though if you are going to use the == a good practice (sometimes called yoda code) is to always put the constant...
10 Dec 2013 by Ron Beyer
Please don't repost:why doesnt this code work?[^]
10 Dec 2013 by Richard C Bishop
It should read like this: if (bool232 == true) { if (gameTime.TotalGameTime.TotalSeconds >= 3) { this.Exit(); } } else { }You are assigning...
10 Dec 2013 by Matt T Heffron
Don't you mean:if (bool232 == true)or even better:if (bool232)(A better name for that boolean wouldn't hurt, either.)
10 Dec 2013 by Member 10442210
if (bool232 = true) { if (gameTime.TotalGameTime.TotalSeconds >= 3) { this.Exit(); } } else { }For some reason this code is making my game exit after 3...
25 Nov 2013 by Diya Ayesa
i have xna 3.1 how do i load multiple models in xna 3.1 for rendering either from array or button click or switches anything i just need to load multiple 3d models to renderthis is the linkhttp://xboxforums.create.msdn.com/forums/p/15459/80961.aspx[^]where i get code but this code is...
16 Nov 2013 by Francisco T. Chavez
I ended up using the point of minimum extent along the normal axis, from CarB. It's the possible solution I mentioned in the question. Things are a little bouncy, but I think that has more to do with the constants I'm using. Besides, most people that have tried the game out tend to get a bit of...
10 Nov 2013 by Mehdi Gholam
Read this : http://stackoverflow.com/questions/2544431/collision-detection-of-huge-number-of-circles[^]
10 Nov 2013 by alireza ghasemi
HiI have more than 20000 circles that moving in screen. I use XNA and c# to develop my project.I have to check collision between them. so it take too much time.I want a codes that written in c# to solve this program. in other hand i try to find neighbor list algorithm code in c#.can...
8 Nov 2013 by Sergey Alexandrovich Kryukov
Software development is done not by "seeing" "this code", but by writing code, which is performed by using developer's brain.Good luck,—SA
8 Nov 2013 by Ron Beyer
Actually what I think you are looking for is Binary Space Partitioning (BSP) trees. They are a tried-and-true method for finding objects that are near other objects, which will cut down on your collision detection code.https://www.google.com/search?q=bsp+tree+collision+detection[^]
8 Nov 2013 by alireza ghasemi
Hi dearI try to develop a new game in c# with XNA.you know that in game we should check collision between objects in each time. but when we create too many object, collision detection is very harmful for my project because it take too much time.I googled it so i found that i have to use...
24 Oct 2013 by ridoy
Would be ideal for you:XNA integration inside WPF[^]
24 Oct 2013 by Member 10358957
So,there is a game of XNA and how can i put it into a WPF?
17 Oct 2013 by Patchrick
Learn the basics of game development in C# and XNA
26 Sep 2013 by alireza ghasemi
I'm working on a simulator that models very complex interactions between many objects, and I mean millions.I've used XNA because of the useful things that it lets me do easily, especially with the rendering.My problem is that I'm running into OutOfMemoryExceptions after only a few...
26 Sep 2013 by Sergey Alexandrovich Kryukov
Compile the project to the "Any CPU" platform.—SA
25 Sep 2013 by CPallini
My abacus says 4000 * 4000 = 16000000, that is you are trying to create 16 millions instances of your class.Even on a 64 bit architecture, the CLR as a per object limit of 2GB, see this Stack Overflow question (it provides a workaround): "OutOfMemoryException on declaration of Large Array"[^].
25 Sep 2013 by Sergey Alexandrovich Kryukov
There is no such thing as miracle. If you don't have enough memory, it's not enough.It is possible to implement an array of objects using the disk file storage. But I strongly suspect you need to review all your architecture. You did not give us a clue why would you need so many instances of a...
25 Sep 2013 by alireza ghasemi
Hi dearI try to load a class 16000 times in my servermyclass[] Class = new myclass[4000,4000]but when i load it outOfMemoryException will occur.i programming in c# with XNA library and my operation system is windows server 2012 and my server has 32 gig ram. when that error occur 90% of...
27 Aug 2013 by zoyobar
Using NPC and NPCManager to create NPC and custom actions in XNA, WPXNA (19)
19 Aug 2013 by Deviant Sapphire
After a few hours of Googling I came across the code I should have used, and that is this:/* Set the screen's size(Width and height) to the chunk width and height. */GraphicsManager.PreferredBackBufferWidth =...
19 Aug 2013 by Deviant Sapphire
Hello Codeproject,I'm created a Minecraft 2D Clone.I draw every block via the screen size(So I can find the middle of the screen).But when I change the screen to 'FullScreen' it moves the middle point to the left of the screen, is there any way to fix this?Here is my code:/* Screen...
16 Aug 2013 by clonze
I followed the JSIL website and github guide, and I think my game is ready to be used in an HTML + javascript file, but I can't figure out why it giving me a loading error:Loading data ... failed.Unhandled exception at file:///C:/Users/Travis/Documents/GitHub/JSIL/bin/minesweepertest.html...
29 Jul 2013 by zoyobar
Use Pinup and PinupManager to create pinups in XNA, WPXNA (17)
26 Jul 2013 by zoyobar
Using Item and ItemManager to create items in the XNA, WPXNA (16)
24 Jul 2013 by zoyobar
Use the Bullet and BulletManager classes to create bullets and attack targets in XNA, WPXNA (15)
19 Jul 2013 by Sergey Alexandrovich Kryukov
You need to understand that dB is relative measure: http://en.wikipedia.org/wiki/Decibel[^].—SA
19 Jul 2013 by Ron Beyer
I don't believe this is possible. dB-SPL depends greatly on the speakers attached to the system. I can have my volume turned all the way up in the control panel, and my speaker volume all the way down, etc. Think the way car audio competitions work, dB is dependent greatly upon the...
19 Jul 2013 by mansurmojom
I am Playing a .wav file using soundInstance object of XNA framework. Volume of sound i.e. soundInstance.Volume lies between 0f -1f. I want to Convert these values to corresponding dB-SPL. Please help me. I am not getting it.
18 Jul 2013 by zoyobar
Using the SpiritManager class to manage the Spirit in XNA.
10 Jul 2013 by zoyobar
Using the Spirit class to create basic units in an XNA game, WPXNA (13).
3 Jul 2013 by zoyobar
Using the CommandScene class to create command scenes in the XNA, WPXNA (12)
1 Jul 2013 by zoyobar
Using Anime class to create animations in XNA, WPXNA (11)
1 Jul 2013 by Dan Colasanti
Advertising Network Options for WP7 XNA Games – Revisited
24 Jun 2013 by zoyobar
How to use the Button class to create Graphic buttons in XNA, WPXNA
16 Jun 2013 by Member 9856173
A rectangle has four Points. You have to get the position of those four points after rotation by multiplying the position of point with rotation matrix. Then create a 2D plane from every two points which make a wall of the rectangle. Now you can check whether the mouse position is in front of...
16 Jun 2013 by harvs899
Ok I need to check if a mouse click has clicked on a rectangle, obviously this is trivial when the rectangle hasn't been rotated, but when it has it gets harder. After reading quite a few posts I believe you have to reverse the rotation of the point and rectangle (I have moved rectangle to...
15 Jun 2013 by Ghost_x
Hello, I'm trying to draw a terrain using the points given by this function:public static Level GenerateDummyLevel(int width, int height) { Level level = new Level(); bool up = false; for (int i = 0; i
3 Jun 2013 by zoyobar
How to use HitArea class for hit testing in XNA, WPXNA
24 May 2013 by PaulPrice
Good afternoon all,I am trying to use the XmlContentImporter to populate a data structure as followstarget class objectpublic class UiElement{ public List Elements { get; set; } public Point Position { get; set; }}my source xml is as follows
23 May 2013 by zoyobar
Use ResourceManager to manage resources in XNA
22 May 2013 by zoyobar
How to use XNA in Silverlight
7 May 2013 by zoyobar
I will explore and learn XNA for Windows Phone with you.
1 May 2013 by Simon Jackson
MonoGame - Using libraries with Windows Phone projects
29 Apr 2013 by bedarob
Hi!I'm using GoblinXNA for my university project and I have a little problem with it. When I set the pivot point in the 3DS Max and export it to FBX, the XNA uses the MAX's origin to the pivot point of the object, but i want the the pivot point in the GoblinXNA to be the pivot point of the...
26 Apr 2013 by Sergey Alexandrovich Kryukov
Please see my comment to the question and review the presentation of the wall data. Is it always rectangular, with walls only on the side? Is so, all you need it just the size of the rectangle, and object with two integer component. Can be many walls? Introduce the collection of "wall object",...
26 Apr 2013 by shane79
I am writing a program in Windows phone emulator Visual Studio 2010. The program is a scrolling tile engine which has a set of waypoints for an attacker to follow on a path. I have this part working and now I am trying to get a turret to rotate in the direction that the attacker is taking. I...
26 Apr 2013 by ukcharlie
We have an array to basically outline where there are 'tiles'. The tiles are 25X25 and represent walls. We use 1s and 0s in the array. '1' represents that a tile is located there and a '0' means there isn't. The character can't move where there is a '1'.This is the code for the array:int[,]...