Added some particle effetcs
This commit is contained in:
parent
fda400a78b
commit
3a72856436
BIN
gamedata/assets/particles/dust/0.png
Normal file
BIN
gamedata/assets/particles/dust/0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 653 B |
BIN
gamedata/assets/particles/dust/1.png
Normal file
BIN
gamedata/assets/particles/dust/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 693 B |
BIN
gamedata/assets/particles/dust/2.png
Normal file
BIN
gamedata/assets/particles/dust/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 719 B |
BIN
gamedata/assets/particles/dust/3.png
Normal file
BIN
gamedata/assets/particles/dust/3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 661 B |
BIN
gamedata/assets/particles/dust/4.png
Normal file
BIN
gamedata/assets/particles/dust/4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 642 B |
@ -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:
|
||||
|
@ -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"])
|
||||
|
@ -18,6 +18,8 @@ class Particle(BaseObject):
|
||||
|
||||
self.alpha = 1
|
||||
|
||||
self.depth = 6
|
||||
|
||||
def step(self):
|
||||
|
||||
game = self.game
|
||||
|
Loading…
Reference in New Issue
Block a user