C# is a multiparadigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.

learn more… | top users | synonyms

12
votes
2answers
2k views

How to blend two cameras when traveling through a portal in Unity3D

Before I get to my question, I know the most obvious solution would be to use the normalized view port rect, however I need more complex shapes than a rectangle, and I've looked in to using the view ...
-2
votes
3answers
622 views

Can I use a list to spawn enemies? [closed]

I need to have about 10 enemies in my game, can I use a list to spawn them all in? This is what I was working on but it only spawns 1 enemy in the coordinates of the last added to the list. Here are ...
1
vote
1answer
329 views

Pixel Shader - apply a mask (XNA)

I'd like to apply a simple few masks to few images. The first mask I'd like to implement is mask like: XXXOOO I mean, that on the right everything is masked (to black), and on the left everything ...
3
votes
1answer
780 views

How to optimise mesh data

So i have some procedurally generated mesh data and i want to reduce it down to its minimum number of verts. In case it matters this is a unity project. Working on the basis of a simple example, ...
0
votes
1answer
54 views

What is the point of the XNA.Input.Button enum?

I am trying to make an InputManager class that will let me basically bridge XNA's various input methods and do a corresponding action in my game. Part of this is designing different keybindings. ...
1
vote
1answer
317 views

Defining a random irregular shape in a bool array

I need to find out how to populate an array bool[x,y] with a random filled shape. lets say I want a triangle depicted in my array i would define an area within the array and set all points to "true" ...
1
vote
1answer
260 views

Player positions in a race game through arrays or…?

