Added controls for moving vertically and increased rendered world size

This commit is contained in:
2022-10-31 19:06:45 -04:00
parent 04ad3afe7d
commit 39a256cb49
4 changed files with 49 additions and 39 deletions

View File

@@ -42,11 +42,11 @@ void display()
glBegin(GL_QUADS);
for(int x = 0; x < 64; x++)
for(int x = 0; x < 100; x++)
{
for(int y = 0; y < 64; y++)
{
for(int z = 0; z < 64; z++)
for(int z = 0; z < 100; z++)
{
if(blockManager.getNodeAt(x, y, z) > 0)
{
@@ -106,6 +106,16 @@ void updateTimer(int time)
playerX -= .8;
}
if(sf::Keyboard::isKeyPressed(sf::Keyboard::LShift))
{
playerY -= .8;
}
else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Space))
{
playerY += .8;
}
// Rotation
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
{
@@ -153,7 +163,6 @@ int main(int argc, char **argv)
// Load textures
textureHandler.loadAllTextures();
FastNoiseLite perlin, os, cellular;
int seed = 138;
perlin.SetSeed(seed);
@@ -168,9 +177,9 @@ int main(int argc, char **argv)
cellular.SetNoiseType(FastNoiseLite::NoiseType_Cellular);
cellular.SetFrequency(.1F);
for(int bx = 0; bx < 4; bx++)
for(int bx = 0; bx < 8; bx++)
{
for(int bz = 0; bz < 4; bz++)
for(int bz = 0; bz < 8; bz++)
{
for(int x = 0; x < 16; x++)
{
@@ -180,7 +189,7 @@ int main(int argc, char **argv)
float cZ = (float)z + (16 * bz);
for(int y = 0; y < 48 * abs(perlin.GetNoise(cX, cZ)) + (cellular.GetNoise(cX, cZ)) + 3; y++)
{
blockManager.mapBlocks[bx][bz].addNode(y > 30 ? 1 : 2, 0, x, y, z);
blockManager.mapBlocks[bx][bz].addNode(y > 20 ? 1 : 2, 0, x, y, z);
}
}
}