Jump to content
  • Advertisement
Sign in to follow this  
kjarli

Array like php to C#

This topic is 3606 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I got the following thing in php, how do you write this for arrays in C#?
$x = 100;
$y = 50;
for($i = 0; $i < $x; $i++) {
	for($j = 0; $j < $y; $j++) {
		$array[$i][$j] = new Tile();
	}
}
It will be used like:
if($build == Unit::TANK) {
	if($array[4][10]->isType(Tile::LAND)) && $array[4][10]->hasFactory($owner)) {
		$array[4][10]->addObject(Unit::TANK, $owner);
	}
}
I've tried several things, but it seems php is the only language that uses "arrays" which you can index yourself...

Share this post


Link to post
Share on other sites
Advertisement
Tile[,] arr = new Tile[x, y];
arr[4, 10] = new Tile();
arr[4, 10].addObject(...);


[Edited by - bubu LV on December 2, 2008 5:00:03 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!