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

1
vote
1answer
178 views

How do you make a bullet ricochet off a vertical wall?

First things first. I am using C# with XNA. My game is top-down and the player can shoot bullets. I've managed to get the bullets to ricochet correctly off horizontal walls. Yet, despite using similar ...
0
votes
0answers
32 views

XNA Guide text input - maximum length

so I am using Guide.BeginShowKeyboardInput to get the user to enter their username. I would like this to be limited to 20 characters, and it seems to break expected behaviour to let them input ...
0
votes
0answers
66 views

Maintaining State in Mud Engine

I am currently working on a Mud Engine and have started implementing my state engine. One of the things that has me troubled is maintaining different states at once. For instance, lets say that the ...
0
votes
1answer
246 views

How do I efficiently display image tiles in Unity 4.3 free

I previously wrote a TileEngine with SFML that I would like to port to Unity3D 4.3, but have not found a way to draw a tile on the screen programmatically in Unity. All I am looking for something ...
0
votes
0answers
27 views

Transparency in XNA-4 primitives

I'm using XNA 4 with Visual Studio 2010. I'm trying to create a simple 3D world with walls and doors in which the user to free to roam around. A wall is just a rectangle which is currently being ...
2
votes
1answer
135 views

How can I draw an Xbox Live avatar?

I want to replace the main character of my 2D game by an Xbox avatar. How can I do that? How can I add an avatar to my project? How can I draw an avatar? For example, I draw my main character like ...
1
vote
2answers
97 views

How can I use voice commands to control my game?

Is it possible to use simple voice commands like "run right", "run left", "jump", "stop", "attack", "defend", "finish" to control the player in a Windows Phone 8 game? How can I implement voice ...
3
votes
1answer
360 views

XNA, how to draw two cubes standing in line parallelly?

I just got a problem with drawing two 3D cubes standing in line. In my code, I made a cube class, and in the game1 class, I built two cubes, A on the right side, B on the left side. I also setup an ...
4
votes
1answer
270 views

Unity falling body pendulum behaviour

I wonder if someone could provide some guidance. Im attempting to create a pendulum like behaviour in 2D space in Unity without using a hinge joint. Essentially I want to affect a falling body to ...
4
votes
1answer
518 views

Problem getting information about running processes with .GetProcesses() in Unity3D on OS X

I was going to ask this on Unity Answers, but I keep getting an error when trying to get to the site so thought maybe you guys could help. I've also tried the Unity3d subreddit and didn't manage to ...
2
votes
2answers
395 views

Zelda-style top-down RPG. How to store tile and collision data?

I'm looking to build a Zelda: LTTP style top-down RPG. I've read a lot on the subject and am currently going back and forth on a few solutions. I'm using C#, MonoGame, and Tiled. For my tile maps, ...
5
votes
0answers
94 views

No idea of how to simulate car crashes [closed]

I have a simple car game with all the basic collision detection and movement in Unity with C#. But when I was building the "engine" for the game I didn't include a detail I later decided to include. I ...
1
vote
1answer
68 views

Textures have lines between them when zoomed out

These are two screenshots from my new game, a top-down RTS with tiles. The first one is from a normal view with no zoom, the second one is a zoomed out view of the whole map: In the first image, ...
2
votes
1answer
65 views

Why are my 2D world click-positions offset after camera movement?

I'm writing a 2D game engine. I need to add a camera to my world that can zoom in and out as well as move away from its initial position at (0,0) at the center of the world. The main issue can be ...
1
vote
1answer
77 views

How can I scale Farseer bodies so that they work on different screen resolutions?

I created a little Windows Phone 8 game that supports multiple resolutions. If the resolution of the device is less than 720p, then the sprites and their corresponding Farseer bodies need to be scaled ...
1
vote
1answer
224 views

Adding an existing script to a gameobject programmatically

Is there a way to take a script and apply that specific script to an object through code? In pseudocode, what I'm trying to do is essentially as follows: ObjectOne.MyScript = ...
0
votes
1answer
143 views

