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

-2
votes
1answer
59 views

How to make healthbar decrease in unity [duplicate]

I want to build a health bar which show's the energy of the player.I have two buttons "PLAY" and "IDLE" to show the animation.when I click on the "PLAY" button the character start running along with ...
1
vote
1answer
27 views

How do I take Direct3D9 full screen using SlimDX?

I'm writing a Direct3D9 application wrapped by SlimDX. I'm trying to take my application full screen but I am having problems. I can reset the device so that it covers the entire screen, however, it ...
1
vote
1answer
45 views

XNA Library DrawPrimitives throwing primitiveCount error

I downloaded the project from here http://silverlight.bayprince.com/tutorials.php?tutorial=13 and tried adding a new OBJ file with a few thousand vertices listed. The classic teapot works but when I ...
5
votes
3answers
1k views

How can I build a game in Unity with minimum/no use of the visual editor?

I'd like to write a game completely in C#. In my search for an engine, I found Unity3D, but all the tutorials and documentation are speaking about a visual editor and the Unity IDE in which you click ...
1
vote
1answer
876 views

How can I make caves with Unity's terrain creator?

With Unity's terrain creator, I can't simply make a "hole" on the mesh. I don't know how I would make cave-like structures other than using "rock" meshes for the roof (wich will indeed look weird) ...
0
votes
0answers
85 views

class instance issue

Currently, i am working on a project which deals with several parts. First, I want to interface with a Sidewinder Force Feedback 2 joystick in Unity using SharpDX and SharpDX.DirectInput libraries. ...
0
votes
1answer
88 views

Determining desktop bounds by D3D9 adapter

I've got a Direct3D 9 application which normally runs full-screen. The user is able to select a display adapter to determine which screen it is shown on. I also offer a Windowed mode which launches ...
10
votes
2answers
7k views

How do I generate projectiles toward the mouse pointer? [duplicate]

I'm making a top-down space shooter where the player controls a ship and can aim and shoot using the mouse cursor. How can I fire bullets from the ship at the angle from the ship to the mouse cursor? ...
0
votes
0answers
22 views

graphics.IsFullScreen resetting to false after game constructor and graphics.ApplyChanges()

This is a MonoGame 3.2 Windows (DirectX) Project. I've tried setting graphics.IsFullScreen to true in the game's constructor and in the game's initialize function, both times running ...
0
votes
2answers
58 views

Why does the text of my label objects overlap?

I am having a problem with labels in my GUI: I have looked for solutions online but not found something solid enough to fix this problem. Has anyone ever come across this? Here is my GUI function. ...
0
votes
0answers
51 views

How do I serialize circular references? [migrated]

How do I serialise objects referencing each other? public class Item {} public class Player { Item weapon; } Those instances live on their own somewhere: I have in some class a ...
-1
votes
0answers
66 views

best app store owner, which deals with payoneer, to host and sell an XNA game [duplicate]

I have developped a XNA game, and I'd like to sell it. I'd like to know what is the best free way to put the game as online appstore ? I need an app store owner, which deals with payoneer Thank you ...
-1
votes
2answers
92 views

How to stop a object with progress bar so it can start instantly in unity [closed]

I have created a gameobject(cube) and written code to move,mean while the processbar get loading.when the processbar is loaded fully then the object should stop moving.Can anybody please help me ...
0
votes
1answer
43 views

Simultaneously translating and rotating sprite in Unity

I have a 2D object (a PNG file I dragged onto the screen) which is a circle I would like to move left and right when the correct side of the screen is touched and have it rotate in the respective ...
2
votes
1answer
62 views

Cancel a SpriteBatch I've started drawing

Background: I'm working on a control library for XNA to use in a couple game clients I've written. The way I've implemented Dialogs is to have them derive from the base XNAControl class. XNAControl ...
1
vote
1answer
55 views

Loading source controlled MonoDevelop project leaves out some folders

