skeletons will attack the player

This commit is contained in:
GameHerobrine 2024-03-24 02:48:40 +03:00
parent 3b15c26b0c
commit db5ad749d2
6 changed files with 163 additions and 4 deletions

View file

@ -1,5 +1,7 @@
<?php
use Ds\Vector;
class Entity extends Position
{
@ -367,6 +369,10 @@ class Entity extends Position
}
}
public function canSee(Entity $e){
return $this->level->rayTraceBlocks(new Vector($this->x, $this->y + $this->getEyeHeight(), $this->z), new Vector($e->x, $e->y + $e->getEyeHeight(), $e->z)) == null;
}
/**
* Can entity be collided with or not
* @return boolean