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

0
votes
0answers
8 views

Adding Player Movement and Firing on Touch Input (Unity)

I am having many problems with this. I am a new game developer and I am using a Unity tutorial. But I want to add touch input for movement and a touch button for firing the weapon. How can I do this? ...
0
votes
2answers
24 views

Using shader for cubes

I am trying to use a shader to get an effect like this. Notice how every cube has exactly the same lightning as every other no matter where it is on the screen if you look closely the lightning is ...
1
vote
1answer
23 views

Implementing rule engine so Mud engine supports D&D, Pathfinder and other rule sets

I am currently building a Mud game engine and have quiet a bit of it done. I am now starting work on building out how characters interact with the world around them, such as dialog, battle searching ...
0
votes
1answer
21 views

XNA draw texture/font and DrawIndexedPrimitives at the same time

When i Draw a texture2d or a font with spriteBatch and also draw GraphicsDevice.DrawIndexedPrimitives, the frame is draw weird SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice); BasicEffect ...
0
votes
1answer
32 views

Help with understanding “transform.root.GetComponent<>” in Unity

I'm reading through a tutorial for making an RTS in Unity, and in certain scripts it wants you to make a Player field and then OnStart(){ transform.root.GetComponent}. I am not quite getting what that ...
0
votes
1answer
24 views

Drawing 3D cubes with xna

