5
votes
How to force XNA to render model very far away as a light dot?
Problem is two-fold:
Determine how many pixels the model will take when rendered
Replace model with a dot
Suggestions:
Pick the cut-off distance by eye. So when the model is this big and this far - ...
4
votes
Game State being skipped
It is probably due to your gameloop is faster then your pressing speed. You should stop detecting space key when you pressed it once. For checking purpose you can use a flag for now. Like,
...
3
votes
How Should I Go About Updating My XNA Game?
As David already mentioned, get a website and program an auto-updater for your projects. It works as follows:
When your game starts check for the server version located on your website in a file.
If ...
3
votes
Accepted
Reading a text file and changing each digit into a value inside an array c#
With int.Parse(SR.ReadLine()) you are trying to convert the whole input line (consisting of 300 digits) into one single int. ...
2
votes
2
votes
Accepted
How to draw a sprite at a floating point xy coordinate with interlaced drawing?
Any of the Vector2 position draw overloads.
...
2
votes
Accepted
How to restart the game when pressed enter in XNA
XNA does not have a built-in function to restart the game, so you will need to do this yourself. You could even write a function within the Game class so that you ...
2
votes
When drawing text, numbers appear as D1 or NumPad1 rather than just numbers
Since the Keys class is an enum, ToString simply converts the names into strings. Enums can't have names, like ...
2
votes
Accepted
Vector for bullet direction XNA C#
You can use trigonometry:
x = cos(angle)
y = sin(angle)
Make sure angle is in radian
1
vote
When drawing text, numbers appear as D1 or NumPad1 rather than just numbers
I used this code:
string key = e.KeyCode.ToString();
if (key.Length > 1) key = key.Replace("NumPad", "").Replace("D", "");
1
vote
Accepted
understanding image rotation XNA C#
The WMRotation variable you have here is being used to drive the rotation.
The rotation is changing in response to the thumbsticks because you have some logic in your update that is modifying the ...
1
vote
TileMap collision detection
Here is some code that I pulled up for you from my XNA coding days. This is how I would handle collisions with XNA. This method works strictly with Rectangle colliders.
The first function I will ...
1
vote
Accepted
Crouching Up and Down XNA C# Controller
Try implementing a property to keep track of your previous pressed state.
So then you can do something like this instead:
...
1
vote
Why do I get this error when converting an XNA .fx to a MonoGame .fx?
The type of vertex you're passing in is not consistent with what is expected. The vertex has the types SV_Position0, NORMAL0, TEXCOORD0, whereas the shader expects ...
1
vote
Using a Windows forms Textbox control in an XNA game
You can't use a Textbox control in XNA, as XNA doesn't support drawing Windows Forms. You will need to write your own Textbox control in XNA, or use one of the freely available XNA control libraries ...
1
vote
XNA / MonoGame - render transparent background using stencil buffer problem (3d)
Hey mate the best way to do it is with alpha test, that way no sorting but it still helps to sort and u can do lighting, render with opaque blend state, cull mode to none.
I do my grass like that, ...
1
vote
Accepted
How Should I Go About Updating My XNA Game?
If you want a website for free, then you can use Github Pages(*.github.io) to get a free static(you don't handle the server side) website. I once built a launcher that you could download that would ...
1
vote
Accepted
How do I make 2 players from one Class?
You need to create two different instances of the class.
I suggest you not to check for input inside your class but in your game loop, so you can handle events for both instances. Pseudocode below:
...
1
vote
Accepted
Any good pattern for managing user input in XNA
A common way is to have a controller base class. This can be an AI controller or just an input controller that is looking at gamepad or keyboard input.
In general adding an extra layer of abstraction ...
1
vote
How can i show all edges in monogame?
Perhaps you could change the RasterizerState fill mode.
...
1
vote
Having trouble creating multiple sprites from one class
for (int i = 0; i < 2; i++)
{
GameFlags.Add(flag);
flag.spriteRectangle.X += 100;
}
Is this not adding a reference to the same object? ...
1
vote
Exception whilst doing a full screen negative colors effect
The root cause isn't obvious to me, but:
...
1
vote
Accepted
How to link the game class to the main menu class in XNA?
As first, don't do it:
spriteBatch.draw(Content.Load<Texture2D>("blabla"), ...);
Because you are calling the "Load" method in every frame. That would cause ...
1
vote
add random walls with an array in 3D xna 4
Your draw method shows no translation or rotation of each wall, they will end up on the same spot.
Your world matrix should(could) be
...
1
vote
XNA 4.0 - Using premade .xnb font files
Copy your compiled (.xnb) font file to your content. And make the same filename as .spritefont file.
If you can't compile any fonts, use third party applications compiling those files.
Edit:
...
1
vote
How to draw the elements that are in a Texture2D list in XNA
I would do it so, so it can be safer and maybe easier to use :
Just use a class to hold the information of position and texture.
...
1
vote
Adjust Aim Angle for Motion with Accelerating Bullet
Your main problem is that you have two objects (ships) and they move with different speeds and a third object that speeds up over time and you want to know the point where you have to aim to hit the ...
1
vote
Wall-Sliding, Stuck at Corners
I don't exactly know what you meant by 'stuck'. If it's stuck as in 'can't move in any direction' then the problem probably in the offset distance.
Are ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
xna-4.0 × 687xna × 322
c# × 260
2d × 58
monogame × 51
3d × 38
collision-detection × 34
physics × 24
models × 23
xna-content-pipeline × 23
textures × 22
hlsl × 20
shaders × 18
camera × 18
sprites × 15
rotation × 14
windows-phone-7 × 14
mathematics × 13
spritebatch × 12
animation × 11
graphics × 11
matrix × 11
input × 10
fragment-shader × 10
platformer × 9