I'm tired
This commit is contained in:
parent
d32fb76f86
commit
a5882211a9
2 changed files with 14 additions and 4 deletions
|
|
@ -79,7 +79,7 @@ class Ghost : public Entity {
|
|||
Vector2 start_position;
|
||||
int respawn_timer = 0;
|
||||
void recalculate_direction();
|
||||
void try_to_chase();
|
||||
void try_switch_direction();
|
||||
public:
|
||||
Ghost();
|
||||
void ready() override;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ void Ghost::ready() {
|
|||
}
|
||||
|
||||
void Ghost::tick() {
|
||||
try_to_chase();
|
||||
Vector2 check_position = project_position(direction, 1);
|
||||
|
||||
World& world = get_world();
|
||||
|
|
@ -46,10 +45,21 @@ void Ghost::tick() {
|
|||
}
|
||||
|
||||
position = check_position;
|
||||
try_switch_direction();
|
||||
}
|
||||
|
||||
void Ghost::try_to_chase(){
|
||||
// Todo
|
||||
void Ghost::try_switch_direction(){
|
||||
/*if(rand()%10!=0)
|
||||
return;
|
||||
|
||||
World world = get_world();
|
||||
|
||||
if(dynamic_cast<GhostWall*>(world.grid[world.indexify_position(project_position((direction+1)%4, 1))]) == nullptr){
|
||||
direction = (direction+1)%4;
|
||||
}
|
||||
else if(dynamic_cast<GhostWall*>(world.grid[world.indexify_position(project_position((direction-1)%4,1))]) == nullptr){
|
||||
direction = (direction-1)%4;
|
||||
}*/
|
||||
}
|
||||
|
||||
void Ghost::recalculate_direction(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue