Added crates

This commit is contained in:
theo@manjaro 2021-11-17 16:14:29 +01:00
parent 02e9a07c91
commit 030c4be957
6 changed files with 31 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

View File

@ -2480,7 +2480,11 @@
{"x": 496, "y": 160},
{"x": 576, "y": 160}
]
}
},
{"name": "Crate", "id": 4, "_eid": "16023910", "x": 832, "y": 240, "originX": 0, "originY": 0},
{"name": "Crate", "id": 6, "_eid": "16023910", "x": 896, "y": 240, "originX": 0, "originY": 0},
{"name": "Crate", "id": 7, "_eid": "16023910", "x": 864, "y": 240, "originX": 0, "originY": 0},
{"name": "Crate", "id": 8, "_eid": "16023910", "x": 672, "y": 144, "originX": 0, "originY": 0}
]
}
]

View File

@ -0,0 +1,19 @@
from gamedata.objects.combat.ennemies.ennemy import Ennemy
class Crate(Ennemy):
def __init__(self,x,y,game,nodes=None):
super().__init__(x,y,game,nodes)
self.sprite = game.sprite_lib["crate/crate.png"]
self.deadsprite = game.sprite_lib["crate/broke.png"]
self.rect[2],self.rect[3] = self.sprite.get_size()
def step(self):
super().step()
def draw(self):
if not self.dead:
self.game.window.blit(self.sprite,[self.rect[0]-self.game.globals["camerax"],self.rect[1]-self.game.globals["cameray"]])

View File

@ -13,6 +13,9 @@ class Ennemy(Movable):
self.respawn = True
self.dead = False
self.particleoffsetx = 0
self.particleoffsety = 0
self.dustparticles = game.getSpriteDir("particles/dust/")
def step(self):
@ -28,8 +31,8 @@ class Ennemy(Movable):
# Die
self.dead = True
# Add particles
self.game.addParticle(self.dustparticles,self.rect.center[0],self.rect.center[1]) # Dust
self.game.addParticle([self.deadsprite],self.rect.center[0],self.rect.center[1],fps=0.6,vely=-1.5,modvely=0.15) # Die sprite
self.game.addParticle(self.dustparticles,self.rect.center[0]+self.particleoffsetx,self.rect.center[1]+self.particleoffsety) # Dust
self.game.addParticle([self.deadsprite],self.rect.center[0]+self.particleoffsetx,self.rect.center[1]+self.particleoffsety,fps=0.6,vely=-1.5,modvely=0.15) # Die sprite
# Boost the player vertically
if not self.player.fastfall:
if self.player.rect[1]>self.rect[1]:

View File

@ -1,5 +1,6 @@
from gamedata.objects.base import BaseObject
from gamedata.objects.combat.ennemies.robot import Robot
from gamedata.objects.combat.ennemies.crate import Crate
class TilesetRenderer(BaseObject):
@ -37,7 +38,7 @@ class TilesetRenderer(BaseObject):
self.layers = []
self.spawns = []
spawnlists = {"Spawns":self.spawns}
ennemies = {"Robot":Robot}
ennemies = {"Robot":Robot,"Crate":Crate}
self.queue = [] # For spawning ennemies after beeing initialized
if "layers" in json.keys() and type(json["layers"]).__name__=="list":
solidlayer = False