Spawn also items
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
from enum import Enum, auto
|
||||
from math import sqrt
|
||||
from random import randint
|
||||
from random import choice, randint
|
||||
from typing import List
|
||||
|
||||
from dungeonbattle.display.texturepack import TexturePack
|
||||
@ -97,10 +97,9 @@ class Map:
|
||||
tile = self.tiles[y][x]
|
||||
if tile.can_walk():
|
||||
break
|
||||
from dungeonbattle.entities.monsters import Hedgehog
|
||||
hedgehog = Hedgehog()
|
||||
hedgehog.move(y, x)
|
||||
self.add_entity(hedgehog)
|
||||
entity = choice(Entity.get_all_entity_classes())()
|
||||
entity.move(y, x)
|
||||
self.add_entity(entity)
|
||||
|
||||
def tick(self) -> None:
|
||||
"""
|
||||
@ -193,6 +192,12 @@ class Entity:
|
||||
"""
|
||||
return sqrt(self.distance_squared(other))
|
||||
|
||||
@staticmethod
|
||||
def get_all_entity_classes():
|
||||
from dungeonbattle.entities.items import Heart, Bomb
|
||||
from dungeonbattle.entities.monsters import Hedgehog
|
||||
return [Hedgehog, Heart, Bomb]
|
||||
|
||||
|
||||
class FightingEntity(Entity):
|
||||
maxhealth: int
|
||||
|
Reference in New Issue
Block a user