/************************************************************************* set the movement range of the thumb for the vertical axis. *************************************************************************/ void Thumb::setVertRange(float min, float max) { // ensure min <= max, swap if not. if (min > max) { float tmp = min; max = min; min = tmp; } d_vertMax = max; d_vertMin = min; // validate current position. float cp = getYPosition(); if (cp < min) { setYPosition(min); } else if (cp > max) { setYPosition(max); } }
void Player::kill(){ if(!alive) return; alive = false; playerRotationNode->setRotation(90.0f); setVelocity(0.0f, 0.0f, 0.0f); setAngleVel(0.0f); setDirection(0.0f); setYPosition(getPosition().y-1.0f); head.setVelocity(0.0f, 0.0f, 0.0f); head.setAngleVel(0.0f); head.setDirection(0.0f); originalLightParent = light->getParentNode(); light->removeFromParent(); Translation* lightTranslationNode = new Translation(dyingLightRotationNode, 0.0f, 0.0f, -1.0f); lightTranslationNode->addChildNode(light); light->setIntensity(originalLightIntensity/2); dyingLightPosition = originalDyingLightPosition; //Model* cross = new Model("cross", "cross_texture"); Rotation* rotationNode = new Rotation(dyingLightRotationNode, -90.0f, glm::vec3(1.0f, 0.0f, 0.0f)); //rotationNode->addChildNode(cross); update(0.0f); }
LocationCamera::LocationCamera(unsigned int width, unsigned int height, unsigned int xPosition, unsigned int yPosition) { setXPosition(xPosition); setYPosition(yPosition); setWidth(width); setHeight(height); }
/* Update */ void MediKitObject::update() { setYAngle(getYAngle() + INCREMENT_Y_ANGLE); if (!yPositionUpdated) { yPositionUpdated = true; setYPosition(getYPosition() + 1.0f); } }
void Player::update(float dt){ if(alive){ float yTeabag = controller->getAxisValue(Controller::CONTROLLER_RT); setYPosition(getPosition().y + 1.7f + 0.7 * glm::sin(4 * sgct::Engine::getTime())); setYPosition(getPosition().y + yTeabag); GameObject::update(dt); head.update(dt); } else{ dyingLightPosition += dyingLightSpeed * dt; dyingLightTranslationNode->setTranslation(0.0f, dyingLightPosition, 0.0f); //light->setIntensity(originalLightIntensity*originalDyingLightPosition/dyingLightPosition); } light->update(); }
Obstacle::Obstacle(float x, float y, float z, ObstacleType obsType) : GameObject(), obsType(obsType) { type = OBSTACLE; setXPosition(x); setYPosition(y); setZPosition(z); BoundingCilinder *bc = getBoundingCilinder(); if (obsType == COLUMN) { bc->setHeight(12.5f); bc->setRadius(2.0f); } else if (obsType == BARREL) { bc->setHeight(2.5f); bc->setRadius(1.2f); } }