How do I set up a depth buffer in SharpDX?

I draw some instanced cubes, but when i rotate the camera (or the world) some cubes that should be behind other cubes are drawn before the cubes. I already had this issue a long time before and i ...
1
vote
3answers
156 views

How to manage variables and/or data?

Let's say I have a class A with many constants (over 20) and variables (also around 20). Class B represents a character so it has a lot of constants and variables representing various stats. Class C ...
2
votes
1answer
94 views

SpriteBatch, trying to reduce draw calls

This my main draw call: Matrix Camera_transformation = player_camera_.GetTransformation(); // Background - AlphaBlend spritebatch.Begin(SpriteSortMode.Deferred, ...
1
vote
2answers
263 views

Drawing cube in SharpDX, wrong perspective

I want to draw a cube. This is what i currently have: As you can see, the perspective is VERY wrong. The the size in the z-direction is too small and the difference between the front and back size ...
0
votes
1answer
109 views

Projecting a light onto a quad

I need to project the light onto the quad and use its value for translating the vertices. I'm currently having 6 vertices, two quads, The points are A X C B Y D Point X, Y are coming from two ...
1
vote
2answers
211 views

Which Design Patterns Should I consider for Quest Management? [closed]

I am working on an fantasy RPG and I would like to get some ideas about how I am implementing Quests. Quests in my game are very generic. The quest goal can be almost anything in the game. The goal ...
0
votes
1answer
149 views

How to solve the overlap of two circles that collide

I have two circles , one of the circles is static the other is moving around. I have a method that checks whether the two circles collide. How to make the two circles don't overlap when colliding? ...
0
votes
0answers
57 views

C# Fit an image into the outline of a 2d sprite character body perfectly

Ok, I'm trying to wrap my head around how to begin doing this. I tried on stackoverflow.com but my question was downvoted/closed for being "too broad"; so here goes again in more detail. I have two ...
2
votes
1answer
176 views

How can I create or extrude a mesh along a spline?

Let's say, for example, that I have a working spline. I want to use this spline to create a mesh, but I'm not quite sure how to go about it. For example, I want to create a road along this spline. I ...
8
votes
1answer
4k views

Microsoft XNA Platformer Example, is the Collsion Detection implemented accurately?

The example provided by Microsoft seems as if the collision detection (from what I can see) will have a small error. When the user collides with an Unpassable tile, the depth of the intersection is ...
0
votes
1answer
121 views

Saving and retrieving high-score data in XNA 4.0 [closed]

I made a game in XNA 4.0 and now I need to save the points in a database or in a file (or in something else). My goal is to store and retrieve the highest score if I choose that option in the main ...
1
vote
2answers
158 views

how to call the specific animation?

I have a script to control the player simply moves Left, move right, etc.. but the animation when winning, losing, or Light, just put it on the animation and animator and no script for it. I wanted ...
1
vote
3answers
78 views

Identify a selected prefab rather than all of them [closed]

I am trying to play a particle effect when an enemy is killed but it seems to play on a randomly selected one rather than the one that was hit. However the enemy that was hit still disappears and ...
2
votes
0answers
92 views

Improving effect performance in XNA

I'm making a 2D, top-down platformer, in which four or five layers are rendered each time the game draws. Everything is fairly performant except for the bottom layer, which is the game map. This is ...
0
votes
1answer
83 views

Can't get the logic behind my AABB collision

This is my collision detection function in the maze game im working at. I never made a game before and I dont have that much programming experience. The question I keep asking me continously is why ...
0
votes
1answer
72 views

Convert triangles to quads of a Mesh

Supposing I have applied delaunay triangulation on a convex mesh, and I have all information (edges, vertices etc.) I would like to transform the triangles to quads I was reading that inverse ...
1
vote
0answers
68 views

How can I detect the screen resolution of a Windows Phone device?

I want to detect if a device uses WVGA, WXGA, 720p or 1080p resolution. In addition, I want to store the resolution of the device in a variable. For example, if the resolution is 800x480 pixel, then ...
0
votes
1answer
194 views

