I watched TheCherno's game programming tutorial:
http://www.youtube.com/watch?v=RKPEQfkhbAY
And in this episode he wrote this code to make the 3d world.
package game.display.graphics;
public class Render3D extends Render {
public Render3D(int width, int height) {
super(width, height);
}
public void floor() {
for(int y = 0; y < height; y++) {
double ydepth = y - height / 2;
double z = 100.0 / ydepth;
for(int x = 0; x < width; x++) {
double xdepth = x - width / 2;
xdepth *= z;
int xx = (int) (xdepth) & 5;
pixels[x+y*width] = xx * 128;
}
}
}
}
I don't really understand the code.. so someone can explain it to me?