C# is a multiparadigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.
4
votes
4answers
2k views
Is C# different in Unity?
Does Unity use a different version of C#, or is it all the same? It looks different from regular C# but there are some regular C# elements in there.
0
votes
2answers
125 views
How do I create a knockback-movement?
I am a web developer new to game development, and with limited math knowledge. I am writing a character movement controller in Unity. The game has an isometric Diablo-like camera. The character moves ...
-1
votes
0answers
37 views
Spawning objects at 3 Diffrent locations randomly [on hold]
I'm new here and I have this simple practice code. I would like to spawn objects on three different locations of my boxes. One ball will spawn then after around 1 second, another one will spawn in ...
11
votes
3answers
2k views
Best way to store game-wide variables
I have an options Screen for things like Difficulty, Resolution, Full Screen, etc but I'm struggling to find the best way to store/obtain these variables at game time.
The way I've currently decided ...
0
votes
1answer
39 views
Blender animation to XNA distortion bug
I followed the instructions on the following video: http://www.youtube.com/watch?v=SissgQ0IXvk
I'm using XNA 4.0 and Blender 2.69
I export the model with animation to a .FBX file.
The animation is ...
0
votes
0answers
63 views
C# graphics framework for 2d games [on hold]
I am looking for a 2D graphics framework for my game. When searching for a graphics framework for c# you get a few results. MonoGame, xna, slimDx, direct X, openTK and c#'s graphics class.
Xna - no ...
1
vote
1answer
44 views
MonoGame hosted in a control/form
I would very much like to host my monogame window inside a Form so that I can take advantage of the nice gui elements in the C# framework when creating a simple level editor. I have looked online, but ...
0
votes
0answers
61 views
Backward Compatibility Save Game System [closed]
I am creating a Turn-Based-Rogue-Like and I am currently working on the Save Game System. I am able to save/load the game without difficulty by serializing the data; however this causes an issue when ...
0
votes
0answers
13 views
Triangle does not show up using SlimDX
Here is the code:
var elements = new VertexElement[] {
new VertexElement(0,0,DeclarationType.Float3,DeclarationMethod.Default,
...
0
votes
2answers
74 views
Make a square flickering at a preset frequency
I'm working on a medi-sci project where I want the patient to use brainwaves to exercise control the environment.
The environmnet is a 2D game where the game character is to be controlled by 2 ...
0
votes
1answer
32 views
Is there a build-in function to count the amount of sprites drawn by SpriteBatch per frame?
I'm hoping to find out how many sprites are on the screen at any given time.
In other words, is it possible to find out how many times spriteBatch.Draw();
is called between spriteBatch.Begin(); and ...
0
votes
1answer
79 views
How should I detect collisions with objects on a “timeline”?
I'd like to replicate this game's mechanic of the player smashing walls with a precise timing to a background rhythm.
How should I check when each wall should be broken? Does the player animation use ...
3
votes
5answers
145 views
Can I extract Flash SWF sprite frames to bitmaps?
I want to create the 2D graphics of my game in Flash Studio, but then get all the frames from my SWF movies into C# for further work in Unity3D.
I find it easier to create nice smooth animations in ...
0
votes
1answer
85 views
Angled topdown perspective camera for 2.5d game
I have a 2d tile based game created using Unity's 2d tools and orthographic camera:
The tiles are created by programmatically generating a mesh, assigning a texture to each pair of triangles, and ...
2
votes
1answer
33 views
Unity refuses to open 2 popup windows
So am am making a unity program, where if you click 2 different objects, 2 different windows are supposed to pop up.
To make them, I use private
private bool showPopUp = false;
private Rect ...
1
vote
0answers
35 views
XNA Library DrawPrimitives throwing primitiveCount error
I downloaded the project from here http://silverlight.bayprince.com/tutorials.php?tutorial=13 and tried adding a new OBJ file with a few thousand vertices listed.
The classic teapot works but when I ...
1
vote
0answers
30 views
Monogame render between constraints
I have, in MonoGame, a project for which I require the game to not use the full screen depending on the resolution. The game elements etc all behave as they should (So they bounce off for example ...
0
votes
0answers
42 views
how to add a spotlight effect to my targetenemy code
The current targeting code below changes the color of the enemy with tab button:
Target enemy = change color of enemy to 'green'
Deselect enemy = change color of enemy to 'blue' (press tab again)
...
1
vote
0answers
48 views
Any easier way to add networking to an XNA game? [closed]
I know that the MSDN has an article on this but I'm not developing for Xbox so I'm not sure if I should use NetworkSession or LocalGamer etc etc because I think they are Xbox only. But I haven't tried ...
1
vote
1answer
75 views
Farseer: 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
0answers
27 views
Unity 3d: the difference developping in javascript/C#? [duplicate]
What is the difference(strong or weak)? I have asked several programmers, but they told me there is a preference topic.
2
votes
1answer
105 views
Is it more efficient to use an A* algorithm or a line system drawn in pathfinding in C#?
I was recently introduced to the A* algorithm when I asked a friend about making AI/NPC's in video games move to certain points and it sounded very interesting. I am building an FPS and it has AI that ...
2
votes
2answers
132 views
Pathplanning A* Getting stuck in wall
I'm having a problem with my pathplanning.
I can plan a path and make my character follow it, that's not a problem but then i plan a path around a wall it takes the shortest way as A* suggests, which ...
1
vote
1answer
86 views
Obstacle Avoidance With Walls in C#
I'm trying to do some obstacle avoidance. Yet somehow something is not going quite well.
I've used the book "Programming Game AI by Example" to create a simular function in c# in combination with XNA.
...
2
votes
1answer
62 views
How to subscribe to an event fired from any Instance/Object of type X
I'm currently working on a small game-engine and i'm kinda stuck on finding the right pattern to subscribe to an event fired from any instance of type X.To understand what i'm trying to achieve, here ...
1
vote
1answer
87 views
Trigger for Melee-attack not working
I'm currently trying to add a melee-slash attack to my Sidescroller.
For that I decided to to have an invisible box-colliders infront of my character. My idea is to activate it when the attack-key is ...
4
votes
2answers
75 views
What is the most efficient way to work with lip sync/facial expressions in XNA?
I've been searching for an answer forever, but I haven't found one. What options are there for lip sync/facial expressions in video games made with XNA? I have a few models for a game I'm building, ...
1
vote
3answers
109 views
Removing something on Collision?
I have my collision detection code working so how would I tell my HealthPickup to disappear when my Player collides with it? I haven't played around with it yet but I think I may have to somehow ...
1
vote
0answers
75 views
How do I save a screenshot and load it as a texture for use in game?
I have a Unity level that takes a screenshot taken in the previous level and applies it as a material to a Plane, the problem is that it will get stuck and not apply the most recent version of the ...
0
votes
1answer
54 views
Detecting Hitbox Collisions (Rectangle)
So I have some Hitboxes set up on 2 classes, HealthPickup and Player.
public static Rectangle Hitbox;
public override void Initialize()
{
Hitbox = new Rectangle(Pos.X, Pos.Y, 32, 32);
}
That's ...
0
votes
2answers
53 views
Load Prefab to variable
I have my code, for my weapon:
using UnityEngine;
using System.Collections;
public class Arma : MonoBehaviour {
public static int municao;
GameObject bullet;
GUIText texto;
// Use ...
1
vote
0answers
53 views
Windows Phone 8.1 emulator for DirectX landscape
My issue is that the Windows Phone 8.1 emulator in Visual Studio 2013 is displaying the landscape mode sideways. The image is landscape and looks correct, but it's rotated 90 degrees, sitting on one ...
-2
votes
2answers
64 views
C#Script select GameObject
I want to load the prefab instead of the gameobject that is in the screen, my code is this one:
using UnityEngine;
using System.Collections;
public class Arma : MonoBehaviour {
public static int ...
1
vote
2answers
84 views
How to Calculate Velocity in a 2D space game
I am currently using
screenpos.X = (float)(screenpos.X + velocity * Math.Sin(r));
screenpos.Y = (float)(screenpos.Y - velocity * Math.Cos(r));
For my Movement with r being the Rotation in Radians. ...
1
vote
1answer
77 views
More Precise PathSmoothing
I'm reading a book about AI - Path planning and path smoothing. Yet this book is using c++ code. And i'm coding in c# with the XNA framework.
I have a path smoothing working, yet the book says it can ...
0
votes
1answer
46 views
How to modify Game1.cs out of an object it contains? [closed]
Assuming I Have a List<SomeClass> myList; in my Game1-class. It also contains an object of SomeOtherClass otherClass;. How would I modify myList (Add/Remove) out of the otherClass's logic? Or in ...
0
votes
1answer
65 views
Why is my Simplex Noise appearing in four columns?
I'm trying to make a Texture out of Simplex noise, but it keeps appearing like this regardless of how big or small scale is:
The following code is used to produce the image's color date:
private ...
1
vote
0answers
10 views
Do I need to worry about inlining in Unity/C#? [migrated]
For code clarity I sometimes create a function that should very obviously be inlined, be it either a wrapper, or a function that is only called in a single point, or a short function that is supposed ...
0
votes
0answers
24 views
Unity3D : Prefab Instancing Issue
I am using latest unity engine and I am having a scripting issue.
I create a prefab , added a few scripts to it and I am trying to instantiate a few of those objects like this :
GameObject ...
0
votes
1answer
28 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 ...
1
vote
0answers
16 views
Is it possible to change the position of a Farseer joint tie point?
When I create a revolute joint in Farseer, then there is always a tie point in the center of each of the two bodies. Is it possible to change the position of a tie point?
For example:
I created a ...
0
votes
0answers
44 views
Particle friction with variable timestep in XNA
Alright, so I'm working on an engine of sorts in XNA (yes, it's deprecated, I know) and I'm implementing my own particle system. I've defined a "ParticleEffect" such that when it's supplied a GameTime ...
2
votes
0answers
55 views
How can I combine multiple bodies into one in Farseer? [closed]
I want to create a windmill in Farseer, but I don't know how to combine the 3 windmill sails bodies to one body. During gameplay, the sails could get destroyed. For example, if another body hits one ...
0
votes
0answers
39 views
hide and show many guiTexture
in the 1 scene there are many guiTexture. So how to write this code ?
public class guiTanya : MonoBehaviour {
public GUITexture guiA, guiB, guiC, guiD, guiE, guiF;
void onMouseDown() {
//if i press ...
0
votes
2answers
122 views
Problem with moving player through a secript by a set distance
I am currently trying to add a sort of "dash"-ability to my sidescroller.
What I try to do, is to let the player press a key where a simple key-press causes the player to move quickly into one ...
0
votes
1answer
67 views
How can I move bodies in Farseer, using touch input?
The player should be able to move a Farseer body with it's fingers. How can I do that? What is the best way to create a Farseer body for the player's finger so that the player can move other Farseer ...
-1
votes
0answers
28 views
Repsonse Height Mask Issue
I've been working on a collision detection based around creating a height mask and then moving the player up until a transparent pixel. The problem I'm having is that the character is being pushed all ...
0
votes
1answer
73 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 ...
0
votes
0answers
5 views
How to parse a null to a null in Enum.Parse? [migrated]
This is my code:
return (Skills) Enum.Parse(typeof(Skills), CSData[(int)cs].Requirement);
But since sometimes there is no requirement (ie value is null) i want in that case to parse the value null ...
1
vote
1answer
105 views
Multithreading issues - Frame skips [closed]
So I am trying to multithread a Voxel engine in C# made with Sharpdx and I am having a few issues:
This is the class I have :
#region
using System.Collections.Concurrent;
using ...