Wednesday, April 2, 2008

XNA Randy Collission prevention

I tried Nicks collission detection example with Randy and a stone texture.
You can see the outcome below:

Still start the app 2 times and use H and C for Host or Client.
Source:
http://hamboeck.googlepages.com/XNARandyWalkingCollission.zip

Saturday, March 29, 2008

Converting XNA PlayerIndex to string and int

It might be obvious, but I needed it today for the networking stuff to pass player data around. I wanted to convert the current Playerindex to a string or int and vice versa.:


PlayerIndex pix = PlayerIndex.Two;
string ps = pix.ToString(); // "Two"
int pi = (int)pix; // 1
pix = (PlayerIndex) Enum.Parse(typeof (PlayerIndex), "Three");
ps = pix.ToString(); // "Three"
pi = (int) pix; // 2
pi = 0;
pix = (PlayerIndex) pi;// "One"


Friday, March 28, 2008

XNA Randy and Lindgren Networking lib

Inspired from two articles I found on ZiggyWare I wrote this short Network sample.
It uses a tile map of Randy and he Lidgren Network library.



Download it from here (link updated on March 29th)

You find the initial articles here:
Moving A Sprite In A Tile Map:
http://www.kersson.com/articles/article.aspx?ar=42
Lidgren, A Safe alternative to using XNA's Networking:
http://www.ziggyware.com/readarticle.php?article_id=168

You should start the application 2 times.

Press H or S to be the Host
Press C to act as a client

Move Randy around by using the cursor keys.

Depending on which application has focus you will move Randy around and in the other application you will see the Network Randy moving around.

Wednesday, March 26, 2008

.NETDJ Article Online

My first article about the XNA Car Cup game is now online.

Read more here: PDF

CSharpCodeFormatter