Added simple enemy ship. Changed laser's speed

This commit is contained in:
CybArciom 2023-02-07 16:25:58 +01:00
parent e9d45fe6e3
commit 9b2ea53861
28 changed files with 141 additions and 44 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\Serhii\source\repos\GRK_game_scene2\Debug\grk-cw9.exe</FullPath>
<FullPath>C:\Users\arciom\Desktop\GRK_game_scene_new\Debug\grk-cw9.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />

View File

@ -1,58 +1,62 @@
 main.cpp
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(130,1): warning C4005: 'APIENTRY': macro redefinition
C:\Users\Serhii\source\repos\GRK_game_scene2\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : see previous definition of 'APIENTRY'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(137,30): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(180,38): warning C4305: '=': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(203,16): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(244,20): warning C4018: '<': signed/unsigned mismatch
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(293,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(307,98): warning C4305: 'argument': truncation from 'double' to 'T'
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\shared\minwindef.h(130,1): warning C4005: 'APIENTRY': macro redefinition
C:\Users\arciom\Desktop\GRK_game_scene_new\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : see previous definition of 'APIENTRY'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(138,30): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(192,38): warning C4305: '=': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(215,16): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(256,20): warning C4018: '<': signed/unsigned mismatch
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(305,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(319,98): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(310,68): warning C4305: 'argument': truncation from 'double' to 'T'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(322,68): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(348,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(431,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(442,108): warning C4305: 'argument': truncation from 'double' to 'T'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(360,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(392,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(421,80): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(430,80): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(453,80): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(516,13): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(527,108): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(450,87): warning C4305: 'argument': truncation from 'double' to 'T'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(535,87): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(450,223): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(453,59): warning C4305: 'argument': truncation from 'double' to 'T'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(535,223): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(538,59): warning C4305: 'argument': truncation from 'double' to 'T'
with
[
T=float
]
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(454,37): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(494,2): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(505,20): warning C4018: '<': signed/unsigned mismatch
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(510,50): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(511,51): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(588,21): warning C4018: '<': signed/unsigned mismatch
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(590,49): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(613,17): warning C4101: 'data': unreferenced local variable
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(714,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(715,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(716,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(739,32): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(740,32): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(741,32): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(777,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(778,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(779,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(899,21): warning C4305: '-=': truncation from 'double' to 'float'
C:\Users\Serhii\source\repos\GRK_game_scene2\cw 9\src\ex_9_1.hpp(901,21): warning C4305: '+=': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(539,37): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(579,2): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(595,20): warning C4018: '<': signed/unsigned mismatch
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(600,50): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(601,51): warning C4305: 'argument': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(678,21): warning C4018: '<': signed/unsigned mismatch
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(680,49): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(703,17): warning C4101: 'data': unreferenced local variable
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(807,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(808,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(809,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(832,32): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(833,32): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(834,32): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(870,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(871,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(872,28): warning C4305: 'initializing': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(992,21): warning C4305: '-=': truncation from 'double' to 'float'
C:\Users\arciom\Desktop\GRK_game_scene_new\cw 9\src\ex_9_1.hpp(994,21): warning C4305: '+=': truncation from 'double' to 'float'
Box.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
grk-cw9.vcxproj -> C:\Users\Serhii\source\repos\GRK_game_scene2\Debug\grk-cw9.exe
grk-cw9.vcxproj -> C:\Users\arciom\Desktop\GRK_game_scene_new\Debug\grk-cw9.exe

View File

@ -1,2 +1,2 @@
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0:VcpkgTriplet=x86-windows:
Debug|Win32|C:\Users\Serhii\source\repos\GRK_game_scene2\|
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:VCServicingVersionMFC=14.29.30136:VCServicingVersionCrtHeaders=14.29.30136:TargetPlatformVersion=10.0.22000.0:
Debug|Win32|C:\Users\arciom\Desktop\GRK_game_scene_new\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -13,13 +13,13 @@ SpaceShip::SpaceShip() {
}
SpaceShip::SpaceShip(int numberOfLasers) {
SpaceShip::SpaceShip(int numberOfLasers, glm::vec3 shipPos) {
maxNumberOfLasers = numberOfLasers;
numberOfLeftLasers = maxNumberOfLasers;
gun.reserve(maxNumberOfLasers);
this->spaceShipDir = glm::vec3(-0.490263f, 0.000000f, 0.871578f);
this->spaceShipPos = glm::vec3(0.065808f, 1.250000f, -2.0);
this->spaceShipPos = shipPos;
for (int i = 0; i < maxNumberOfLasers; i++) {
gun.push_back(Laser(this->spaceShipDir, this->spaceShipPos, 0.01, false));

View File

@ -23,7 +23,7 @@ private:
public:
SpaceShip();
SpaceShip(int numberOfLasers);
SpaceShip(int numberOfLasers, glm::vec3 shipPos);
//getters and setters

View File

@ -89,6 +89,7 @@ GLuint programLaser;
Core::Shader_Loader shaderLoader;
Core::RenderContext shipContext;
Core::RenderContext enemyShipContext;
Core::RenderContext sphereContext;
Core::RenderContext skyboxContext;
@ -151,7 +152,9 @@ float deltaTime = 0.f;
Laser laser1 = Laser();
Laser laser2 = Laser();
SpaceShip spaceShip = SpaceShip(20);
SpaceShip spaceShip = SpaceShip(20, glm::vec3(0.065808f, 1.250000f, -2.0));
SpaceShip enemySpaceShip = SpaceShip(20, glm::vec3(-0.065f, 1.25f, -1.75));//glm::vec3(0.2f, 1.65f, 2.05)
std::vector<Core::RenderContext> lasersContexts{ models::laserContext1, models::laserContext2, models::laserContext3, models::laserContext4, models::laserContext5,
models::laserContext6, models::laserContext7, models::laserContext8, models::laserContext9, models::laserContext10,
@ -170,6 +173,15 @@ std::vector<glm::vec3> lasersLightPos{ laserLightPos0, laserLightPos1, laserLigh
std::vector<Laser> lasers;
glm::mat4 enemiesMatrixModel;
float enemyTime;
float enemyAngle = -180.0f;
float enemyShipAxisX = 0.0f;
float enemyShipAxisY = 1.0f;
float enemyShipAxisZ = 0.0f;
float startEnemy = 0;
void updateDeltaTime(float time) {
if (lastTime < 0) {
lastTime = time;
@ -376,6 +388,79 @@ void drawLaser(Laser laser, Core::RenderContext laserContext, float dyst, int in
}
void enemyAIPilot(Core::RenderContext context) {
float time = glfwGetTime();
float enemyMoveSpeed = 0.02f;
float angleSpeed = 0.05f * deltaTime * 60;
float t = time - enemyTime;
//enemySpaceShip.setSpaceShipPos(enemySpaceShip.getSpaceShipPos() + enemySpaceShip.getSpaceShipDir() + enemyMoveSpeed);
//enemiesMatrixModel = enemiesMatrixModel * enemySpaceShip.getSpaceShipPos();
//enemySpaceShip.setSpaceShipPos(enemySpaceShip.getSpaceShipPos() + enemySpaceShip.getSpaceShipDir() * enemyMoveSpeed);
//enemySpaceShip.setSpaceShipPos(glm::vec3(-0.065, 0, 0));
//glm::vec3(glm::eulerAngleX(30.f) * glm::vec4(spaceShip.getSpaceShipDir(), 0))
//enemySpaceShip.setSpaceShipPos(glm::vec3(enemySpaceShip.getSpaceShipPos().x + enemySpaceShip.getSpaceShipDir().x, enemySpaceShip.getSpaceShipPos().y + enemySpaceShip.getSpaceShipDir().y * (0.02 * (t + sin(0.2 * t))), enemySpaceShip.getSpaceShipPos().z + enemySpaceShip.getSpaceShipDir().z));
/*glm::vec3 newEnemyPos = glm::vec3(enemySpaceShip.getSpaceShipPos().x, enemySpaceShip.getSpaceShipPos().y + (0.1 * (t + sin(0.1 * t))), enemySpaceShip.getSpaceShipPos().z - (0.1 * (t + sin(0.1 * t))));
enemySpaceShip.setSpaceShipPos(newEnemyPos);*/
/*if (enemyAngle < 100) {
enemyAngle = enemyAngle + 20.f;
printf("spaceshipDir = glm::vec3(%ff);\n", enemyAngle);
}*/
enemiesMatrixModel = glm::translate(enemySpaceShip.getSpaceShipPos()) * glm::scale(glm::vec3(0.015f)) * glm::rotate(glm::mat4(), glm::radians(enemyAngle), glm::vec3(enemyShipAxisX, enemyShipAxisY, enemyShipAxisZ));
if (startEnemy == 0) {
startEnemy = enemiesMatrixModel[3][1];
//enemiesMatrixModel = glm::translate(enemySpaceShip.getSpaceShipPos()) * glm::scale(glm::vec3(0.015f)) * glm::rotate(glm::mat4(), glm::radians(-180.0f), glm::vec3(.0, 1.0, .0));
drawObjectPBR(context, enemiesMatrixModel, glm::vec3(0.3, 0.3, 0.5), 0.2, 1.0);
}
else if (float((round((enemiesMatrixModel[3][1] - startEnemy) * 100.0) / 100.0)) < 0.57f) {
glm::vec3 newEnemyPos = glm::vec3(enemySpaceShip.getSpaceShipPos().x, enemySpaceShip.getSpaceShipPos().y + (0.5 * (t + sin(0.5 * t))), enemySpaceShip.getSpaceShipPos().z - (0.5 * (t + sin(0.5 * t))));
enemySpaceShip.setSpaceShipPos(newEnemyPos);
enemiesMatrixModel *= glm::translate(enemySpaceShip.getSpaceShipPos()) * glm::rotate(glm::mat4(), glm::radians(time * -10), glm::vec3(1, 0, 0));
//printf("minus = %f;\n", float(round((enemiesMatrixModel[3][1] - startEnemy) * 100.0) / 100.0));
drawObjectPBR(context, enemiesMatrixModel, glm::vec3(0.3, 0.3, 0.5), 0.2, 1.0);
}
/*else if (float((round((enemiesMatrixModel[3][1] - startEnemy) * 100.0) / 100.0)) > 0.57f) {
glm::vec3 newEnemyPos = glm::vec3(enemySpaceShip.getSpaceShipPos().x, enemySpaceShip.getSpaceShipPos().y, enemySpaceShip.getSpaceShipPos().z + (0.5 * (t + sin(0.5 * t))));
enemySpaceShip.setSpaceShipPos(newEnemyPos);
enemiesMatrixModel *= glm::translate(enemySpaceShip.getSpaceShipPos()) * glm::rotate(glm::mat4(), glm::radians(time * -10), glm::vec3(0, 0, 1));
printf("enemyMatrix(0) = %ff %ff %ff %ff\nenemyMatrix(1) = %ff %ff %ff %ff\nenemyMatrix(2) = %ff %ff %ff %ff\nenemyMatrix(3) = %ff %ff %ff %ff\n\n\n", enemiesMatrixModel[0][0], enemiesMatrixModel[0][1], enemiesMatrixModel[0][2], enemiesMatrixModel[0][3], enemiesMatrixModel[1][0], enemiesMatrixModel[1][1], enemiesMatrixModel[1][2], enemiesMatrixModel[1][3], enemiesMatrixModel[2][0], enemiesMatrixModel[2][1], enemiesMatrixModel[2][2], enemiesMatrixModel[2][3], enemiesMatrixModel[3][0], enemiesMatrixModel[3][1], enemiesMatrixModel[3][2], enemiesMatrixModel[3][3]);
drawObjectPBR(context, enemiesMatrixModel, glm::vec3(0.3, 0.3, 0.5), 0.2, 1.0);
}*/
else if (float((round((enemiesMatrixModel[3][1] - startEnemy) * 100.0) / 100.0)) == 0.57f) {
enemyShipAxisX = 1.0f;
enemyShipAxisY = 0.0f;
printf("minus = %f;\n", float(round((enemiesMatrixModel[3][1] - startEnemy) * 100.0) / 100.0));
glm::vec3 newEnemyPos = glm::vec3(enemySpaceShip.getSpaceShipPos().x, enemySpaceShip.getSpaceShipPos().y, enemySpaceShip.getSpaceShipPos().z + (1.5 * (t + sin(1.5 * t))));
enemySpaceShip.setSpaceShipPos(newEnemyPos);
enemiesMatrixModel *= glm::translate(enemySpaceShip.getSpaceShipPos()) * glm::rotate(glm::mat4(), glm::radians(enemyAngle), glm::vec3(1, 0, 0)) * glm::rotate(glm::mat4(), glm::radians(time * -10), glm::vec3(0, 0, 1));
drawObjectPBR(context, enemiesMatrixModel, glm::vec3(0.3, 0.3, 0.5), 0.2, 1.0);
}
//enemiesMatrixModel *= glm::translate(enemySpaceShip.getSpaceShipPos()) * glm::rotate(glm::mat4(), glm::radians(time * -10), glm::vec3(1, 0, 0));// + glm::eulerAngleX(enemyAngle + 50.f);
//enemyAngle = enemyAngle + 50.f;// * glm::rotate(glm::mat4(), glm::radians(time * -180.0f), glm::vec3(1.0, .0, .0));
//drawObjectPBR(context, enemiesMatrixModel, glm::vec3(0.3, 0.3, 0.5), 0.2, 1.0);
}
void drawSkybox(Core::RenderContext& context, GLuint textureID) {
glDisable(GL_DEPTH_TEST);
@ -497,6 +582,11 @@ void renderScene(GLFWwindow* window)
glm::mat4(),
texture::sofa
);*/
enemyTime = time;
enemyAIPilot(enemyShipContext);
spotlightPos = spaceShip.getSpaceShipPos() + 0.2 * spaceShip.getSpaceShipDir();
spotlightConeDir = spaceShip.getSpaceShipDir();
@ -590,7 +680,7 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
lasers[i].setTimeSinceShootLaser(glfwGetTime());
lasers[i].setLaserDir(spaceShip.getSpaceShipDir());
lasers[i].setLaserPos(spaceShip.getSpaceShipPos());
lasers[i].setLaserSpeed(1);
lasers[i].setLaserSpeed(5);
lasers[i].setLaserFly(true);
spaceShip.setAttackDecision(false);
@ -662,6 +752,9 @@ void init(GLFWwindow* window)
loadModelToContext("./models/sphere.obj", sphereContext);
loadModelToContext("./models/spaceship.obj", shipContext);
loadModelToContext("./models/spaceship.obj", enemyShipContext);
loadModelToContext("./models/cube.obj", skyboxContext);
loadModelToContext("./models/books.obj", models::booksContext);
@ -693,7 +786,7 @@ void init(GLFWwindow* window)
for (int i = 0; i < spaceShip.getMaxNumberOfLasers(); i++) {
loadModelToContext("./models/newlaser2.obj", lasersContexts[i]);
lasers.push_back(Laser(spaceShip.getSpaceShipDir(), spaceShip.getSpaceShipPos(), 1, false));
lasers.push_back(Laser(spaceShip.getSpaceShipDir(), spaceShip.getSpaceShipPos(), 10, false));
}