Hot answers tagged

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 - ...
Kromster's user avatar
  • 10.6k
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, ...
Hamza Hasan's user avatar
  • 3,377
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 ...
Byting Games's user avatar
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. ...
Olivier Jacot-Descombes's user avatar
2 votes

Updating score in collision detection game in XNA

Try doing something like this instead: ...
jgallant's user avatar
  • 8,374
2 votes
Accepted

How to draw a sprite at a floating point xy coordinate with interlaced drawing?

Any of the Vector2 position draw overloads. ...
ClassicThunder's user avatar
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 ...
Ramsay Smith's user avatar
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 ...
Bálint's user avatar
  • 14.8k
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
Bálint's user avatar
  • 14.8k
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", "");
Carlos Ferreira's user avatar
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 ...
Bryan Robertson's user avatar
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 ...
jgallant's user avatar
  • 8,374
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: ...
jgallant's user avatar
  • 8,374
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 ...
TreDubZedd's user avatar
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 ...
jgallant's user avatar
  • 8,374
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, ...
Justin William Stanley Bryant's user avatar
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 ...
UDXS's user avatar
  • 141
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: ...
Xriuk's user avatar
  • 633
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 ...
Nils Ole Timm's user avatar
1 vote

How can i show all edges in monogame?

Perhaps you could change the RasterizerState fill mode. ...
Chris Clements's user avatar
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? ...
Ryan Needham's user avatar
1 vote

Exception whilst doing a full screen negative colors effect

The root cause isn't obvious to me, but: ...
Jon's user avatar
  • 3,684
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 ...
Ahmet Zambak's user avatar
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 ...
Stefan Agartsson's user avatar
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: ...
Ahmet Zambak's user avatar
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. ...
Ahmet Zambak's user avatar
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 ...
Gummibeer's user avatar
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 ...
Aj_'s user avatar
  • 299

Only top scored, non community-wiki answers of a minimum length are eligible