mirror of
https://github.com/sigonasr2/hamster.git
synced 2025-04-18 06:39:39 -05:00
AI Boost actions implemented.
This commit is contained in:
parent
16b9ad521e
commit
1f306af20e
1311
assets/StageIII.tmx
Normal file
1311
assets/StageIII.tmx
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/StageIII.tmx.0
Normal file
1
assets/StageIII.tmx.0
Normal file
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()};
|
||||
|
@ -150,3 +150,7 @@ 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…
x
Reference in New Issue
Block a user