SONIC PHP

by davidnurdin · Platform
not rated yet
▶ Play Source Edit GitHub
. / src / Entities / Physics / Gravity.php · commit d114180
<?phpnamespace App\Entities\Physics;trait Gravity{	protected float $gravity = 1400.0;	protected bool $applyGravity = true;	protected float $maxFallSpeed = 960.0;	public function update(float $deltaTime)	{		if (($this->applyGravity) && (!$this->isGrounded()))		{			$this->ay = $this->gravity;			if ($this->vy > $this->maxFallSpeed) {				$this->vy = $this->maxFallSpeed;				$this->ay = 0;			}		}	}	public function setGravity(float $gravity)	{		$this->gravity = $gravity;	}	public function getGravity(): float	{		return $this->gravity;	}	public function setApplyGravity(bool $apply)	{		$this->applyGravity = $apply;	}}