AI Boost actions implemented.

sigonasr2 6 months ago
parent 16b9ad521e
commit 1f306af20e
  1. 1311
      assets/StageIII.tmx
  2. 1
      assets/StageIII.tmx.0
  3. 7
      src/Hamster.cpp
  4. 4
      src/HamsterAI.cpp
  5. 2
      src/HamsterAI.h
  6. 2
      src/HamsterGame.cpp

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -398,6 +398,7 @@ void Hamster::HandlePlayerControls(){
if(HamsterGame::Game().GetKey(R).bPressed&&boostCounter>0){
boostCounter--;
boostTimer=1.f;
if(IsPlayerControlled)HamsterAI::OnBoost(this->pos);
}
if(HamsterGame::Game().GetKey(SPACE).bPressed){
if(lastTappedSpace<=0.6f&&HasPowerup(Powerup::JET)){
@ -825,6 +826,12 @@ void Hamster::HandleAIControls(){
//If we don't have a Jet and it's required at this point, we must backtrack nodes until we get to a location where one is placed...
//This will be a separate behavioral AI node later on...
}
}else
if(action.type==HamsterAI::Action::BOOST){
if(boostCounter>0){
boostCounter--;
boostTimer=1.f;
}
}
ai.AdvanceToNextAction();
const HamsterAI::ActionOptRef&nextAction{ai.GetCurrentAction()};

@ -149,4 +149,8 @@ const HamsterAI::ActionOptRef HamsterAI::GetPreviousAction(){
const HamsterAI::ActionOptRef HamsterAI::RevertToPreviousAction(){
if(actionInd-1>0)actionInd--;
return GetCurrentAction();
}
void HamsterAI::OnBoost(const vi2d pos){
recordedActions.emplace_back(pos,Action::BOOST);
}

@ -50,6 +50,7 @@ public:
LANDING,
ENTER_TUNNEL,
CHECKPOINT_COLLECTED,
BOOST,
};
vi2d pos;
ActionType type;
@ -74,6 +75,7 @@ public:
static void OnJetBeginLanding(const vi2d pos);
static void OnTunnelEnter(const vi2d pos);
static void OnCheckpointCollected(const vi2d pos);
static void OnBoost(const vi2d pos);
static void OnTextEntryComplete(const std::string&enteredText);

@ -43,7 +43,7 @@ bool HamsterGame::OnUserCreate(){
LoadSound("nene - Boss Battle #3 Alternate.ogg");
LoadSound("nene - Boss Battle #5 V2.ogg");
LoadLevel("StageI.tmx"); //THIS IS TEMPORARY.
LoadLevel("StageIII.tmx"); //THIS IS TEMPORARY.
border.ChangeBorder(Border::DEFAULT);

Loading…
Cancel
Save