Project Description
Will of Nature is a game that has been made in roughly 14 days as a college project with 14 other students.
The game is about a waterdrop that has to manoeuvre through a series of levels where puzzles have to be solved to continue.
These puzzles are solveable by influences from different environmental effects to turn you into ice, or vaporize yourself in a cloud.
In this project I was the technical lead of 3 other programmers, with my main task of having an oversight of what was going on, deciding on implementation choices and bringing design choices/changes through for proper implementation. Next to a lead role I also spent time on general gameplay programming, animation and the effects.
Code Snippits
void Player::UpdateStateWater() { // Not every line of code is done by me. XboxController * controller = Framework::GetApplication()->GetController(); Keyboard* keyboard = Framework::GetApplication()->GetKeyboard(); const bool leftkey = keyboard->GetKey(Keys::PlayerMoveLeft) || keyboard->GetKey(Keys::PlayerMoveLeftA)|| controller->GetLeftThumbStateXI() < 0; const bool rightkey = keyboard->GetKey(Keys::PlayerMoveRight)|| keyboard->GetKey(Keys::PlayerMoveRightD) || controller->GetLeftThumbStateXI() > 0; const bool jumpkey = keyboard->GetKey(Keys::PlayerJump)|| controller->GetButtonState(Keys::PlayerControlerJump); const bool keydown = keyboard->GetKey(Keys::PlayerMoveDown) || keyboard->GetKey(Keys::PlayerMoveDownS)|| (controller->GetLeftThumbStateYI() < 0); const bool keyup = keyboard->GetKey(Keys::PlayerMoveUp) || keyboard->GetKey(Keys::PlayerMoveUpW)|| (controller->GetLeftThumbStateYI() > 0); const bool keydrop = keyboard->GetKey(Keys::PlayerDropItem) || controller->GetButtonState(Keys::PlayerControlerDrop); mIsRainingDown = false; // Only movement behavior in here FVector3 disp; //plant stuff std::vector<Plant*>& plantvec = mLevel->GetPlants(); std::vector<Plant*>::iterator plantit = plantvec.begin(); Plant* CurrentClimbing = NULL; bool ontop = false; if (mPhysChar->isJump()==false) { for (; plantit < plantvec.end();++plantit) { Plant * currentplant = (*plantit); if (currentplant->IsTouching(mPosition)) { CurrentClimbing = currentplant; break; } } } if (CurrentClimbing == NULL) { mPhysChar->ToggleGravity(true); } else { if (keyup) { mPhysChar->ToggleGravity(false); disp.y += PlayerClimbSpeed; mPlayerMesh->SetAnimation("MainCharClimb"); } else if (keydown) { mPhysChar->ToggleGravity(false); disp.y -= PlayerClimbSpeed; mPlayerMesh->SetAnimation("MainCharClimb"); } else { mPlayerMesh->SetAnimation("MainCharIdle"); } } if(Framework::GetApplication()->GetCamera() == mCamera) { if (leftkey) { disp.x = PlayerSpeedWater; if(!jumpkey) { mPlayerMesh->SetAnimation("MainCharRun"); mAnimationSpeedModifier = .17f; } mGoingRight = false; } else if (rightkey) { disp.x = -PlayerSpeedWater; if(!jumpkey && !mWasJumping) { mPlayerMesh->SetAnimation("MainCharRun"); mAnimationSpeedModifier = .17f; } mGoingRight = true; } else if(mPlayerMesh->GetCurrentAnimation() != mPlayerMesh->GetAnimation("MainCharIdle") && CurrentClimbing == NULL) { mPlayerMesh->SetAnimation("MainCharIdle"); } if (CurrentClimbing == NULL && jumpkey) { mPhysChar->Jump(); } if(CurrentClimbing == NULL && (mPhysChar->getStatus() == PhysXCharacter::CHAR_STARTJUMP || mPhysChar->getStatus() == PhysXCharacter::CHAR_JUMPING)) { mPlayerMesh->SetAnimation("MainCharJump"); } if(mPhysChar->getStatus() == PhysXCharacter::CHAR_STARTJUMP) { if(!sndWaterJump->IsPlaying()) sndWaterJump->Play(false); } if(mPhysChar->getStatus() == PhysXCharacter::CHAR_FALLING) if(mPlayerMesh->GetCurrentAnimation() != mPlayerMesh->GetAnimation("MainCharJump")) { mPlayerMesh->SetAnimation("MainCharJump"); mPlayerMesh->GetCurrentAnimation()->SetTime(0.20); } if(mPhysChar->getStatus() == PhysXCharacter::CHAR_HITGROUND) { if(!sndWaterLand->IsPlaying()) sndWaterLand->Play(false); mPlayerMesh->GetAnimation("MainCharJump")->Reset(); if(leftkey || rightkey) { mPlayerMesh->SetAnimation("MainCharRun"); mAnimationSpeedModifier = 0.17f; } else mPlayerMesh->SetAnimation("MainCharIdle"); } } mPhysChar->setFriction(FrictionNormal); //.1f --> tweakable var mPhysChar->Update(disp); mPosition = mPhysChar->GetPosition(); mPosition.y -= 4.5f; mPlayerMesh->SetPosition(mPosition); mCamera->SetCameraSetting(ThirdPersonCamera::CAM_NORMAL); // drop item ? mHasDroppedItem = 0; if(keydrop && mInventoryItem) { mHasDroppedItem = mInventoryItem->getItemType(); mLastDropped = getInventoryItem(); mInventoryItem->dropItem(); mInventoryItem = 0; } //If player has free inventory slot, update and find a collidable item if(getInventoryItem() == 0) { Item* newItem = 0; std::vector<Item*>& itemptr = mLevel->GetItemList(); std::vector<Item*>::iterator it = itemptr.begin(); for(; it < itemptr.end(); it++) { if((*it)->IsPickupable() && ((*it)->getItemType() == Item::ITEM_SEED || (*it)->getItemType() == Item::ITEM_WOOD)) { float dist = (*it)->getDistance(GetPosition()); if(dist < 0) { newItem = (*it); break; } } } //if we found a collided, do stuff with it if(newItem != 0) { setInventoryItem(newItem); newItem->GetParticle()->Hide(); sndItemPickup->Play(); } } //If ice, do stuff if(mPhysChar->GetGroundType() == ICE) { gTrace("Player water entered Ice, converting!"); setPlayerChangeState(Player::ChangeWaterToIce); } }
void Player::UpdateStateIce() { // Not every line of code is done by me. XboxController * controller = Framework::GetApplication()->GetController(); Keyboard* keyboard = Framework::GetApplication()->GetKeyboard(); const bool leftkey = keyboard->GetKey(Keys::PlayerMoveLeft) || keyboard->GetKey(Keys::PlayerMoveLeftA)|| controller->GetLeftThumbStateXI() < 0; const bool rightkey = keyboard->GetKey(Keys::PlayerMoveRight)|| keyboard->GetKey(Keys::PlayerMoveRightD) || controller->GetLeftThumbStateXI() > 0; const bool jumpkey = keyboard->GetKey(Keys::PlayerJump)|| controller->GetButtonState(Keys::PlayerControlerJump); mIsRainingDown = false; // Only movement behavior in here FVector3 disp; if(Framework::GetApplication()->GetCamera() == mCamera) { if(jumpkey) { mPlayerMesh->SetAnimation("MainCharIceJump"); } float speed = mPhysChar->GetVelocity().x; float maxspeed = 120; if (leftkey) { disp.x = PlayerSpeedIce; mGoingRight = false; if(speed > maxspeed || speed < -maxspeed) mPlayerMesh->SetAnimation("MainCharIceRunFaster"); else mPlayerMesh->SetAnimation("MainCharIceRun"); } else if (rightkey) { disp.x = -PlayerSpeedIce; mGoingRight = true; if(speed > maxspeed || speed < -maxspeed) mPlayerMesh->SetAnimation("MainCharIceRunFaster"); else mPlayerMesh->SetAnimation("MainCharIceRun"); } else { if (mPlayerMesh->GetCurrentAnimation() == mPlayerMesh->GetAnimation("MainCharIceJump")) { if(mPlayerMesh->GetAnimation("MainCharIceJump")->IsDone()) { mPlayerMesh->SetAnimation("MainCharIceIdle"); mPlayerMesh->GetAnimation("MainCharIceJump")->Reset(); } } else { mPlayerMesh->SetAnimation("MainCharIceIdle"); } } if (leftkey) disp.x = PlayerSpeedIce; else if (rightkey) disp.x = -PlayerSpeedIce; } PhysXGroundType ground = mPhysChar->GetGroundType(); if(ground == NORMAL) mPhysChar->setFriction(FrictionNormal); if(ground == HOT) mPhysChar->setFriction(FrictionIce); else mPhysChar->setFriction(FrictionRest); mPhysChar->Update(disp); mPosition = mPhysChar->GetPosition(); mPosition.y -= 4.5f; mPlayerMesh->SetPosition(mPosition); mCamera->SetCameraSetting(ThirdPersonCamera::CAM_ICE); // if (ground == SPECIAL) // mSpecialHit = true; // else mSpecialHit = false; if (ground == BREAKWALL) { mWallHit = true; } else mWallHit = false; mIce->SetPosition(mPosition); if(ground == HOT) { setPlayerChangeState(Player::ChangeIceToWater); } }