development #11
@ -53,7 +53,7 @@ class ResourceGenerator:
|
|||||||
resource = world.component_for_entity(resource_ent, ResourceComponent)
|
resource = world.component_for_entity(resource_ent, ResourceComponent)
|
||||||
inventory = world.component_for_entity(player, InventoryComponent)
|
inventory = world.component_for_entity(player, InventoryComponent)
|
||||||
answer = decision_tree.predict_answer(resource)
|
answer = decision_tree.predict_answer(resource)
|
||||||
print(answer)
|
# print(answer)
|
||||||
inventory.add_item(resource.resource_type, 1)
|
inventory.add_item(resource.resource_type, 1)
|
||||||
game_map.remove_entity(pos.grid_position)
|
game_map.remove_entity(pos.grid_position)
|
||||||
world.delete_entity(resource_ent, immediate=True)
|
world.delete_entity(resource_ent, immediate=True)
|
||||||
|
@ -17,5 +17,4 @@ class ResourceCollectionSystem(esper.Processor):
|
|||||||
|
|
||||||
if collect.action == Action.MOVE:
|
if collect.action == Action.MOVE:
|
||||||
self.world.remove_component(ent, CollectingResourceComponent)
|
self.world.remove_component(ent, CollectingResourceComponent)
|
||||||
print("HERE")
|
|
||||||
self.world.add_component(ent, MovingComponent())
|
self.world.add_component(ent, MovingComponent())
|
||||||
|
@ -21,7 +21,6 @@ class CollisionSystem(esper.Processor):
|
|||||||
|
|
||||||
vector = Direction.get_vector(pos.direction)
|
vector = Direction.get_vector(pos.direction)
|
||||||
moving.target = tuple(map(operator.add, vector, pos.grid_position))
|
moving.target = tuple(map(operator.add, vector, pos.grid_position))
|
||||||
print(moving.target)
|
|
||||||
moving.direction_vector = vector
|
moving.direction_vector = vector
|
||||||
if self.check_collision(moving.target):
|
if self.check_collision(moving.target):
|
||||||
self.world.remove_component(ent, MovingComponent)
|
self.world.remove_component(ent, MovingComponent)
|
||||||
|
@ -11,7 +11,6 @@ from survival.systems.input_system import PathfindingComponent
|
|||||||
class CollectingResourceComponent:
|
class CollectingResourceComponent:
|
||||||
def __init__(self, action):
|
def __init__(self, action):
|
||||||
self.action = action
|
self.action = action
|
||||||
print(action)
|
|
||||||
|
|
||||||
|
|
||||||
class PathfindingMovementSystem(esper.Processor):
|
class PathfindingMovementSystem(esper.Processor):
|
||||||
|
@ -9,4 +9,3 @@ class TimeSystem(esper.Processor):
|
|||||||
if time.timer > 1000:
|
if time.timer > 1000:
|
||||||
time.add_time(1)
|
time.add_time(1)
|
||||||
time.timer = 0
|
time.timer = 0
|
||||||
print(time)
|
|
||||||
|
2
test.py
2
test.py
@ -3,7 +3,7 @@ import random
|
|||||||
|
|
||||||
def generate_data():
|
def generate_data():
|
||||||
f = open("data.txt", "w")
|
f = open("data.txt", "w")
|
||||||
for i in range(1000):
|
for i in range(100):
|
||||||
weight = random.randint(0, 11)
|
weight = random.randint(0, 11)
|
||||||
eatable = bool(random.randint(0, 1))
|
eatable = bool(random.randint(0, 1))
|
||||||
toughness = random.randint(0, 3)
|
toughness = random.randint(0, 3)
|
||||||
|
Loading…
Reference in New Issue
Block a user