xboxscene.org forums

Author Topic: Xna Controls For Spacewar  (Read 264 times)

hessec

  • Archived User
  • Newbie
  • *
  • Posts: 32
Xna Controls For Spacewar
« on: August 30, 2006, 01:20:00 PM »

I installed XNA Game studio express and I tried out the sample that came with it "MySpacewar". When I tried to debug it, it had the starting screen and displayed the buttons i needed to press to use options (x, y a , b whatever). I pushed every key on my keyboard, and I got no results. Has anyone had luck playing it with a computer?
Logged

xxANTMANxx

  • Archived User
  • Newbie
  • *
  • Posts: 11
Xna Controls For Spacewar
« Reply #1 on: August 30, 2006, 03:50:00 PM »

you need to comment out the

CODE

#if USE_KEYBOARD
#endif


its in the GamePadHelper.cs
Logged

GeToChKn

  • Archived User
  • Full Member
  • *
  • Posts: 245
Xna Controls For Spacewar
« Reply #2 on: August 30, 2006, 06:40:00 PM »

that or plug a 360 controller into your computer and use that.  the XNA kit only allows input from keyboard, mouse and a 360 controller.
Logged

vsaiyan

  • Archived User
  • Newbie
  • *
  • Posts: 28
Xna Controls For Spacewar
« Reply #3 on: August 31, 2006, 07:16:00 AM »

Actually if you look at the top of the helper

CODE
#define USE_KEYBOARD


Is commented out. While the rest of the implementation is there (#IF USE_KEYBOARD, ect), the actual definition is commented out. All you need to do is uncomment it (IMG:style_emoticons/default/wink.gif)
Logged

hessec

  • Archived User
  • Newbie
  • *
  • Posts: 32
Xna Controls For Spacewar
« Reply #4 on: August 31, 2006, 12:28:00 PM »

How do I uncomment it?
sorry, the only programming i am familiar with is visual basic XD, and even at that i'm not too good
Logged

cerealkillajme

  • Archived User
  • Hero Member
  • *
  • Posts: 1076
Xna Controls For Spacewar
« Reply #5 on: August 31, 2006, 01:26:00 PM »

Take the "#" sign out, lol.  wink.gif

When you put a # sign in the rest of that line is not read at all.
Logged

PlopModz

  • Archived User
  • Newbie
  • *
  • Posts: 23
Xna Controls For Spacewar
« Reply #6 on: August 31, 2006, 02:01:00 PM »

QUOTE(hessec @ Aug 31 2006, 10:59 AM) View Post

How do I uncomment it?
sorry, the only programming i am familiar with is visual basic XD, and even at that i'm not too good


Doesnt work that gave me errors.
Logged

hessec

  • Archived User
  • Newbie
  • *
  • Posts: 32
Xna Controls For Spacewar
« Reply #7 on: September 01, 2006, 09:20:00 AM »

Yeah, it didn't work for me either. I got 96 errors when I tried to debug it XD

PlopModz- I think you quoted the wrong thing.
Logged

Willians Monteiro

  • Archived User
  • Newbie
  • *
  • Posts: 1
Xna Controls For Spacewar
« Reply #8 on: September 01, 2006, 08:59:00 PM »

QUOTE(cerealkillajme @ Aug 31 2006, 04:33 PM) View Post

Take the "#" sign out, lol.  wink.gif

When you put a # sign in the rest of that line is not read at all.


It forgives my friend, # is not commentary, the commentary in the C # is//, # is a compilation directive, in this case "#If"s nor will not be compiled to game assembly if the game to execute in a console.  wink.gif

In "\Common\GamePadHelper.cs"
Remove "//" coment
CODE
//#define USE_KEYBOARD


It's all, the folks!!!



The keyboard keys, case change it!

CODE
#if USE_KEYBOARD
// Setup Dictionary with defaults
keyMapping.Add(GamePadKeys.Start, Keys.Home);
keyMapping.Add(GamePadKeys.Back, Keys.End);
keyMapping.Add(GamePadKeys.A, Keys.A);
keyMapping.Add(GamePadKeys.B, Keys.B);
keyMapping.Add(GamePadKeys.X, Keys.X);
keyMapping.Add(GamePadKeys.Y, Keys.Y);
keyMapping.Add(GamePadKeys.Up, Keys.Up);
keyMapping.Add(GamePadKeys.Down, Keys.Down);
keyMapping.Add(GamePadKeys.Left, Keys.Left);
keyMapping.Add(GamePadKeys.Right, Keys.Right);
keyMapping.Add(GamePadKeys.LeftTrigger, Keys.LShiftKey);
keyMapping.Add(GamePadKeys.RightTrigger, Keys.RShiftKey);
keyMapping.Add(GamePadKeys.ThumbstickLeftXMin, Keys.S);
keyMapping.Add(GamePadKeys.ThumbstickLeftXMax, Keys.D);
keyMapping.Add(GamePadKeys.ThumbstickLeftYMin, Keys.X);
keyMapping.Add(GamePadKeys.ThumbstickLeftYMax, Keys.W);
keyMapping.Add(GamePadKeys.ThumbstickRightXMin, Keys.J);
keyMapping.Add(GamePadKeys.ThumbstickRightXMax, Keys.L);
keyMapping.Add(GamePadKeys.ThumbstickRightYMin, Keys.M);
keyMapping.Add(GamePadKeys.ThumbstickRightYMax, Keys.I);
#endif



Logged

hessec

  • Archived User
  • Newbie
  • *
  • Posts: 32
Xna Controls For Spacewar
« Reply #9 on: September 07, 2006, 02:06:00 PM »

Thanks man, this game thing is pretty cool - I cant wait to see what people make with this thing
Logged

Etera

  • Archived User
  • Newbie
  • *
  • Posts: 1
Xna Controls For Spacewar
« Reply #10 on: November 15, 2006, 11:12:00 PM »

Thanks for the advice on fixing the controls, it helped me too.  
Now i can get the game to run, but as soon as I choose a mode, it quickly skips me past the ship choosing screen and into the game.  Both ships begind falling into the 'sun' and the ships mirror each others movement, they do not seem independent....what am i doing wrong?
Logged

kmillen

  • Archived User
  • Newbie
  • *
  • Posts: 1
Xna Controls For Spacewar
« Reply #11 on: June 15, 2007, 01:41:00 AM »

I am also new to the SpaceWars interface. I don't have XBox controllers and I cannot access the game via keyboard. The V key does something ocasionally and my cursor keys let me select a ship, but no keyboard combination stated in the readme.htm file allows me to play the game.

xxANTMANxx, vsaiyan, I did an Ctrl+Shift+F and no file in the entire SpaceWars starter kit contains a compiler directive.

#IF USE_KEYBOARD or #DEFINE USE_KEYBOARD

I manually checked GamePadHelper.cs, and this file contains no compiler directives.

Any other suggestions?





Logged