AI Boost actions implemented.

This commit is contained in:
sigonasr2 2024-08-22 18:53:37 -05:00
parent 16b9ad521e
commit 1f306af20e
6 changed files with 1326 additions and 1 deletions

1311
assets/StageIII.tmx Normal file

File diff suppressed because it is too large Load Diff

1
assets/StageIII.tmx.0 Normal file

File diff suppressed because one or more lines are too long

View File

@ -398,6 +398,7 @@ void Hamster::HandlePlayerControls(){
if(HamsterGame::Game().GetKey(R).bPressed&&boostCounter>0){ if(HamsterGame::Game().GetKey(R).bPressed&&boostCounter>0){
boostCounter--; boostCounter--;
boostTimer=1.f; boostTimer=1.f;
if(IsPlayerControlled)HamsterAI::OnBoost(this->pos);
} }
if(HamsterGame::Game().GetKey(SPACE).bPressed){ if(HamsterGame::Game().GetKey(SPACE).bPressed){
if(lastTappedSpace<=0.6f&&HasPowerup(Powerup::JET)){ 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... //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... //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(); ai.AdvanceToNextAction();
const HamsterAI::ActionOptRef&nextAction{ai.GetCurrentAction()}; const HamsterAI::ActionOptRef&nextAction{ai.GetCurrentAction()};

View File

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

View File

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

View File

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