Beispiel #1
0
 def _buildAsset(self):
     pcenter = self._spposinputs.pos
     try:
         pradius = MathApp.distance(
             self._posinputs.pos(),
             self._nposinputs.radius()) * MathApp._scale
     except (AttributeError, TypeError):
         pradius = self._nposinputs.radius() * MathApp._scale
     style = self._stdinputs.style()
     fill = self._stdinputs.color()
     ymax = pcenter[1] + pradius
     ymin = pcenter[1] - pradius
     xmax = pcenter[0] + pradius
     xmin = pcenter[0] - pradius
     try:
         if ymin > MathApp.height or ymax < 0 or xmax < 0 or xmin > MathApp.width:
             return CircleAsset(pradius, style, fill)
         elif pradius > 2 * MathApp.width:
             # here begins unpleasant hack to overcome crappy circles
             poly = self._buildPolygon(pcenter, pradius)
             if len(poly):
                 passet = PolygonAsset(poly, style, fill)
                 return passet
     except AttributeError:
         return CircleAsset(pradius, style, fill)
     return CircleAsset(pradius, style, fill)
Beispiel #2
0
 def __init__(self, *args, **kwargs):
     super().__init__(
         CircleAsset(0, self._defaultstyle, self._defaultcolor), *args,
         **kwargs)
     self._touchAsset()
     self.fxcenter = self.fycenter = 0.5
Beispiel #3
0
 def _buildAsset(self):
     return CircleAsset(self._stdinputs.size(), self._stdinputs.style(),
                        self._stdinputs.color())
Beispiel #4
0
"""
Example of using Sprite class.
"""
from ggame.sprite import Sprite
from ggame.asset import ImageAsset, CircleAsset
from ggame.app import App

PLAYER = Sprite(ImageAsset("bunny.png"), (100, 100), CircleAsset(50))

App().run()
Beispiel #5
0
 def __init__(self, *args, **kwargs):
     super().__init__(
         CircleAsset(self._defaultsize, self._defaultstyle,
                     self._defaultcolor), *args, **kwargs)