I have recently started using version control in MonoDevelop and have discovered that if I include a folder containing for example Scenes that they will be included when I push changes to master. My ...
1
vote
1answer
78 views

Detect mouse collision over an object

Suppose there are 4 areas namely A1,A2,A3,A4 and each object is given a number(1,2,3,4). When I drag and drop the object(1) on A1, it should print a message "where the object is being dropped". (no ...
-1
votes
1answer
89 views

Projectile motion based off angle

I was using this code to hit an object that is moving horizontally(from right to left) and player on the left is throwing bullets to hit the object.But, what I am finding difficult is projectile ...
2
votes
1answer
121 views

How do I save a screenshot and load it as a texture for use in game?

I have a Unity level that takes a screenshot taken in the previous level and applies it as a material to a Plane, the problem is that it will get stuck and not apply the most recent version of the ...
1
vote
1answer
164 views

Camera movement and threshold not working

I have a platformer that is in progress, part of this has a camera which I only want to move when the character moves out of a certain threshold, to try to accomplish this I have the following if ...
0
votes
1answer
71 views

How to have an event occur after x seconds?

I want a method to run after every 10 or 15 seconds. My timer is set to: timer = (double) gameTime.ElapsedGameTime.TotalSeconds; What would be the logic to check for every 10 or 15 seconds?
11
votes
1answer
778 views

Does `yield return false;` have special meaning in Unity3d C# scripts?

In Unity, we have some special things for coroutines that are additional to normal C#. for example, we can use yield return WaitForSeconds(5.f); to have a coroutine wait 5 seconds before ...
5
votes
2answers
399 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 ...
6
votes
3answers
219 views

How do I generalise Bresenham's line algorithm to floating-point endpoints?

I'm trying to combine two things. I'm writing a game and I need to determine the grid squares lying on a line with the floating-point endpoints. Moreover I need it to include all the grid squares ...
1
vote
1answer
211 views

XNA Monogame GameState Management not deserilaizing

I am having some trouble serializing/deserializing in a little game I am doing to teach myself monogame. Basically, I am using the gamestatemnanagement resources common to monogame (screen manager ...
5
votes
1answer
614 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
77 views

Multiple joysticks event handling

I want to make a game which is totally same idea as "Who pressed the button answers the question". I have 2 joysticks and both are connected to a pc. My application will be Winforms and I will ...
2
votes
2answers
116 views

Mandelbrot generation using custom HLSL shader in XNA

So I made a Mandelbrot generator in C# and I'm learning about HLSL and custom shaders in XNA (For a college course). I was hoping to do the mandelbrot calculations on the graphics card to make them ...
0
votes
1answer
121 views

Angled topdown perspective camera for 2.5d game

I have a 2d tile based game created using Unity's 2d tools and orthographic camera: The tiles are created by programmatically generating a mesh, assigning a texture to each pair of triangles, and ...
1
vote
1answer
40 views

XNA Veiwing cubes behind others

I am learning 3D at the moment. It is going well but I am stuck on the viewing of the camera. I have two cubes, one next to each other made up of vertices, all the faces/triangles in the cubes are ...
1
vote
1answer
46 views

How do I measure a string that will be drawn with SpriteBatch?

Is there a way to measure width and height of an ever-changing string (a player's score, specifically)?
0
votes
1answer
55 views

How to inplement a save-system for a complex nested list of character classs?

This is the situation I'm in: I'm developing a game with C# using unity. In the game I have characters which is either locked or unlocked, and they're pretty much the same. For every character, they ...
0
votes
1answer
52 views

Collision detection doesn't register until player sprite jumps

I have implemented a shooting mechanic into my game, and the act of shooting works fine. The shooting work is done in my "game1" class. The issue that arises is when I incorporate collision detection ...
0
votes
1answer
43 views

How can I determine where to show a nameplate over a character?

I'm working on a naming system that displays the name of enemies above their heads. The problem is that I have some enemies that are larger or smaller than others. So I'm trying to use a function ...
0
votes
0answers
19 views

How to create a board with evenly spaced pieces in unity? [duplicate]

Creating a board should be easy but I am having a difficult time doing it in unity because of its world coordinates. I need to create a board that will have squares evenly spread out across the ...
0
votes
0answers
39 views

How can I create a 2D camera with zoom and parallax scrolling that works on every Windows Phone resolution?

Mario game that uses parallax scrolling: http://www.youtube.com/watch?v=de5f3mvRyIY I want to create a Windows Phone jump-and-run game with parallax scrolling. The parallax scrolling should be like ...
1
vote
2answers
48 views

XNA graphics.PreferredBackBufferWidth's new value doesn't immediately change window size

I set the width and height of the window in my game constructor, and then pass the graphics manager to a class to check the value. In the game's initialize function, it doesn't seem to recognize the ...
1
vote
1answer
80 views

why am I being unable to access public array of a class inside other class? [closed]

I know this question has been asked before but my case is different(or i could not gather any kind of help from those) I am facing "NullReferenceException: Object reference not set to an instance of ...
1
vote
2answers
170 views

Unity - OnDestroy - When is it called?

I was wondering about the method called OnDestroy in Unity (4.5.2f1) on Windows 8.1 Update 1. I know garbage collection in C# in non-deterministic, so I was wondering if game objects had OnDestroy ...
0
votes
1answer
78 views

Find world matrix

I'm making my first 3D-game with XNA (MonoGame) and have come to a point where I wish to add a crosshair for the player. To do this I need the on-screen coordinates of the location where my fighter ...
1
vote
1answer
118 views

Farseer: How can I create a body with a hole in the middle

I want to create a shape that looks like the black contour in this picture: The shape must be empty in the middle(white surface). The white surface must not be part of the shape, just the black ...
0
votes
0answers
34 views

Add terrain collision and fix axis of camera

I made 3rd person camera script which works ok but needs few tweaks which I don't know how to fix. I'm using controller/ joystick. -Firstly, camera has this issue: when I look at the back of the ...
1
vote
1answer
109 views

Sever Structure for a Turn Based Game (Chess) [closed]

I am working on a Turn-based Game (Chess) I have done the client part and single player mode so AI is no problem here. But the only problem is now I want to make my project multiplayer. I have done ...
0
votes
1answer
43 views

Can't consistently add to TimeSpan for Unity Game

I'm making a game that has a timer showing how long the player has survived from being crushed by pessimism. (Long story) I'm trying to use TimeSpan in Unity to accomplish this but it seems that I'm ...
0
votes
2answers
77 views

Switching a project written in Lua to a compiled language [closed]

I am experimenting with game development in Lua using the Love2D framework, and while it works fine, I am getting tired of using a dynamic scripting language. I would like to have better performance, ...
-1
votes
1answer
39 views

Object reference not set to instance of an object Unity3D c#

public class player { public projectile pro; pro = GetComponent<projectile>(); void Update() { GameObject go = GameObject.Find("enemy"); Transform ...
16
votes
7answers
3k views

Is there any Lua API that works with C# for PC & XBox 360 Development?

I am reading a book on Game Development in which they show you how to make scripts for your game in Lua. They program Lua and use it from C++, but I was wondering if there is a library or API to use ...
0
votes
1answer
37 views

Getting Target position at the time of shooting

I have a bullet that has to hit a constantly moving enemy. So, in BulletScript, I have declared a Transform public Transform enemy; //and assigned enemy object to it that is ...
1
vote
2answers
36 views

C# - Collision Detection problem with platforms on Monogame(XNA)

So I am having issues with my platformer that I am developing. I can detect collisions fine when there are a line of parralel blocks or even single blocks. The issue I have is when blocks form an L ...
1
vote
2answers
74 views

Loading and storing content efficiently

So for example I have a class called TypingKeyboard. It allows you to display a string while it's being typed by the computer with sounds. I need one in the menu, for the title. And one for the ...