forked from Cryz/battle_royale_sim
fix conflicts
This commit is contained in:
@@ -36,6 +36,7 @@ class BrSimMap():
|
||||
# 📦 this is an item (weapon or another item)
|
||||
# 💀 this is icon when the player is dead
|
||||
# ⛰️ this is icon for the mountain (We can prevent players from passing through the mountains and thus use them for map boundaries.)
|
||||
self.game_map= []
|
||||
|
||||
width= []
|
||||
#mon = []
|
||||
@@ -94,6 +95,19 @@ class BrSimMap():
|
||||
|
||||
def get_map_matrix(self):
|
||||
return self.game_map
|
||||
|
||||
def get_player_available_directions(self, Player):
|
||||
coord_x, coord_y= Player.get_player_coordinates()
|
||||
avail_directions= []
|
||||
if self.get_map_matrix()[coord_x - 1][coord_y] not in [self.mountain_sym]:
|
||||
avail_directions.append((-1, 0, 'left'))
|
||||
if self.get_map_matrix()[coord_x + 1][coord_y] not in [self.mountain_sym]:
|
||||
avail_directions.append((1, 0, 'right'))
|
||||
if self.get_map_matrix()[coord_x][coord_y - 1] not in [self.mountain_sym]:
|
||||
avail_directions.append((0, -1, 'up'))
|
||||
if self.get_map_matrix()[coord_x][coord_y + 1] not in [self.mountain_sym]:
|
||||
avail_directions.append((0, 1, 'bottom'))
|
||||
return avail_directions
|
||||
|
||||
def get_renderized_map(self):
|
||||
res= ''
|
||||
|
||||
@@ -3,6 +3,11 @@ from entities import resource as _resource
|
||||
|
||||
class BrSimItem(_resource.BrSimResource):
|
||||
|
||||
# test
|
||||
def __init__(self):
|
||||
self.coord_x= 0
|
||||
self.coord_y= 0
|
||||
|
||||
def is_item(self):
|
||||
return True
|
||||
|
||||
|
||||
@@ -174,6 +174,28 @@ class BrSimPlayer(_resource.BrSimResource):
|
||||
return False
|
||||
self.inventory.append(item)
|
||||
|
||||
def move(self, delta_x, delta_y):
|
||||
# XXX maps limits:
|
||||
# probably this isn't player's business
|
||||
# game orchestror should manage it
|
||||
# to avoid that the player can go out from the map
|
||||
# or can reach unaccessible points
|
||||
# also because the player doens't know the Map (entities/gamemap.py)
|
||||
self.coord_x += delta_x
|
||||
self.coord_y += delta_y
|
||||
|
||||
def move_right(self):
|
||||
self._move(1, 0)
|
||||
|
||||
def move_left(self):
|
||||
self._move(-1, 0)
|
||||
|
||||
def move_top(self):
|
||||
self._move(0, -1)
|
||||
|
||||
def move_bottom(self):
|
||||
self._move(0, 1)
|
||||
|
||||
def escape(self):
|
||||
# TODO It can run away from the fighting
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user