function SetX($x) { // Set x position if ($x >= 0) { $this->x = $x; } else { $this->x = $this->w + $x; } }