Ejemplo n.º 1
0
 private function cannonRect()
 {
     $result = new QRect(0, 0, 50, 50);
     $result->moveBottomLeft($this->rect()->bottomLeft());
     return $result;
 }
Ejemplo n.º 2
0
 private function shotRect()
 {
     $gravity = 4.0;
     $time = $this->timerCount / 20.0;
     $velocity = $this->shootForce;
     $radians = $this->shootAngle * 3.14159265 / 180;
     $velx = $velocity * cos($radians);
     $vely = $velocity * sin($radians);
     $x0 = ($this->barrelRect->right() + 5) * cos($radians);
     $y0 = ($this->barrelRect->right() + 5) * sin($radians);
     $x = $x0 + $velx * $time;
     $y = $y0 + $vely * $time - 0.5 * $gravity * $time * $time;
     $result = new QRect(0, 0, 6, 6);
     $result->moveCenter(new QPoint(qRound($x), $this->height() - 1 - qRound($y)));
     return $result;
 }