xna

I can not run a published application on another computer

我是研究僧i 提交于 2019-12-11 03:34:32
问题 I have developed a game in Visual Studio C# with XNA. When I publish the application, in a ClickOnce Application, it works fine on my computer. However, I tried to .zip the folder and upload online through ftp and when I download and install on a different computer it does not work. It just says "'Application Name' has Stopped Working". Can anyone help me? 回答1: The error message you are getting is because the .NET Framework or XNA Framework of the correct version is not installed. You could

How to create a Timer that does something?

人盡茶涼 提交于 2019-12-11 03:24:43
问题 I'm quite new in XNA C# and I would like to know how do I create a timer in XNA C# that does something after few seconds. I've seen a Flash tutorial that does what I need but I don't know how to do it in XNA C# I'm trying to use a timer to make a blinking model in certain period of my project. Therefore, I need to know how do I start the timer and how does the timer toggle the blinking of my model. Thanks. 回答1: Do something like below in update float elapsedTime = (float)gameTime

Applying Coefficient of Restitution in a collision resolution method

橙三吉。 提交于 2019-12-11 03:16:15
问题 I have a collision resolution method in my physics engine, that goes like this: Vector2 n1pos = n1.NonLinearSpace != null ? n1.NonLinearPosition : n1.Position; Vector2 n2pos = n2.NonLinearSpace != null ? n2.NonLinearPosition : n2.Position; Vector2 posDiff = n2pos - n1pos; Vector2 posDiffNormal = posDiff; posDiffNormal.Normalize(); float totalRadius = n1.Radius + n2.Radius; float posDiffLength = posDiff.Length(); float interPenetration = totalRadius - posDiffLength; float averageRestitution =

Change and scale resolution of XNA game

早过忘川 提交于 2019-12-11 03:07:37
问题 I have a game, initialized to run at 1920x1080. All sprites, Vectors etc. are specificly properly placed, to match the 1920x1080 genre. I have an enum , stating what res, the game is told to use. 1920x1080 would be the standard. Is there a way to, let's say, have a resolution of 1280x960, in the way of this: The game window is 1280x960 Game resolution (backbuffer) is still 1920x1080, but is scaled down to fit the window - 1280x960. A bit like, just before the draw event, capture the screen

How to save one click if key is pressed?

烂漫一生 提交于 2019-12-11 03:06:17
问题 When I hold the key A , bears explode all the time . What I want, is when I click once explode only one , and wait for another press to explode another one. KeyboardState board = Keyboard.GetState(); int newRandomX = rand.Next(800); int newRandomY = rand.Next(600); float newVelocityX = rand.Next(-5,5); float newVelocityY = rand.Next(-5,5); Vector2 myVector = new Vector2(newVelocityX, newVelocityY); if (bear0.Active && board.IsKeyDown(Keys.A)) { bear0.Active = false; boom.Play(bear0

XNA - How to change orientation of Drawing a List of Strings

浪尽此生 提交于 2019-12-11 02:41:53
问题 How do you Draw a list of strings with a spritebatch so that it looks like this; Item1 Item2 Item3 Item4 Instead of Item 1 Item 2 Item 3 Item 4 or instead of: Item1 Item2 Item3 Item4 回答1: Something like this would make it a little easier to change later on: int y = startPointY; int x = startPointX; int switchAt = items.Count/2; //<--- or where ever you might want to break up the strings int max = 0; for(int i = 0; i < items.Count; i++) { spriteBatch.DrawString(font, items[i], new Vector2(x, y

DirectX game with no prerequisite software to run

青春壹個敷衍的年華 提交于 2019-12-11 02:31:48
问题 I'm new to programming with DirectX and I want to know how should I create a DirectX game. Will there be a way to package all the required files for people to run without the need for additional software? I'll add the exception that they'll need to install DirectX. What I mean is, when I try to run an executable version of a DirectX program on a computer that isn't setup to create DirectX projects, I get an error like "d3dx10_43.dll is missing" and I have directX version 11 installed on that

xna 4.0 error on loading texture2d

不问归期 提交于 2019-12-11 02:26:00
问题 using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; namespace Project { /// <summary> /// This is the main type for your game /// </summary> public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager

Creating A C# & XNA 'Monster Dash' Like Game

你。 提交于 2019-12-11 02:07:13
问题 I decided that my last year C# project would be a 'Monster Dash' like game, I would develop it using C# and XNA, and it would be targeted for PCs, I am using Microsoft Visual Studio 2010, and XNA Game Studio 4.0. The game would be a 2D game, not 3D. Thinking on the development process, a few problems rise up: First , I need to create a 'sort-of-platforms' which the player will run on and will have holes and gaps between them (which will appear randomly) and I have no idea how to do that! The

Convert 2 vector2 points to a rectangle in xna/monogame

▼魔方 西西 提交于 2019-12-11 01:40:07
问题 I have some code which will detect the start and end point of a click-and-drag action, and will save it to 2 vector2 points. I then use this code to convert: public Rectangle toRect(Vector2 a, Vector2 b) { return new Rectangle((int)a.X, (int)a.Y, (int)(b.X - a.X), (int)(b.Y - a.Y)); } The code above does not work and googling, so far has come up inconclusive. Could anyone please provide me with some code or a formula to properly convert this? Note: a vector2 has an x and a y, and a rectangle