Question: Convert the following java based code to C code: private function hCorridor(x1:Int, x2:Int, y) { for (x in Std.int(Math.min(x1, x2))...Std.int(Math.max(x1, x2)) + 1) { //

Convert the following java based code to C code:

private function hCorridor(x1:Int, x2:Int, y) {

for (x in Std.int(Math.min(x1, x2))...Std.int(Math.max(x1, x2)) + 1) {

// destory the tiles to "carve" out corridor

map[x][y].parent.removeChild(map[x][y]);

// place a new unblocked tile

map[x][y] = new Tile(Tile.DARK_GROUND, false, false);

// add tile as a new game object

addChild(map[x][y]);

// set the location of the tile appropriately

map[x][y].setLoc(x, y);

}

}

// create vertical corridor to connect rooms

private function vCorridor(y1:Int, y2:Int, x) {

for (y in Std.int(Math.min(y1, y2))...Std.int(Math.max(y1, y2)) + 1) {

// destroy the tiles to "carve" out corridor

map[x][y].parent.removeChild(map[x][y]);

// place a new unblocked tile

map[x][y] = new Tile(Tile.DARK_GROUND, false, false);

// add tile as a new game object

addChild(map[x][y]);

// set the location of the tile appropriately

map[x][y].setLoc(x, y);

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!