def newParticle(self):
   
   sprite = Sprite(ResourceManager.getTexture("planet5521/data/sprites.png"))
   sprite.texture_rectangle = Rectangle(Vector2(161, 234), Vector2(25, 20))
   sprite.origin = Vector2(12, 10)
   sprite.ratio = Vector2(0.08,0.08)
   
   r = self.gameView.entityToView[self.building].getDrawBounds()
   x = r.left + Rand.r.random()*r.width
   y = self.building._world.groundLevel
   sprite.position = Vector2(x, y + sprite.global_bounds.height/2-0.01)
   
   p = SimpleParticle(sprite)
   p.v = Vector2(Rand.r.random()*0.3, -Rand.r.random()*4)
   p.a = Vector2(0, 5)
   p.rV = Rand.r.random()*100
   
   self.particles.append(p)
示例#2
0
 def createSprite(self):
   sprite = Sprite(ResourceManager.getTexture("planet5521/data/sprites.png"))
   sprite.texture_rectangle = self._textureRect
   sprite.origin = Vector2(2.5, 3)
   sprite.ratio = Vector2(0.1, 0.1)
   return sprite