forked from Cryz/battle_royale_sim
define a resource class for every entity that needs to be controlled on the game map
This commit is contained in:
@@ -52,13 +52,13 @@ class BrSimMap():
|
||||
|
||||
def populate_map(self):
|
||||
for player in self.players:
|
||||
p_coord_x, p_coord_y= player.get_player_coordinates()
|
||||
p_coord_x, p_coord_y= player.get_coordinates()
|
||||
if not player.is_alive(): self.game_map[p_coord_y][p_coord_x]= self.dead_player_sym
|
||||
elif player.player_gender_is_male(): self.game_map[p_coord_y][p_coord_x]= self.player_male_sym
|
||||
elif player.player_gender_is_female(): self.game_map[p_coord_y][p_coord_x]= self.player_female_sym
|
||||
else: self.game_map[p_coord_y][p_coord_x]= self.player_nonbinary_sym
|
||||
for item in self.items:
|
||||
i_coord_x, i_coord_y= item.get_item_coordinates()
|
||||
i_coord_x, i_coord_y= item.get_coordinates()
|
||||
self.game_map[i_coord_y][i_coord_x]= self.item_sym
|
||||
|
||||
def _set_coordinates(self, target):
|
||||
@@ -68,7 +68,7 @@ class BrSimMap():
|
||||
_logs.log_debug('_set_coordinates: collision, regenerate coordinates')
|
||||
x= _random.randint(1, self.world_width -2)
|
||||
y= _random.randint(1, self.world_height -2)
|
||||
target.set_player_coordinates(x, y)
|
||||
target.set_coordinates(x, y)
|
||||
|
||||
def init_players_coordinates(self):
|
||||
for player in self.players:
|
||||
|
||||
Reference in New Issue
Block a user