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
86 views

Is it bad practice to add GameComponents and DrawableGameComponents outside of the main initialization method?

I'm working on a snake game that has multiple game objects (snakes, apples, obstacles), and game modes (classic, adventure), that are DrawableGameComponents. Is it OK that I'm adding them as needed ...
0
votes
1answer
49 views

Combination Keypad in Unity

Im having a slight problem in getting my Combination keypad to work. Ok so basically I'm using gameObject buttons to use for the numbers 0-9. So each gameObject button has a number link to it. The ...
1
vote
1answer
127 views

Opentk LookAt() and 'eye' argument rotating

I'm trying to create rotating camera, which looks down by 45 deegre like this: However my code for rotating eye vector is not working properly and I achieve vertical rotation, when it should be ...
1
vote
0answers
73 views

Dynamic Level Loads [ Story Saves ] [closed]

I have recently revisited the legend of zelda series and got inspired by it to create a game similar to majora's mask. After some slight work on the player movement and key game mechanics I started to ...
0
votes
0answers
206 views

Calling an android method from Unity3D with a JAR plugin

I am developing a game with Unity only for Android platform and I am requiring to share content of my game through an intent so I have implemented a JAR plugin according to several tutorials with this ...
1
vote
1answer
121 views

In a TPS, how to aim bullets to the direction the camera is pointing, but make the shooting from the player?

