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
1answer
100 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
0answers
35 views

C# Monogame & Farseer Physics: Collisions

I am a begginer. I am using Monogame and Farseer Physics Library in C#. (latest versions) In my game, whenever my ball (circle) hits the corner of a rectangle, (or even another circle), it is ...
2
votes
1answer
40 views

How to create laser redirection?

Think portal 2, where a laser can go through a cube, and depending on the rotation of that cube, it will redirect it. Examples: Here is my barely functioning code. It works for one cube, I'm able ...
0
votes
0answers
61 views

How do I create a dungeon mapper [on hold]

I'm attempting to write a dungeon mapper based on the random dungeon generation tables in the AD&D DMG starting on pg. 169. What I don't know how to do is, where do I start? Meaning, I don't know ...
0
votes
0answers
89 views

How manage target selection in a high speed brawler?

I'm thinking of games like Batman Arkham Asylum and the Assassin's Creed series, in which landing the first blow gives you a soft lock that automatically rotates you to continue facing the target as ...
0
votes
0answers
14 views

Draw my array at a position defined with Vector2

I'm developing a space invaders game in C# using XNA Game Studio. So I got some of the invader logic complete: An array holds the invaders and draws them on the screen, animated and moving.But I can't ...
0
votes
1answer
54 views

How do I avoid going through objects at high speed? [duplicate]

I am quite the beginner in XNA. I have only recently started using GameComponents. I have a multiplayer game called Better Pong. I move the ball (which is an object) by incrementing the Vector2 (the ...
2
votes
1answer
73 views

Modular enemy behaviour in a shmup - Delegates unsuitable?

I'm creating a shmup type game and trying to implement the enemy wave system, which includes the associated enemy behaviours like their movement and bullet patterns. I've tried to separate the ...
1
vote
1answer
33 views

Unity 4.6: Position jumps when switching Canvas render mode from Overlay to camera in code

In the project I am currently working on I have two sets of main UI: one set that is on the screen at all times for the players use, and the second set which the player can open and look at to gauge ...
0
votes
1answer
31 views

How to invisible first window on click unity3d

I have a window called "red window" on scene1. When i click on the hello world button it should displays another window called green window and the first window should invisible. How it possible. ...
0
votes
1answer
217 views

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 ...
-1
votes
1answer
72 views

Sprites get terribly scaled

I've been making a Space Invaders game in XNA for a while. I got the invaders animated and contained within an array. But when I call spriteBatch.Draw and debug the invaders sprites get a huge ...
0
votes
2answers
278 views

Set new forward directions based on camera position

I have a 3rd person camera which can rotate around the player. When I look at the back of the player and press forward, player goes forward. Then I rotate 360 around the player and "forward ...
0
votes
1answer
36 views

How to access multiple 2DTexture which is assigned in Unity3D inspector panel created by an array in C#?

I am making a puzzle game, i made 5X5 cube, lets take example of orange. very left column is orange, upper with orange dot is static and lower with orange dot is also static. inbetween there are 3 ...
0
votes
1answer
34 views

Is there a way to use the ContentManager with full directory paths

So i want to figure out a way to use the ContentManager.Load method with full directory paths, so lets say Content.Load<T>(@"Images\SomeImage"); becomes ...
0
votes
1answer
103 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 ...
-1
votes
0answers
16 views

Xna collision Prob [closed]

i have problem with doing game 2D now till now i did: create Player + map + Keyboard+ mouse now i am doing the collision with the Player and the map and i try that if the Player though One or more ...
0
votes
2answers
34 views

Loading content into an Winforms/XNA Editor's content project

So i am bulding a game editor/engine basically for teh lulz but i have encountered a problem i cannot seem to fix, i cannot load any new content through the Winforms UI during runtime. I tried using ...
0
votes
1answer
38 views

Trigger scene loading in one device from another device using Unity WWW class

I have a master device and client device. I want to load a scene in the client device by pressing a button in the master. My method is, when the button is pressed in the master device, a data is ...
0
votes
0answers
38 views

C# BreakOut Game [closed]

Hi this is my first year of Uni doing a programming degree, I am beginner to the whole concept. Firstly I need help with getting the ball (which is drawn in a pictureBox) to collide with the bat ...
0
votes
1answer
45 views

Copying a texture's colors to a new texture to create a new sprite

Let mySprite be some .PNG sprite: Texture2D tex = mySprite.texture; Sprite sprite = Sprite.Create(tex, new Rect(0,0,tex.width,tex.height),new Vector2(0.0f,0.0f),1.0f); The resulting sprite can be ...
0
votes
1answer
60 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
47 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
0answers
18 views

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

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
1answer
368 views

Simple heart container script for 2D game (Unity)?

I'm attempting to create a simple mobile game (C#) that involves a simple three-heart life system. After searching for hours online, many of the solutions use OnGUI (which is apparently horrible for ...
0
votes
0answers
41 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 ...
-2
votes
0answers
68 views

Can anyone explain that code? [closed]

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 = ...
3
votes
1answer
332 views

Jittery Movement, Uncontrollably Rotating + Front of Sprite?

So I've been looking around to try and figure out how I make my sprite face my mouse. So far the sprite moves to where my mouse is by some vector math. Now I'd like it to rotate and face the mouse as ...
0
votes
1answer
38 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
153 views

touch in guiTexture

Before time in my game start. i want there will show a guiTexture.. if i touch this guiTexture, that will hidden and the time game will start. I try to make a script but it doesn't work. I'm a bit ...
0
votes
1answer
37 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 ...
0
votes
1answer
48 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 : ...
2
votes
4answers
115 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. ...
1
vote
2answers
95 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; ...
5
votes
3answers
909 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
27 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
21 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
1answer
58 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 ...
-1
votes
1answer
67 views

C# - How to properly play background songs in XNA

So I'm using the game states (enum) to change my game screens. I have 2 songs for main menu and game playing states, respectively. To play songs, I'm using an old code example I saw at MSDN, like ...
1
vote
2answers
111 views

control animation using animator control class

I did a sample existing code to control animation using animation.I dragged and dropped a character into the scene then I added a Animator to it and added the animator controller.Below I have given ...
2
votes
1answer
154 views

How to impale and stack targets correctly according to the collider and its coordinate?

I'm making another simple game, a catch game, where a spawning target game object must be captured using a skewer to impale it. Here how: At the start, the falling object (in red) will fall in a ...
0
votes
0answers
50 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 ...
0
votes
1answer
20 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 ...
-1
votes
1answer
46 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
81 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
2answers
97 views

animation control problem

I have a list of .FBX object.When I drag that .FBX into scene its corresponding inspector Animation component(fig 1) appears but when I drag some other .FBX object into the scene the Animator ...
0
votes
1answer
210 views

Generating a particle effect on top of a GUIElement (Unity)

I am working in Unity on a 2D project which is using C#. I have a number of guitextures which are hearts in order to create a sort of life meter. I would like when the player loses a heart for the ...
35
votes
9answers
4k views

How are deterministic games possible in the face of floating-point non-determinism?

To make a game like an RTS networked, I've seen a number of answers here suggest to make the game completely deterministic; then you only have to transfer the users' actions to each other, and lag ...
0
votes
1answer
314 views

Unity Gui from text file templates

I've been banging my head against a wall this past while over how I might create menu's and menu components in unity from text file. I would normally just build my own extended panel/label classes etc ...