First time posting on these forums so go easy on me! I've been programming a race game which has been going quite well. I've just discovered now how hard it is to set up player positions!(As in 1st, ...
2
votes
0answers
202 views

Implementing Branching Conversation Dialogue in C# with XNA [duplicate]

How could I add logical branching conversation dialogue in C# with XNA? What I mean by this is a dialogue tree similar to this: If the user is wearing red: DisplayText "You're wearing a red ...
-1
votes
1answer
184 views

Creating physics in xna

I am creating a racing game using visual studio 2010 and xna 4.0. I'm trying to create some simple physics so my car sticks to the heightmap I have created within my game world and the model adjusts ...
5
votes
1answer
338 views

Why does this Unity code work as expected only with the while loop?

In unity, in C#, I have the following code in Awake(): Awake() { Transform obj = InstantiateTarget(); //the bizarrely required and "working" loop while (transform.childCount > 0) { ...
0
votes
1answer
190 views

Lerp an object based on timers

I'm trying to make a target lerp between two objects based on a timer. At the moment, I have the following code: float distCovered = (Time.time - waitTime) * speed; float fracJourney = ...
4
votes
2answers
291 views

Changing game controls using .txt file

I'm using XNA to create a simple block breaker game. At the moment I have controls set in the standard way: if (keystate.IsKeyDown(Keys.s)) I've figured out the file handling problems involved and ...
0
votes
3answers
1k views

How can I convert screen coordinatess to world coordinates in OpenTK?

I'm making a windows forms application with opengl view. I need to get the mouse coords converted to the opengl world coords. Well, my Y coord gets converted wrong. It's hard to explain, so here is ...
5
votes
2answers
402 views

Set a 2d camera's position so that a building is under the players feet

My issue is this: i am making a scrolling game in XNA, and the camera updates based on the players velocity, but the player never actually moves, he is always in the center of the screen. When he hits ...
0
votes
3answers
756 views

How do I create a 3rd person camera?

I currently have a camera class set up and have my model/player loaded but I can't get my camera in the correct position by changing the x,y,z coordinates. I have set up my "game" with a separate ...
1
vote
0answers
317 views

tex2dlod and tex2d giving different values [closed]

I've been having trouble with vertex texture fetch for a terrain system I am implementing. I'm using C++/DirectX9. I have already implemented exactly what I want as a prototype in C#/XNA and now ...
-1
votes
2answers
136 views

Jittery effects with collisions [closed]

I have been having some problems with my coding lately. I am trying to create a platform-based game and I have been having some troubles. A friend of mine said that some update functions are out of ...
7
votes
1answer
739 views

Implementing water effects (splashes) into XNA 4.0 game [closed]

I am creating a 2D XNA game and came across a tutorial on adding water effects (splashes) to an XNA game but after implementing it into my game I can't get it to scale down. Currently it takes up the ...
2
votes
4answers
306 views

Can I transfer C# coding I do in Unity for practice to another 3d engine?

If I use a C# coding in Unity 4, can I transfer that coding into another non-Unity engine as long as it accepts C# too? I hope this question makes sense. Thank you in advance.
2
votes
1answer
240 views

Pixel Shader gradient problems

I have pretty much zero experience working with shaders as my first couple phone games were just 2d games that didn't use any sort of shaders. Now I'm working on a PC game that has a day and night ...
0
votes
2answers
226 views

Hex tile systems and the efficient use of classes

So I've built myself a system of classes for what I think is an efficient way to describe an entity that would live in my game. Is this an effective approach or am I creating entities that are too ...
-1
votes
1answer
257 views

XNA Framework doesn't recognise controller [closed]

So just a little bit of XNA code: if (this.IsActive && (Keyboard.GetState().GetPressedKeys().Length > 0 || Mouse.GetState().LeftButton == ButtonState.Pressed || ...
3
votes
2answers
231 views

Moving character on x axis

I am new to unity scripting. I am trying to move my character towards right side(on x-axis) to create a running effect, I've imported the character from blender which contains two animations, "jump" ...
4
votes
1answer
516 views

How do I achieve supersampling / anti-aliasing in pixel shaders?

I am trying to write a couple pixel shaders to apply to images similar to Photoshop effects. For example this effect: But I noticed there is aliasing in my resulting image (the above image is a ...
1
vote
2answers
2k views

Weird behavior with XNA SpriteBatch.Draw origin

I have a texture with 256x256 pixels. Consider this piece of code: protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); ...
1
vote
1answer
215 views

Spawning enemies at way points [closed]

I'm trying to have my game spawn enemies when ever the player reaches a way point. Right now, I have this functionality working. When my player gets to the first way, the enemies spawn. He only moves ...
3
votes
2answers
388 views

Collision Detection - Slide Around Sprite

I'm creating an RPG using XNA/C# and am trying to add some complicated collision detection code. I have the playable character 'Wizard' and when it collides with something, a method gets called in his ...
2
votes
3answers
948 views

How should I calculate the new angle/direction of my ball hitting a wall? [duplicate]

I'm building a Pong game and I am stuck at how the ball should bounce when hitting a horizontal wall. I tried a few methods but none seems to work. So far I have an update method, which is called ...
11
votes
1answer
796 views

How do I prevent XNA from pausing Updates while the window is being resized/moved?

XNA stops calling Update and Draw while the game window is being resized or moved. Why? Is there a way to prevent this behaviour? (It causes my network code to desynchronise, because network ...
3
votes
2answers
3k views

How does Unity use C# as a scripting language?

To my knowledge, thus far, I have thought that C# is and has always been a compiled language. I have recently started studying Unity3d and noticed that they give C# as an option for scripting and ...
-2
votes
1answer
261 views

Does this UV mapping method look ok? [closed]

i'm having a spot of trouble trying to get my voxels textures in the right place. I am using a very simple mechanism that assumes all sides of any given block are always individually specified (i'll ...
3
votes
3answers
1k views

Getting correct angles between Vector3s

I'm working on a project where you can draw lines between points. You select one point and drag the mouse onto another point and a line is drawn between them. The line itself is a 3d object which is ...
5
votes
1answer
640 views

Should the networking of my game be a component or a service?

I am working on a windows game and I am trying to understand the XNA GameComponents and GameServices classes and use. From what I understand about a component is that it has an Update method that ...
0
votes
1answer
270 views

Is a HashTable the best way to store replay data in C#?

I'm looking to make a deterministic replay in my 2D game. I want to follow a similar approach to braid in storing the relevant information every frame (at 60 frames per second). I wanted to know what ...
0
votes
1answer
100 views

A view and projection matrix oddity?

I have a bit of a dilemma ... So i setup my scene how I want it with some bits in it and now I want to move all my camera related code in to a camera class however doing so is proving to be a pain in ...
-1
votes
1answer
343 views

I want to start making 2D Games with C++ or #C [closed]

I know C++ pretty well, I think - polymorphism, vectors, templates, and more. I also know C#. I want to program a 2D game, but not like those programs where you click a button or two, and you ...
0
votes
2answers
657 views

Tutorials for shadow mapping with multiple point lights in XNA [closed]

I've been trying to crack this problem for a while now and I'd like to know if there's a tutorial or two out there that can help me with this. I know how to do shadow mapping with a single light, and ...
1
vote
2answers
182 views

Model too small in Orthographic view

This must be super-basic, but I don't know where the problem is, since I just started with 3D-Programming. Why is my model "ballTest" so small on the screen? private Model _model; private Matrix ...
3
votes
1answer
2k views

Rotate object to always face camera

I'm trying to make a TextMesh appear when ever an enemy prefab is hit. I currently have this functionality working. However, the text doesn't face the direction the players camera is looking. At the ...
2
votes
1answer
126 views

Mixing animations

I'm working on a swing animation and mixing it with a turn animation in a motorcycle game. The issue is that for the swing animation to work while turning only the swinging arm has to animation, ...
1
vote
2answers
263 views

How can I use triangle picking to determine location of a triangle in world space coordinates?

I am trying to implement point and click movement in my game, but at the moment I am stumped about how I can select parts of a mesh for the player to walk to. So what I have done is I have got a ...
0
votes
1answer
315 views

Quit the application when clicking cancel button of Alert View in C#

Can someone guide me as to how can I make an application quit when you press the cancel button of an Alert View in C# code? Thanks I forgot to add that I am trying to quit application on clicking ...
-2
votes
1answer
252 views

how to add fog to a model instantiated in Xna? [closed]

I work on a small XNA games. I generate a large map type voxel. a floor of 1000 cubic long by 1000 cubes wide. This is why I use the method "MODEL instancing" with hardware instancing to generate a ...
6
votes
2answers
2k views

Mixing threads and coroutines in Unity3D Mobile

I had a coroutine in Unity3D that downloaded a zip from a server, extracted it to the persistent data path, and loaded its contents into memory. The flow looked something like this: IEnumerator ...
-2
votes
1answer
2k views

Moving A Sprite In The Direction Its Facing XNA [duplicate]

There are many questions on this site that explain this except they seem to all be in Java. I want to move a sprite in the direction it's facing, in XNA. I know you must use Radians and lots of ...
1
vote
2answers
161 views

One or multiple VertexBuffers

I'm currently working on a personal project where I'm trying to load the levels and all of the geometry from the game "Medal of Honor Allied Assault" into my own C# code-base based on SharpDX. I ...
4
votes
1answer
211 views

Creating rectangles from the inner part of a texture2D

Ok, this may be hard to understand, but I'll do my best. You will see that the first image is a normal mario, and the other is the result I am looking for. I'm trying to find a way to extract ...
2
votes
1answer
345 views

Translating a terrains position using input in Unity 3D C#

I am trying to make a terrain in Unity move, but im having trouble. Here's the code i have. using UnityEngine; using System.Collections; public class NewScript : MonoBehaviour { Camera camera; ...
0
votes
1answer
192 views

How to setup Authentication Database and Game Database?

I'm playing around with creating a game in C# using the XNA Framework. I've decided to use technologies that I'm pretty much familiar with and create things from scratch. There are probably frameworks ...
0
votes
1answer
104 views

Map state in XNA on WP8

I am developing an RPG for Windows Phone 8 using XNA. I have a map screen and a fight screen. I want to use XNA for both to utilize the graphics helpers and because XNA is awesome. My question is, how ...