Tagged Questions

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

some images on grid are not being displayed using random . [on hold]

So I have an image that is going to be presented in a grid in random spots and I have a 2d array that will check if a position in the array is available or not. the problem is that not all images are ...
0
votes
0answers
28 views

Dynamically destroy objects when player enters a boxcollider2D

What would be the best approach for destroying dynamically objects when player enters a boxcollider2D? Currently using parent objects with boxcollider2d to activate OnTriggerEnter2D, boxcollider2d is ...
-1
votes
0answers
57 views

Can anyone explain that code? [on hold]

public class Player : MonoBehaviour { public float speed =10f; public Vector2 maxVelocity = new Vector2(3, 5); void Update () { var forceX = 0f; var forceY = 0f; var absVelX = ...
0
votes
1answer
52 views

Unity, Cannot change a single Vector2 element of mesh.uv?

I have a simple procedurally generated mesh, with uvs that tile correctly for(int i=1; i<vertices; i++) { uv[i] = new Vector2(x,z); //pseudocode } mesh.uv = uv; This works fine. However if ...
0
votes
2answers
46 views

GUI Text counter Skips numbers after a few seconds

The counter counts perfectly up until the first bump. After this it starts to add about 4-5 "points" instead of just 1. using UnityEngine; using System.Collections; public class GameController : ...
0
votes
1answer
35 views

I am trying to implement a falling animation to my game and i am having alot of problems doing so

i am trying to have it so that when my character isnt touching anything he plays an animation of falling, yet when he moves from one game object to different one, he plays the animation. for example ...
0
votes
1answer
32 views

Change one prefab without changing all prefabs

I have this code that will spawn in a lot of prefabs. It then edits the prefabs. The problem is that every time it changes a prefab it will reset and move all the other ones. Can you please explain ...
-1
votes
0answers
29 views

C# OpenTK - How to get a Bitmap from a loaded Texture [on hold]

After some searching around, I put this code together: public static Bitmap BMPfromTextureID(int id) { int w, h; GL.BindTexture(TextureTarget.ProxyTexture2D, id); ...
-1
votes
1answer
63 views

Game Lag due to so many vertices and edges in Unity free version [on hold]

Actually, I'm new to Unity and I'm making a car racing Game. Now, I'm stuck at some point. My Problem is:- When i run my game into phone, It stuck badly and reason is--- Whenever there will be ...
1
vote
2answers
85 views

Framerate dependent movement

I'm moving my character controller using Euler integration like this: Vector3 originalPos = transform.position; Vector3 acceleration = Physics.gravity; velocity += acceleration * Time.deltaTime; ...
0
votes
1answer
40 views

Transparency using HLSL in XNA

I currently working on Depth Data on Kinect SDK v1.8 on XNA and I wanna show an Image Inside the Depth view of Human body. the image below is just an example of what I wanna do : ...
0
votes
1answer
26 views

Editing the components of an instantiated prefab

Is it possible to edit one or more components of an instantiated prefab ? For example if you instantiated five cube prefabs. Is it possible to reference each of the cube prefab and change a value ...
-1
votes
1answer
16 views

Sound plays several times upon collision

Upon collision, my sound effect plays several times. How can I fix this? public Sprite charAlive, charDead; public AudioClip popAudio; void OnCollisionEnter2D (Collision2D col ){ if ...
0
votes
0answers
24 views

Resize gameObject when it has extended a restricted area

So here i have an image will provide a better understanding of my problem. So currently i have some white blocks and within the white blocks i have some cyan bordered boxes. So the current problem i ...
0
votes
0answers
33 views

Sample source code for coordinated group movement. Preferably in c# or java [on hold]

I implemented Astar algorithm from andengine gles2 for path finding in my android RTS game. Now i want to implement group movement. Anyone can point to some sample source code for coordinated group ...
5
votes
3answers
896 views

How to find path in graph without crossing the walls?

I would like to know how to find path in a graph while having the edges "double-sided". Consider this scenario: I have list of the line segments. These represents "walls" or rather impassable edges ...
0
votes
1answer
55 views

Marching cubes leaving holes in the mesh

Hi I'm trying to reproduce GPU Gems 3 chapter 1 (Generating Complex Procedural Terrains Using the GPU) and so far I managed the basics... Now I'm betting some strange output. I started with the ...
0
votes
0answers
49 views

Load character instead of load level

I have some trouble finding out how I can load my character at the start of the level, instead of resetting the whole thing. The game mechanics are quite straight forward; don't touch the walls. If ...
-1
votes
1answer
39 views

How to increase player Lifes count

I am new in Unity Game Development. I am designing infinite game using C# scripting. There are many cubes in my game scene. if single cube is hit by player, He gets 100 points. if same color, two ...
0
votes
1answer
19 views

How can I Separate model parts when I click on it

Here I am using a heart model, in dis model I want to identify each part .Under the model Iam having 3 part(Sub1,Sub2,sub3)When I click on the each part how to separate or differentiate it by using ...
2
votes
4answers
111 views

.fnt font file offset issues in Unity

I want to display 2D text in Unity using bitmap fonts (.fnt files). There are some solutions out there, but I'm writing my own. Each character is a game object with a SpriteRenderer. It works. ...
0
votes
1answer
79 views

Collectible Card Game Card Text To Code Association

I am making a collectible card game using a command pattern for using card abilities and creating a class for each card text ability. The game is setup to work with an authoritative server structure. ...
0
votes
0answers
32 views

Game Development Books [duplicate]

I am looking to expand my C# knowledge and am looking into a fun, long term project to help expand my knowledge. I've been studying programming for about a year, but I would still consider myself a ...
0
votes
1answer
97 views

C# XNA - How to animate using Texture Atlas/ Sprite Sheet

I have a problem which I need to resolve. I am making a Space Invaders game in C# XNA. I've been following this tutorial for the Invaders: ...
0
votes
0answers
32 views

How do I apply Farseer Physics Engine Collision on my image? I tried it on my codes and it is not working

How do I apply Farseer Physics Engine Collision on my image? I tried it on my codes and it is not working. PoolGameSingle poolgame = new PoolGameSingle(); var cue = poolgame.CueStick; ...
0
votes
1answer
71 views

OpenGL not rendering full scene, it is a mystery [closed]

I am trying to draw a scene in the sort of style of mock vector graphics. I've helped on a 2D game before with GLSL, but I tried to keep a simple approach to this project since I'm working by myself, ...
0
votes
3answers
140 views

Do I need to learn any physics if I use a physics engine? [closed]

Complete novice out here. Of course I know basic physics like mass and inertia. I don't want to make an engine I just want to make a game and use a physics engine made by someone else. Do I need to ...
0
votes
0answers
47 views

How to overlay texture materials on top of each other in Unity 2D tiled game

I'm learning how to do a 2D tile-based game. So far, I have followed this tutorial which seems like a good starting point. With his method of building the raw triangles and then applying the uvs, I ...
0
votes
2answers
90 views

How to Create a New Instance of a Game Object

Alright, please don't scald me here haha. I'm very new to XNA, C#, and game development as a whole. I have done web-design, but that is my main experience with programming. It is a Space Invaders ...
0
votes
3answers
103 views

OpenGL Texture Mapping distorts image

So, I'm just trying to draw a texture to two triangles that are the same size as the viewport, but it breaks up the image and distorts it. I have tried resizing the image file and everything, but ...
0
votes
1answer
177 views

2D sprite 360 degrees rotation according to the mouse

I am trying to make my top down character rotate according to degrees between its position and the mouse. I'm using this code: float xDiff = mouseState.X - (graphics.PreferredBackBufferWidth / 2); ...
0
votes
1answer
71 views

How to rotate and move a model in the direction it is facing?

I am not using Unity or XNA. Eventually, I will probably use OpenTK for graphics. But for the concept of a game I'm writing, I am using the console for keyboard input and visual logging of events, ...
0
votes
1answer
125 views

OpenGL: I only see one square instead of a cube / giving information to vertex shader

I am new to OpenGL and tried to follow this tutorial. I use C# and OpenTK. So I translate the C++ Code from the Tutorial: My C#-Code: /* Hintergrundfarbe */ ...
1
vote
1answer
48 views

Yield and loading textures

I have a need to dynamically load textures from the player's filesystem. WWW provides the functionality I need, but I can't get the example code to compile. "yield www" causes my code to not compile. ...
0
votes
1answer
41 views

Loading Song in MonoGame Windows

I cannot load the song into my game. I got error in both templates WindowsDX and WindowsGL. Monogame Develop Build 1252 Both files .wma and .xnb are exist in Content folder and Build Actions are sets ...
0
votes
2answers
80 views

How to cleanly serialize/de serialize a Dictionary whose values are of a derived class using c# newtonsoft json [closed]

I am working on and entity component system and I am storing entities as a JSON file. Components are stored in an entity as a Dictionary of components. I am using newtonsoft's JSON library. After ...
0
votes
1answer
35 views

Using RPC's for movement of an object across a network [closed]

I've been building upon http://www.gamasutra.com/blogs/DarrelCusey/20130221/187128/Unity_Networking_Sample_Using_One_NetworkView.php At the moment when I spawn a sphere on the server it spawns on the ...
0
votes
0answers
66 views

Cards game - Save and reload state

I have developed a card game in c#. When the user left the application, I serialize into a XML file the state of the current game (current playing player, cards of each players, scores...). But, I ...
-1
votes
0answers
38 views

Problem with shooting projectiles at mouse cursor [duplicate]

I'm shooting projectiles from one point to another, first point is near entity, another is mouse position. Problem is I can't make projectile to be shot directly at position where mouse is pointing, ...
1
vote
1answer
84 views

Draw Primitives with Unity 2D

I would like to be able to draw primitives in unity 2d to define my game objects. I have tried the following example: using UnityEngine; using System.Collections; public class ExampleClass : ...
0
votes
1answer
59 views

Spawning a Sphere and trying to move it [closed]

I've been trying to build upon a blog post on Gamasutra http://www.gamasutra.com/blogs/DarrelCusey/20130221/187128/Unity_Networking_Sample_Using_One_NetworkView.php In this I would like to spawn a ...
0
votes
0answers
14 views

Monogame. Xml files not included on deployment

We are making a XNA game and porting it with MonoGame. The game works fine on deployment, it finds without a hitch the xml files we need for the content. On publishing however, the files are never ...
3
votes
1answer
149 views

How do you make specific collisions in Unity?

So I have created a "game" where you are automatically running across platforms and you can jump and land on the top of them. I want to set it where if you collide with the the left and right side of ...
0
votes
2answers
50 views

Issue implementing proper collision in XNA Game Studio 4.0

I am building a game in XNA 4.0, where a player moves about a 2 dimensional (vertical perspective) map consisting of blocks. My issue is creating proper collision between the payer and the blocks ...
0
votes
2answers
51 views

Collisions are not working in Unity [closed]

For some reason my collisions are not working. This is what the code I have. void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "wall") Debug.Log ("It worked"); } When my ...
-1
votes
1answer
46 views

How to temporarily disable input?

I have made a jump script and I want all input to be ignored when you are in mid air (so that way you don't have infinate jumps). How to do this?
0
votes
2answers
130 views

How do I have a camera follow my object in Unity?

I have an object that automatically moves by itself and I want the main camera to automatically follow it.(Like in games such as geometry dash and jetpack joyride) This is the code for the automatic ...
0
votes
0answers
30 views

C# XNA Weird black line behaviour of sprite animation spriteBatch.Draw()

So I've been making a Space Invaders game in XNA. I have my ship spritesheet (sprites are left-to-right - horizontal). The spritesheet has 6 sprites. Here's my class: playerShip.cs using System; ...
0
votes
2answers
66 views

c# Unity - Matrix output incorrect on vector rotation

I have a input Vector (1,1,0) when I run it through a Unity Matrix4x4 class with a rotation of 90 degrees around the Z axis the output is (-0.9999999,1,0) which is nearly correct but strange. But ...
0
votes
1answer
82 views

How can I allow players to draw decals for their avatar and items?

I want the player to be able to draw a simple symbol, even if it's pixelated black or white, that their character can have on their weapons, armour, forehead or even markers and monuments. How would I ...