(In C#/XNA.) I mean, I can't find an answer nowhere. I'm trying to learn how to make a Third Person Shooter, especially like the one I found in a game called "M.A.R.S.", from Epic Games. I don't want ...
-1
votes
3answers
426 views

Move camera on X and Z only

How would you implement movement on a camera in order to always move it on X and Z coordinates, and if the camera has pitch yaw or roll it still moves only in those coordinates and doesn't fly up?
1
vote
2answers
213 views

How should I store edge weights in my A* graph in C#?

I am working on A* pathfinding in Unity, using C#. I am currently implementing Dijkstra's shortest path algorithm. I have a Dictionary with nodes as keys and corresponding lists of adjacent neighbors ...
-1
votes
1answer
1k views

How do I make a health bar that drains when the player takes damage? C#/XNA

I've drawn a Health Bar before and had it drain/refill on a button press using if statements and rectangles. First I loaded the image, then I set a new rectangle to be equal to the image's height and ...
1
vote
1answer
110 views

Downsides of using this integration formula for movement?

So I read that Gaffron integration basics tutorial and noticed how the Euler integration method gives a small error over time. I implemented the RK4 and noticed that with constant acceleration, I ...
0
votes
2answers
116 views

Destroy GameObject as an Array of Transform instantiated destroying the whole array

I am trying to destroy a GameObject with the Destroy() method, but when I call it the whole array is destroyed, not just that element. //Instantiating the prefabs public Transform[] blue; foreach ...
2
votes
1answer
369 views

Sending POST data with WWW in Unity C#

I would like to use Unity's WWW class to send a an HTTP request with POST data. So in my server, my PHP script can do something like $number = $_POST["NUMBER"]; According to ...
0
votes
1answer
48 views

XNA tiling a sprite with a camera.viewmatrix in the Draw method

I'm looking for help fixing a small problem that I have with my XNA game project. I currently have: spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, ...
-1
votes
1answer
134 views

Show message to one player issue in multi-player game

I Needed to show message to only one person of the multi player game,i am using smartfoxserver to developed a board based game and in this game how to differentiate 2 players in unity c#,and also how ...
1
vote
2answers
137 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 ...
2
votes
2answers
185 views

How can I combine chasing and obstacle-avoidance in a steering-based AI?

I'm developing a top-down game in XNA with enemies that wander until they are within range of a player, at which point they begin chasing the player. This works, but I also want them to avoid ...
3
votes
1answer
79 views

How do I edit a Texture2D at run-time to visually indicate connected tiles?

I'm making a 2D sandbox game in C# and MonoGame, and I have a couple of tile sprites. These tile are loaded in-game as Texture2Ds. I want to have blocks visually connect to adjacent blocks. An ...
2
votes
1answer
88 views

Lidgren peer to peer

I am currently integrating Lidgren into my Unity game. I need to move away from the built in networking capability in Unity because of the style of game I am making, basically MMO, I will have far too ...
2
votes
2answers
230 views

Processing periodical operations on the database [duplicate]

I program MMO strategy game (C# monogame) like Goodgame Empire or Travian for Windows Phone. The server part of the game will run on Windows Server and MS SQL database. I'm trying to figure out a ...
0
votes
2answers
73 views

HLSL Shadow Mapping occurs only around player

I've recently begun playing around with Monogame (OpenSource "remake" of XNA). My current task is to write a simple shadow mapping shader. After following Riemer's XNA Tutorial I got the shadows to ...
0
votes
2answers
43 views

Can you save a png in XNA larger than the backbuffer width?

I'm looking at using the 'savetopng' method of the texture2D class to draw out custom textures. My problem is that my viewport is quite small (the application runs in a window) and the textures will ...
0
votes
0answers
70 views

Very strange trigger behavior in Unity2D (4.5)

I am developing 2d platformer and I've faced with a very strange triggers behaviour in Unity. I have made the enemy that can throw objects into main player. So I have made two empty GameObjects with ...
1
vote
2answers
111 views

Trying to better understand Unity gameobjects

New to Unity, but develop in C# normally. I can't seem to get how / why / where to grab certain elements. For simplicity, I have a top-level game object, say a cube. I add a sphere to the scene as ...
-1
votes
1answer
55 views

Finding and reading a script on a mouse-selected GameObject

I can't work out how to access and read changes in a script of a gameObject that has been selected. The script selects enemy objects with right mouse button and player objects with left mouse button. ...
3
votes
1answer
75 views

Colision detection of disc (Maximum Material Condition aka “Flatness”)

I have a 3D-laser scanner which gives me a series of points of a real-world object. The points are related by a common origin. I know I can derive the equation of a plane from 3 points and that the ...
2
votes
1answer
276 views

change texture at runtime

How can I change the texture at runtime. I have done changing the label(text) at runtime. The following code is used using UnityEngine; using System.Collections; public class switchtime : ...
2
votes
1answer
284 views

Handling game-state updates in an MMO while the player is logged out

I have a plan to build MMO strategy game like Goodgame Empire or Travian for windows phone. I want program it in C# Monogame (because I have some good experiance with it). But I still can't figure ...
1
vote
1answer
162 views

Converting a GameObject method call from UnityScript to C#

Here is the UnityScript implementation of the method i use to generate a randomly tiled background, the problem i'm having relates to how to translate the call to the newTile method in c#, so far i've ...
2
votes
3answers
373 views

Why are my Unity procedural animations jerky?

I'm working in Unity and getting some crazy weird motion behavior. I have a plane and I'm moving it. It's ever so slightly getting about 1 pixel bigger and smaller. It looks like the it's kind of ...
0
votes
3answers
166 views

How do game servers / clients handle data?

How do servers handle data? I understand the concept of the client sending the player pos and then the server sending back the area to display and also sending other player positions and such. But ...
1
vote
1answer
153 views

A problem with texture atlasing in Unity

I have the texture below and I need to get rectangular parts from it. I could finally combine meshes of different quads to improve performance, but I with quads of different tilings, this means ...
0
votes
1answer
43 views

Tilemap collision problem [closed]

I have a method here that returns true if a collision is detected between the player and tile. private bool CheckCollision() { foreach (CollisionTile tile in ...
3
votes
3answers
83 views

Can you offset the horizontal flip in SpriteEffects XNA?

As the title suggests I need to know if there is a way to offset the SpriteEffects.FlipHorizontally component in the XNA draw method. My reason for this is the sprite I am attempting to flip is not ...
-1
votes
2answers
69 views

Speeding up sprite the second time it passes the screen [closed]

I'm a student studying Games Development. I want a sprite to speed up on it's second passing of the screen. How do I do this? Code I wrote so far: public class Game1 : Microsoft.Xna.Framework.Game { ...
1
vote
1answer
209 views

How do I add a border to rectangles using a shader?

I want to draw some rectangles with a border. Currently I render the fill with glDrawArrays(Triangles, ...) and the border with glDrawArrays(LineLoop, ...). Is there a neater way? I'm targeting ...
0
votes
1answer
76 views

C# XNA Rectangle.Contains returns false? [closed]

I am creating a simple XNA game. My mainMenu class contains a list of strings for menu options wich I draw on the scren using spriteBatch.DrawString. I've set Vector2 variables to controll the ...
0
votes
2answers
247 views

Water Physics In top down 2D game

I have been making a game like Minecraft or Terraria in which you add blocks and such to the world, and I came across this interesting debacle, the game is in a top down 2D perspective, and I would ...
0
votes
1answer
152 views

Rectangle touch sides of another rectangle

I am making a platformer game and im trying to make the player collide with all the blocks, here's a picture: The blocks is stored in List and im trying to get the side's of the block usin static ...
0
votes
1answer
166 views

Moving gameobject with animation according to my script Unity3D

I am developing a game with Unity3D with an horizontal list of elements which you can move with arrows. Here you can see an example: I have created animations in order to modify the alpha value of ...
2
votes
3answers
124 views

Steering behavior using nodes

I've started rewriting some of my code (npcs, navigation and such) and I need some help with my new navigation system. Basically the way it works is: the game generates a random dungeon. For example: ...
0
votes
1answer
82 views

How can I make an object change direction?

I have a moving cube that, when it moves over an arrow, should change its direction to the direction of that arrow. What would I need to do in order to accomplish this?
0
votes
0answers
94 views

Unity - 2D - Scaling to fit between two objects

The game is a top down 2d shooter and I'm facing trouble in doing this : - I got a player 2D ship - The player fires laser, which is a long thin image with box collider attached. - What I want is that ...
0
votes
1answer
515 views

How can I make my player move in the direction the camera faces?

I have a 3rd person camera which can rotate around the player. My problem is that wherever camera is facing, players forward is always the same direction. For example when camera is facing the right ...
1
vote
0answers
100 views

Collision detection implementation suggestions

I'm working on a simple 2D game involving a rotating octagonal ring where a sphere sprite moves up/down avoiding objects as the ring rotates faster and faster. I'm having a difficult time with the ...
0
votes
1answer
56 views

Shared Material

I have this simple script, so the user touch one of the cubes all cubes with same material will change color. One of this cubes must have the name of the color on it, only one, so the user touch the ...
1
vote
1answer
2k 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) ...
2
votes
0answers
94 views

Enable IME in a non-windows control

I'm writing my own game in DirectX using C#. I'm at the point where I'm implementing my own textbox, written from scratch. It has the very basic functions for now, but works well. I want, however, to ...
3
votes
6answers
3k views

Can I develop Linux + Windows games using C#, .NET and OpenGL?

I want to learn to develop 3D and 2D graphics with either OpenGL or DirectX. I chose OpenGL as it's being used in webGL and works cross-platform. I already know .NET well, and the C# language just ...
0
votes
1answer
99 views

Gun Bobbing Algorithm Math Explanation

I stumbled across this really neat algorithm which I don't fully understand. It simulates a camera's bobbing effect commonly witnessed in first person shooters while running/walking. I'm mainly unsure ...
2
votes
3answers
140 views

Persistence of Random

Sorry if this is such a simple thing, but for some reason I can't get my head around it. Imagine you have a world, that you have "seeded" with a value. You base all your randomisations off this ...