10
votes
Accepted
Creating a Static function inside my class to handle small housekeeping tasks
In C#, having an instance (non-static) method in a class does not copy the instructions for each object created from that class. Static or not, the data that represents the instructions only exist in ...
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
Question about segment of code in XNA
public static Camera Instance
{
get
{
if (instance == null)
instance = new Camera();
return instance;
}
}
This is called ...
2
votes
Accepted
Monogame - Not enough storage is available to complete this operation, on backgrounds
Yep, you're out of memory. Loading all of those textures (which I assume are going to be very large since they're backgrounds) is going to eat through your RAM pretty quickly. There are a couple ...
2
votes
Accepted
XNA - Offscreen Vertices Optimization
One way would be organizing the model's triangles (not vertices) into a spatial hierarchy system like an octree. Then test the octree against the view frustum.
The XNA sample library has the 'ship ...
2
votes
XNA game structure question
Ah, then I may be confused on game structure with XNA... If loadcontent and initilize in the main game class can only be called once,
They are called once per device creation not per game start. If ...
2
votes
Accepted
Can I export a model and texture from a terrain file built in Unity3D?
Yes it is possible to export Unity terrain as an obj file to use in other game engines :)
Follow this Link :-
TerrainObjExporter
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
Accepted
Vector for bullet direction XNA C#
You can use trigonometry:
x = cos(angle)
y = sin(angle)
Make sure angle is in radian
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 ...
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 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
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
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 ...
1
vote
Wall-Sliding, Stuck at Corners
Ask yourself these questions: Does your player get stuck on contact? Does your player on contact 'jitters' more into the wall and then gets stuck, or does your player get stuck when moving or jumping ...
1
vote
WP 8.1 XNA custom game loop (render when dirty?)
Although I may be misinterpreting your question, you are trying to make a loop that doesn't draw when it does not need to. XNA has this capability.
...
1
vote
Accepted
How to get rid of jerky movement in scrolling? C# / XNA
I've found a possible solution. Set this.IsFixedTimeStep to false.
What this does is syncs Update to Draw so that the game gets updated only as the screen can be ...
1
vote
Accepted
How can I draw some of my XNA models semi-transparent? (C#, XNA 4.0)
Well, a quick Google search has turned up this small Reddit thread: http://www.reddit.com/r/gamedev/comments/1l6eiv/how_do_you_render_a_transparent_model_xna_c_3d/
A non-shader solution isn't ...
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