Added some particle effetcs

This commit is contained in:
theo@manjaro 2021-09-15 19:22:38 +02:00
parent fda400a78b
commit 3a72856436
8 changed files with 23 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

View File

@ -22,6 +22,8 @@ class Lemming(BaseObject):
self.restx = 0
self.resty = 0
self.dusttimer = game.lib.Timer(0.7)
# Sprites
self.orientations = ["Right","Left","Left","Right"]
self.sprites = {}
@ -51,6 +53,13 @@ class Lemming(BaseObject):
self.move(diffx*self.game.dt,diffy*self.game.dt)
# Spawning dust particles if being launched
if self.speed > self.basespeed*1.5:
if self.dusttimer.tick(self.game.dt*(self.speed/self.basespeed)**2):
sprites = self.game.getSpriteDir("particles/dust/")
self.game.addParticle(sprites,self.rect.center[0],self.rect.center[1])
# Mouse selection
mouse=self.game.inputs["mouse"]
if self.selected:
@ -87,6 +96,12 @@ class Lemming(BaseObject):
self.game.globals["scameray"]+=5
self.game.gameloop.delid(self.id)
# Spawn particles
sprites = self.game.getSpriteDir("particles/dust/")
for velx in range(-1,2):
for vely in range(-1,2):
self.game.addParticle(sprites,self.rect.center[0],self.rect.center[1],velx=velx/2,vely=vely/2)
def launch(self):
# Launch itself in the mouse direction
if len(self.cachedrel)>self.mincachedsize:

View File

@ -22,6 +22,12 @@ class Spawner(BaseObject):
self.game.globals["scamerax"]+=3
self.game.globals["scameray"]+=3
# Spawn dust particles
sprites = self.game.getSpriteDir("particles/dust/")
self.game.addParticle(sprites,self.rect[0],self.rect[1]+20,velx=-1,vely=-0.5)
self.game.addParticle(sprites,self.rect[0],self.rect[1]+20,velx=1,vely=-0.5)
def draw(self):
# Draw the shadow
self.game.lib.drawcenter(self.game,self.sprite,self.rect[0]-self.game.globals["camerax"],self.rect[1]-self.game.globals["cameray"])

View File

@ -18,6 +18,8 @@ class Particle(BaseObject):
self.alpha = 1
self.depth = 6
def step(self):
game = self.game