xna

Calculating in radians the rotation of one point around another

懵懂的女人 提交于 2019-12-11 07:14:03
问题 I have been trying to get this problem resolved for week and have get to come to a solution. What I have is 2 points in a 2d space, what I need to resolve is what the rotation of one is around the other. With luck the attached diagram will help, what I need to be able to calculate is the rotational value of b around a. I have found lots of stuff that points to finding the dot product etc but I am still searching for that golden solution :o( Thanks! 回答1: Vector2 difference = pointB - pointA;

“This model does not contain a SkinningData tag.” exception

女生的网名这么多〃 提交于 2019-12-11 07:09:39
问题 I've been using tutorial from wikibooks, but I'm stuck at model rendering. ( http://en.wikibooks.org/wiki/Creating_a_Simple_3D_Game_with_XNA/Rendering_Your_Model ) When I try to compile, I get this exception: "This model does not contain a SkinningData tag.". What I though about, is that model wasn't exported properly, but it doesn't work after using model from their site. I will be thankfull for any help. 回答1: I figured it out! When you import your model into VS, right click on your model,

Player not drawn during countdown before game screen XNA

ⅰ亾dé卋堺 提交于 2019-12-11 06:23:22
问题 Basically before i implemented inheritence into my game, introducing 2 new classes, player and enemy, (not using enemy atm), the level was loaded and drawn (including the player paddle) during the countdown screen (the countdown before the level starts). Now all of the level is drawn apart from the player paddle when i have implemented inheritence into my game, inheriting from a class called Paddle, where the Player and Enemy classes are derived classes. I have experimented between overriding

Mouse clicked and released XNA

蹲街弑〆低调 提交于 2019-12-11 05:33:45
问题 I'm trying to make a main menu for a game and I'm having these problems when I tap(or left click) on an area . I've seen many game menus for WP7 that after you release the click it does something. Well I'm trying to display an image when it's pressed and make a sound when it's released. How can this be possible? Here's my code: //putoClick's = Mouse.GetState(); //clickarea = the same dimensions as putoClick; if (putoClick.LeftButton == ButtonState.Pressed) { mouseClick = new Rectangle

xna model not appearing, advice needed

懵懂的女人 提交于 2019-12-11 05:08:49
问题 What I have: game class model class for my ship Camera class when I Press F5 my game opens, it shows blue, but my model doesnt appear, anyone got any advice for why this is happening? if anyone would be able to help i would really thankful. 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

How to store and handle ingame recipes [closed]

醉酒当歌 提交于 2019-12-11 04:56:59
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . I am building a Terraria like game and I am having a problem with where to store the recipes.. basically what my game should do is go through the player inventory (which is an array of id's) and check recipe by recipe if all the item's are in the player inventory. I dont know

Clearing the screen

ε祈祈猫儿з 提交于 2019-12-11 04:41:49
问题 SomeClass.cs public void clearscreen() { main.GraphicsDevice.Clear(Color.Black); } Why can't I clear the screen by calling on this method from another class? protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); mainMenu.MenuDraw(); spriteBatch.Draw(cursorTexture, cursorPosition, Color.White); spriteBatch.End(); base.Draw(gameTime); } The clearscreen method is being called from within mainMenu.Draw(); 回答1: You need to pass your

2D BoundingRectangle rotation in XNA 4.0

梦想与她 提交于 2019-12-11 04:38:11
问题 I'm having trouble working out what I need to do in order to have a 2D BoundingRectangle for a sprite object in my game rotate and update position depending on which way the user wants the sprite to travel. I draw out the sprite with it's rotation and scale values like so: spriteBatch.Draw(texture, position, null, Color.White, rotation, origin, scale, SpriteEffects.None, 1f); My current setup for getting the BoundingRectangle is: public Rectangle BoundingRectangle { get { return new Rectangle

C# XNA Draggable UI

荒凉一梦 提交于 2019-12-11 04:38:02
问题 I created a GuiWindow class that held a texture, title, and rectangle so I can draw the texture and title. I've been trying to make it draggable, though I am having a bit of trouble. Originally I had the GuiWindow's bounds rectangle just lock onto the mouse positions: if(bounds.contains(MouseHandle.Update()) && MouseHandle.Pressed()) //checks if the bounds rectangle contains the mouse rectangle and the mouse left button is pressed { bounds.X = MouseHandle.Update().X; bounds.Y = MouseHandle

world velocity to local (ship might be flying backward so need worlds negative velocity etc.)

断了今生、忘了曾经 提交于 2019-12-11 04:36:51
问题 title pretty much says it all.. say I have a ship, its worldVelocity is a Vector3 with these values: X: 0 Y: 0 Z: 1 (assuming +Z is Forward, +Y is Up, and +X is Right) this Vector3 is added to the ships worldTranslations Matrix which stores translation and rotation. worldTranslations.Translation += worldVelocity and my ship goes forward, and it stops accelerating at speed 1 (correctly) as this is its target velocity, but what if the ship has been rotated Right 180 degrees, so its now flying