Added crates
This commit is contained in:
parent
02e9a07c91
commit
030c4be957
BIN
gamedata/assets/crate/broke.png
Normal file
BIN
gamedata/assets/crate/broke.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 726 B |
BIN
gamedata/assets/crate/crate.png
Normal file
BIN
gamedata/assets/crate/crate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 735 B |
@ -2480,7 +2480,11 @@
|
|||||||
{"x": 496, "y": 160},
|
{"x": 496, "y": 160},
|
||||||
{"x": 576, "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}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
19
gamedata/objects/combat/ennemies/crate.py
Normal file
19
gamedata/objects/combat/ennemies/crate.py
Normal 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"]])
|
@ -13,6 +13,9 @@ class Ennemy(Movable):
|
|||||||
self.respawn = True
|
self.respawn = True
|
||||||
self.dead = False
|
self.dead = False
|
||||||
|
|
||||||
|
self.particleoffsetx = 0
|
||||||
|
self.particleoffsety = 0
|
||||||
|
|
||||||
self.dustparticles = game.getSpriteDir("particles/dust/")
|
self.dustparticles = game.getSpriteDir("particles/dust/")
|
||||||
|
|
||||||
def step(self):
|
def step(self):
|
||||||
@ -28,8 +31,8 @@ class Ennemy(Movable):
|
|||||||
# Die
|
# Die
|
||||||
self.dead = True
|
self.dead = True
|
||||||
# Add particles
|
# Add particles
|
||||||
self.game.addParticle(self.dustparticles,self.rect.center[0],self.rect.center[1]) # Dust
|
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.rect.center[1],fps=0.6,vely=-1.5,modvely=0.15) # Die sprite
|
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
|
# Boost the player vertically
|
||||||
if not self.player.fastfall:
|
if not self.player.fastfall:
|
||||||
if self.player.rect[1]>self.rect[1]:
|
if self.player.rect[1]>self.rect[1]:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from gamedata.objects.base import BaseObject
|
from gamedata.objects.base import BaseObject
|
||||||
from gamedata.objects.combat.ennemies.robot import Robot
|
from gamedata.objects.combat.ennemies.robot import Robot
|
||||||
|
from gamedata.objects.combat.ennemies.crate import Crate
|
||||||
|
|
||||||
class TilesetRenderer(BaseObject):
|
class TilesetRenderer(BaseObject):
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ class TilesetRenderer(BaseObject):
|
|||||||
self.layers = []
|
self.layers = []
|
||||||
self.spawns = []
|
self.spawns = []
|
||||||
spawnlists = {"Spawns":self.spawns}
|
spawnlists = {"Spawns":self.spawns}
|
||||||
ennemies = {"Robot":Robot}
|
ennemies = {"Robot":Robot,"Crate":Crate}
|
||||||
self.queue = [] # For spawning ennemies after beeing initialized
|
self.queue = [] # For spawning ennemies after beeing initialized
|
||||||
if "layers" in json.keys() and type(json["layers"]).__name__=="list":
|
if "layers" in json.keys() and type(json["layers"]).__name__=="list":
|
||||||
solidlayer = False
|
solidlayer = False
|
||||||
|
Loading…
Reference in New Issue
Block a user