Hot answers tagged

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 ...
PatrickSharbaugh's user avatar
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,347
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

Question about segment of code in XNA

public static Camera Instance { get { if (instance == null) instance = new Camera(); return instance; } } This is called ...
jgallant's user avatar
  • 8,314
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 ...
Honeybunch's user avatar
  • 1,373
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 ...
Steve H's user avatar
  • 5,049
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 ...
Jon's user avatar
  • 3,674
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
Hash Buoy's user avatar
  • 1,479
2 votes

Updating score in collision detection game in XNA

Try doing something like this instead: ...
jgallant's user avatar
  • 8,314
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
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.7k
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.7k
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,674
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

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

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
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 ...
Majte's user avatar
  • 843
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. ...
Ramsay Smith's user avatar
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 ...
Superdoggy's user avatar
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 ...
Seta's user avatar
  • 1,388

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