How to properly handle top down 2D collision?

I can never seem to get this right, well polished at least. I'm creating a top down game in XNA, and collision has always been an issue for me to do properly. Detecting collision is fine, but ...
0
votes
0answers
28 views

How to implement a lightmap [duplicate]

I saw this answer and I got what he has done, but how do I create a lightmap same as this one? thanks in advance! (from what lightmap should be built from (array?) and how do I calculate a lightmap ...
0
votes
1answer
50 views

How can I use a filter to scale down my sprites?

I want the best visual result on my Windows Phone if I scale down my sprites from 1920x1080 pixel resolution to 800x480 pixel resolution. How can I use a filter to scale down my sprites? Which ...
0
votes
0answers
49 views

Trying to get an object to move back and forth on collision between two collidable objects

Im trying to get a box object to hit a collidable wall on the right and when it hits it move left and hit the left wall and switch back and so on and so forth. Im having trouble with this because ...
4
votes
2answers
230 views

How can I support different screen resolutions without scaling the sprites?

I already tried to support different screen resolutions with scaling the sprites. But if I scale my sprites from 800x480 to 1920x1080 pixel, then the sprites look blurry. I want to use different ...
1
vote
0answers
92 views

Unity crashes completely when I rotate my objects [closed]

I've started my first tiny Unity project and after 20 minutes I run into a brick wall. My goal was to create a Android 2D game with falling polygons, that you have to click and they disappear. ...
1
vote
2answers
179 views

Unity3d not allowing endpoint to save cookies

So I'm using an external DLL with Unity to login to a web service and access functions from it. The DLL works perfectly fine in a command prompt project, but when run in Unity I can log in ...
1
vote
2answers
105 views

MonoGame - 2x2 texture scaling issue

I've just recently switched from XNA to MonoGame and now I've run into something that has never happened to me in XNA before. I've created a 2x2 texture and filled it with a color by doing this: ...
1
vote
1answer
310 views

How can I create a resizeable 2D camera with parallax scrolling?

I want to create a Windows Phone jump-and-run game with parallax scrolling. The character should always be in centered in the viewport. I use the following camera so that the viewport looks on every ...
3
votes
1answer
99 views

Obfuscating Monogame assets

I'm obfuscating spritesheets. I've already encrypted the .txt file dictionaries. Now I'd like to perform binary serialization on the image files. Texture2D does not allow for this though, probably ...
3
votes
1answer
107 views

Explanation of matrix transformations

I've been looking for something that can help me understand matrix transformations. I've been to multiple different sites, including Wikipedia and quite a lot of related questions on SE and other ...
2
votes
2answers
131 views

XNA: Non-overlapping shadows

I want to create an effect similar to the following in XNA / MonoGame: There's a background and a semi-transparent shadow consisting of several objects (two circles in this example). However, the ...
3
votes
2answers
90 views

How can I read the color of a specific pixel in XNA?

I want a way to find out if, for example, the pixel at Vector2(2, 5) on the game window is color Color.Red, or some other color or set of coordinates. How can I do this?
0
votes
1answer
69 views

Why is the player not resting in the center of the camera?

Is it possible to create a combination of the following two cameras described in Andrew Russell's answer? XNA Platformer Sample: Supporting multiple resolutions? I want to implement a scrolling ...
0
votes
1answer
37 views

Scaling/Rotating triangle

I have a Triangle class and a list of triangles representing my 3D model shape. When I update the position, the rotation or the scale of my model, I also want my triangles list to be updated. I ...
3
votes
2answers
110 views

Separate “Battle Character” class from “Character” class?

So I have a Class called Character which represents all the player, his companions, and all enemies. This class does a lot of things including performing actions upon other characters, and upon the ...
3
votes
1answer
116 views

How should I draw the GUI if I use a 2D camera?

I have a camera in my 2D side scrolling game and I want to implement the GUI. How can I do that? For the moment, I draw everything like this: spriteBatch.Begin(SpriteSortMode.Deferred, ...