SONIC PHP

par davidnurdin · Plates-formes
pas encore noté
▶ Jouer Sources Éditer GitHub
. / src / Entities / Physics / Colision.php · commit d114180
<?phpnamespace App\Entities\Physics;trait Colision{	protected bool $grounded = false;	protected float $groundedY = 0;	protected bool $inWater = false;	public function setGrounded(bool $grounded, float $groundY = null)	{		$this->grounded = $grounded;		if ($grounded && $groundY !== null)		{			$this->groundedY = $groundY;		}	}	public function isGrounded(): bool	{		return $this->grounded;	}	public function update(float $deltaTime)	{		if ($this->grounded)		{			$this->ay = 0;			$this->vy = 0;		}	}	public function setInWater(bool $inWater)	{		$this->inWater = $inWater;	}	public function isInWater(): bool	{		return $this->inWater;	}	public function getCollisionRect(): array	{		return [			'x' => $this->x,			'y' => $this->y,			'width' => $this->width,			'height' => $this->height		];	}}