I managed to draw a 3d cube using triangles like this: protected override void LoadContent() { basicEffect = new BasicEffect(GraphicsDevice); VertexPositionColor[] ...
0
votes
0answers
16 views

Arrange Jumble Word into English Word

Actually I want to make a Game. Game is very simple. There are 5*5 matrix with Jumble words and player needs to arrange those words into proper English Word. I have done small part of ...
2
votes
2answers
140 views

How can you subscribe to Unity input events, instead of polling for them

Been trying for days to figure out if there is a way to subscribe to keyboard/mouse events in unity. Instead of having to poll for them every frame and make my own events. Right now I poll through ...
3
votes
3answers
574 views

Creating an in-game time system only works with real time

I'm trying to create an in-game time system. Thus far it only works properly if you use 1440 minutes to the day (realtime), but I would like to be able to alter the day length to something like 10 ...
1
vote
2answers
49 views

Unity prefab script “GameObjects” can't be ones on the scene?

Currently, I have an object on the scene, and one in prefab. I want the prefab's script to reference to the object on the scene through the public GameObject obj; code. However, when I tried to ...
0
votes
2answers
57 views

Accessing colliders from one script C#

I want to access specific colliders(to see if they are been clicked) from one script insted of making multiple scripts for every collider.How? I am using unity. using UnityEngine; using ...
0
votes
1answer
39 views

How can I add banking and rotation to this object manipulation script?

I have made a drone script that allows user to move in four directions and ascend/descend. I found a nice tilt snippet which makes the thing bank when it moves. However, when I include this, the ...
0
votes
1answer
53 views

Unity, Why a Text object can't be edited?

I have an input field and event that calls a function when I press enter. public Text theText; I take the Text part of the input field (connect them in editor), display the content and set new ...
0
votes
1answer
60 views

Rotate camera keeping player not in the middle

Here I have a 2D top down game. Currently the camera is set on the player position. The player constantly points to mouse position. I want to modify this setup having the camera to be set slightly ...
0
votes
1answer
47 views

Multiple models not drawing

I got Camera, Terrain and player working, moving around, etc. When I try to add another player (another model to draw) it just dont any of the models. Here is my code; public class World { public ...
-1
votes
0answers
70 views

FPS Drops From 59 to 29

I am creating a 2d platformer and I am getting fps drops from 60 to 20. It might be my collision code, but this was the only way I could get it to work with slopes. private void CollisionCheck() { ...
0
votes
0answers
25 views

Is there a successor to Farseer for C# 2D physics? [closed]

I'm currently relying on Farseer Physics 3.3.1 and was recently considering to upgrade to 3.5, but it appears that the project has been abandoned by its author - which makes me a little insecure on ...
0
votes
3answers
117 views

Drawing image with an angle

Edit: the images below aren't supposed to have whitespace. I am just trying to show you that i am trying to create a rectangle from a 1x64 image, positioned as shown in the second picture I know how ...
0
votes
1answer
79 views

Lightning bolt effect with particles is not continuous

I am Drawing a lightning effect animation using this image: Below the result: As you can see the outcome is not a continuous purple color as I wanted it to be, but it has black spaces in ...
-1
votes
1answer
44 views

How to remove the jitter from my pong AI movement?

I am developing Pong using Monogame / XNA and my AI paddle is really jittery when the ball is moving more horizontally than vertically. My AI is very simple and works as follows: If the ball's ...
0
votes
0answers
36 views

Unity Height Field Fluids

I am trying to implement the fluid simulation in the slide deck found here in unity. http://matthias-mueller-fischer.ch/talks/GDC2008.pdf I was able to implement what is found on page number 2, the ...
0
votes
1answer
45 views

How to check a value from the last frame, while using events in Unity

What I am trying to do is check if a value has changed from the last frame, while using events. Typically I could use threading to my advantage and have a check at the bottom of Update() to see if a ...
0
votes
0answers
32 views

Farseer physics engine: save world simulation and load at a later time

I have created a windows desktop game using monogame and the Farseer Physics engine (FPE 3.5). In this game I would like to the user to be able to save the game and continue at a later time. When I ...
0
votes
0answers
3 views

How can I remove / delete a picturebox during runtime? C# Windows form [migrated]

I am coding a basic game. The player collects a gem by touching it; this adds +1 to his score. The gem is a picturebox, and I want to dispose of it once it is collected. As far as I know, this isn't ...
0
votes
1answer
69 views

Unity 4.6 UI Replace Images on selection in List of buttons[i]

I made a list containing all the buttons in the UISelectionCanvas and would like to change each image as it is being selected. The problem is once the selection selects a new type of unit it will ...
2
votes
0answers
47 views

Client-Server Game Communication (w/ Protobuf, Relevancy and Delta Compression)

So, I have reached another problem while trying to implement my client-server communication. From everything I've read there are three main ways to minimize packet size: Only send what has changed ...
0
votes
1answer
45 views

Add XNA math references to non-xna project

I'm developing some game with server/client structure, and the client will predict the movements, but it should be validated by the server. In the client part, I got it moving nice, but now I'm trying ...
0
votes
1answer
42 views

How can I load another form containing a new level when my player reaches the current level's exit?

I am coding a very basic side-scrolling game in C#, using Windows Forms. I want to connect my game's levels with 'exit points'. When the player touches an exit point, a new form should be loaded ...
0
votes
0answers
12 views

Separate each model part by “CRTL+MouseLeft”

I have a model,I want to separate each part of the model by using "CTRL+Mouseleft.I have done the part separation by clicking on each part.Now I need to separate each part by "CRTL+MouseLeft".How can ...
0
votes
1answer
26 views

How to rotate model 180º with XNA

I got a model, and a camera pointing at this model, I think my camera position is the problem. Its showing the front of the model, but I want it to show its back like in third person. My camera code ...
0
votes
1answer
69 views

How to make a model parts glow one after the another

I have a brain model. I want to glow the parts of the brain model one after the another after a period of time. I have done to glow the parts, but when the second part glows, the color of the first ...
0
votes
1answer
35 views

Accessing Canvas and Button components in a scene

I have a scene with the following hierarchy: This is game scene and the game manager is a singleton with the following variable fields: // canvas public Canvas PauseCanvas; public Canvas ...
1
vote
1answer
98 views

How can I merge multiple sprite into one sprite or texture using Unity3d?

I have an avatar generator where someone can create a custom avatar with layers superimposed. And in order to reuse this image multiple times, i want to merge all layers in one image. Is there any way ...
0
votes
1answer
53 views

Play continuous music when swapping between multiple scene in Unity3d

I have the following scenario Main menu scene containing a gameobject with an audio source component An about us scene gameObject script : using UnityEngine; using System.Collections; public ...
1
vote
1answer
54 views

Changing color of UI Text in Unity into custom values

There are a few objects in the scene as well as a title. I want the title to change its text and color based on the object that is mouse-overed. The script below is added to each object that is ...
2
votes
3answers
137 views

2D Smooth Tile Lighting

I am currently working on a 2d platformer and have the general idea of how to apply 'lighting' to my level, but I am not sure at all how to make it smooth, similar to Terraria, as you can see here. ...
0
votes
1answer
35 views

How to make a gameobject Scale up from another GameObject script

hi there im having a rought time with this code, trying to make a gameobject grow in scale from touching this one, and when a set amount of scale is reached destroy this game object ( the one who ...
0
votes
1answer
33 views

Array Rectangle Collision Handling Inconsistency XNA 4.0 [closed]

I made a simple collision detection prototype.Here's the code for the Player class's collision handler: public void handleCollision(GameObject OtherObject) { ...
1
vote
1answer
41 views

XNA texture garbage collection

I use a Dictionary<string, Texture2D> for storing textures and every texture in the game is a reference to a texture from this dictionary. However when all references are gone, does the ...
0
votes
1answer
45 views

Issue with fps limiting in XNA

The game I am making runs at 60 fps, but occasionally it will drop lower than that. I want to limit the frame-rate to 30 fps so that those drops will be less noticeable. I don't understand everything ...
0
votes
1answer
48 views

Implementing Client-Server Delta Compression (with Protobufs)

I am writing a 2D real-time RPG in C# and I am trying to implement client-server communication using protocol buffers. I am trying to figure out how to implement delta compression to reduce message ...
2
votes
1answer
52 views

Event error: “…can only be called from the main thread”

I have some custom networking classes which I'm trying to use in a unity game (c#). The network class raises events, which I want to subscribe to in the game code. However, whenever I try to do ...
1
vote
1answer
80 views

Resetting a level in unity when exiting to main menu

I have a pause screen in my game having two buttons : resume game and exit to main menu The main menu have only 1 button wish is play, when i click on exit to main menu the main menu level is ...
1
vote
0answers
33 views

Incorrect Texcoords for Bitmap Font? [on hold]

I am writing some code to display text using a bitmap font. However, when I run my game to see my results, I am greeted with a blank screen. I changed the texture to pure white to see if it was even ...
5
votes
5answers
1k views

How can I test whether points are within a polygon?

I have 2D-points, which boundaries depict a polygon. The points are at integer positions (no fractions possible). Now I want to build an enumerator in C# that returns all points that are inside the ...
0
votes
2answers
149 views

How do I create a simple clickable button?

I've tried to attach this function to the play button. public void Play () { Application.LoadLevel("Scene1"); } I've created an empty Game Object and attached my script to it. But when I go to ...
0
votes
1answer
44 views

give a prefab clones a script from another prefab in Unity3d

I have the following : TurretBallmanager : using UnityEngine; using System.Collections; public class TurretBallManager : MonoBehaviour { // Use this for initialization public GameObject ...
0
votes
1answer
34 views

Unity: Object is underneath another object but shouldn't be

I have a simple collision detection program. The red object is controlled by the user and the yellow object is always moving up and down: However, when the objects are supposed to collide, the red ...
1
vote
2answers
64 views

XNA/Monogame inverting a BoundingBox

I have a box that is drawn around my game that I want to check collisions with. Currently my BoundingBox is made in a way that whatever is inside the box is colliding with it: BoundingBox bb = new ...
1
vote
0answers
33 views

Make FPS Controller in Unity suitable for Touch? [closed]

I have a standard fps controller in my app that is controlled by default via mouse. What is the best way to make it touch friendly? Is there something that needs to me modified in the FPSController ...