Alex Rivera | Logout

Implementation of array with negative indices

Asked 2012-08-06T23:00:23.660
8

I am making a game with a world that extends infinitely in every direction. This means that you can be at position X:50, Y:50 or X:-50, Y:-50. But... I can't really do that with a normal C# List...

All the ideas I've come up with seem to be too complicated/inefficient to work...

Edit
Report

2 Answers

0

How about using two List underneath for expansions in two different directions?

answered 2012-08-07T03:28:06.933
0

I'm not certain if this is more complicated than you want to deal with, but have you considered using polar coordinates instead of cartesian? There are no negative numbers in that coordinate system. I realize that the coversion is difficult at first, but once you wrap your head around it, it becomes second nature.

answered 2012-08-23T18:19:38.600

Your Answer