Skip to content

Commit

Permalink
betta goes away when snail hides in plant
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarroqe committed May 12, 2020
1 parent 6408210 commit e554097
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
Binary file not shown.
22 changes: 5 additions & 17 deletions 06-Students-Choice/SDLProject/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ Entity::Entity()
modelMatrix = glm::mat4(1.0f);

speed = 0.0f;

billboard = false;

width = 1.0f;
height = 1.0f;
depth = 1.0f;
Expand Down Expand Up @@ -62,7 +59,8 @@ void Entity::Update(float deltaTime, Entity *snail, Entity *player, Entity *obje
modelMatrix = glm::rotate(modelMatrix, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));

if (entityType == ENEMY) {
// rotation.z -= 90 * deltaTime;
rotation.z -= 0.5 * deltaTime;
rotation.y -= 0.5 * deltaTime;

// BETTA MOVEMENT BASED ON IF SNAIL IS NEAR A PLANT
for (int i = 0; i < objectCount - 1; i++) {
Expand All @@ -84,19 +82,9 @@ void Entity::Update(float deltaTime, Entity *snail, Entity *player, Entity *obje
}
// if snail is near a plant, go the opposite way TODO: check this makes sense
else {
if (position.x < snail->position.x) {
position.x -= 1 * deltaTime;
}
else {
position.x += 1 * deltaTime;
}

if (position.z < snail->position.x) {
position.z -= 1 * deltaTime;
}
else {
position.z += 1 * deltaTime;
}
rotation.z += 360 * deltaTime;
position.x -= 1 * deltaTime;
position.z -= 1 * deltaTime;
}
}

Expand Down

0 comments on commit e554097

Please sign in to comment.