void Quad::SwapUVs(Facing eFacing) // swaps quad facing for animation { switch (eFacing){ case LEFT: if ((FacingCheck("LEFT") != true)) { m_aoVerts[0].UV = m_aoVerts[1].UV; m_aoVerts[1].UV = m_aoVerts[0].UV; m_aoVerts[2].UV = m_aoVerts[3].UV; m_aoVerts[3].UV = m_aoVerts[4].UV; iFacing = "LEFT"; } else { } break; case RIGHT: if ((FacingCheck("RIGHT") != true)) { m_aoVerts[0].UV = m_aoVerts[1].UV; m_aoVerts[1].UV = m_aoVerts[0].UV; m_aoVerts[2].UV = m_aoVerts[3].UV; m_aoVerts[3].UV = m_aoVerts[4].UV; iFacing = "RIGHT"; } else { } break; case UP: if ((FacingCheck("UP") != true)) { //UV STUFF GOES HERE iFacing = "UP"; } else { } break; case DOWN: if ((FacingCheck("DOWN") != true)) { //UV STUFF GOES HERE iFacing = "DOWN"; } else { } break; default: break; } }
void GameEntity::Input() { if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_W)) { SetAnimation("LookUp",ONCE); SwapUVs(UP); } if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_A)) { SetAnimation("Run",LOOP); SwapUVs(LEFT); m_v3Position -= Vector3(1.f, 0.0f, 0.0f); } if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_S)) { SetAnimation("Duck",LOOP); SwapUVs(DOWN); m_v3Position += Vector3(0.0f, -1.f, 0.0f); } if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_D)) { if(FacingCheck("RIGHT") != true) // if the sprite isn't already facing right.. { SetAnimation("TurnAround", ONCE); //Set the animation to turn around... SwapUVs(RIGHT); //Swap UV's to flip the sprite... iFacing = "Right"; // Sets the facing flag to Right. if (currentAnimation !="Run") { SetAnimation("Run",LOOP); m_v3Position += Vector3(1.f, 0.0f, 0.0f); } } else SwapUVs(RIGHT); m_v3Position += Vector3(1.f, 0.0f, 0.0f); } if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_SPACE)) { //if(this->Hitbox.CheckGrounded) } if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_V)) { SetColor( Vector4((rand()%255)/255.f,(rand()%255)/255.f,(rand()%255)/255.f,1.f), Vector4((rand()%255)/255.f,(rand()%255)/255.f,(rand()%255)/255.f,1.f), Vector4((rand()%255)/255.f,(rand()%255)/255.f,(rand()%255)/255.f,1.f), Vector4((rand()%255)/255.f,(rand()%255)/255.f,(rand()%255)/255.f,1.f) ); } }
void FilterTargets(std::list<WorldObject*>& unitList) { unitList.remove_if (FacingCheck(GetCaster())); }