diff --git a/Faceball2030/assets/enemies/#Sonar.wings# b/Faceball2030/assets/enemies/#Sonar.wings# new file mode 100644 index 0000000..4157867 Binary files /dev/null and b/Faceball2030/assets/enemies/#Sonar.wings# differ diff --git a/Faceball2030/main.cpp b/Faceball2030/main.cpp index 3595bd4..98aa7b3 100644 --- a/Faceball2030/main.cpp +++ b/Faceball2030/main.cpp @@ -753,6 +753,42 @@ void FaceBall::HandleKeys(float fElapsedTime) { bullets.push_back({ green_bullet,{player.GetPos().x,player.GetPos().y - 0.15f, player.GetPos().z},fYaw,0.125f,{shotSpd * std::cosf(fYaw),shotSpd * std::sinf(fYaw)},GREEN,true }); } } + if (GetKey(Q).bHeld) { + mat4x4 leftMat = Matrix_MakeRotationY(-PI / 2); + vec3d vLeftStrafe = Matrix_MultiplyVector(leftMat, vForward); + vLeftStrafe = { vLeftStrafe.x,0,vLeftStrafe.z }; + if (freeRoam) { + freeRoamCamera = Vector_Add(freeRoamCamera, vLeftStrafe); + } + else { + if (!CheckCollision({ vLeftStrafe.x,0,0 }, { player.GetPos().x,player.GetPos().z }, player.GetRadius())) { + vec3d xMovement{ vLeftStrafe.x,0,0 }; + player.UpdatePos(Vector_Add(player.GetPos(), xMovement)); + } + if (!CheckCollision({ 0,0,vLeftStrafe.z }, { player.GetPos().x,player.GetPos().z }, player.GetRadius())) { + vec3d zMovement{ 0,0,vLeftStrafe.z }; + player.UpdatePos(Vector_Add(player.GetPos(), zMovement)); + } + } + } + if (GetKey(E).bHeld) { + mat4x4 leftMat = Matrix_MakeRotationY(PI / 2); + vec3d vRightStrafe = Matrix_MultiplyVector(leftMat, vForward); + vRightStrafe = { vRightStrafe.x,0,vRightStrafe.z }; + if (freeRoam) { + freeRoamCamera = Vector_Add(freeRoamCamera, vRightStrafe); + } + else { + if (!CheckCollision({ vRightStrafe.x,0,0 }, { player.GetPos().x,player.GetPos().z }, player.GetRadius())) { + vec3d xMovement{ vRightStrafe.x,0,0 }; + player.UpdatePos(Vector_Add(player.GetPos(), xMovement)); + } + if (!CheckCollision({ 0,0,vRightStrafe.z }, { player.GetPos().x,player.GetPos().z }, player.GetRadius())) { + vec3d zMovement{ 0,0,vRightStrafe.z }; + player.UpdatePos(Vector_Add(player.GetPos(), zMovement)); + } + } + } if (GetKey(W).bHeld) { if (freeRoam) { freeRoamCamera = Vector_Add(freeRoamCamera, vForward);