Compare commits
No commits in common. "049525ca59c8545d30175e56cf915b7aa0538889" and "bb521371fa4dd9e1502554dea09ffdd7c5bee9e0" have entirely different histories.
049525ca59
...
bb521371fa
@ -83,9 +83,5 @@ def test_tick_all_calls_tick(world):
|
||||
|
||||
def test_add_object_out_of_bounds(world):
|
||||
entity = DummyEntity(Position(x=1000, y=1000))
|
||||
|
||||
world.add_object(entity)
|
||||
|
||||
entity = world.get_objects()[0]
|
||||
|
||||
assert entity.position.x == 49 and entity.position.y == 49
|
||||
with pytest.raises(ValueError):
|
||||
world.add_object(entity)
|
||||
|
||||
@ -170,4 +170,4 @@ class FoodObject(BaseEntity):
|
||||
|
||||
:return: String representation.
|
||||
"""
|
||||
return f"FoodObject({self.position}, decay={self.decay:.1f}, decay_rate={self.decay_rate * (1 + (self.neighbors / 10))})"
|
||||
return f"FoodObject({self.position}, decay={self.decay:.0f}, decay_rate={self.decay_rate * (1 + (self.neighbors / 10))})"
|
||||
|
||||
@ -80,7 +80,7 @@ class Camera:
|
||||
zoom_smoothing_factor = 1 - pow(1 - self.zoom_smoothing, deltatime * 60)
|
||||
self.zoom += (self.target_zoom - self.zoom) * zoom_smoothing_factor
|
||||
|
||||
zoom_threshold = 0.01
|
||||
zoom_threshold = 0.001
|
||||
if abs(self.zoom - self.target_zoom) < zoom_threshold:
|
||||
self.zoom = self.target_zoom
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ class World:
|
||||
"""
|
||||
# Ensure position is within world bounds, considering a center origin
|
||||
if position.x < -self.world_size[0] / 2 or position.x >= self.world_size[0] / 2 or position.y < - \
|
||||
self.world_size[1] / 2 or position.y >= self.world_size[1] / 2:
|
||||
self.world_size[1] / 2 or position.y >= self.world_size[1] / 2:
|
||||
# force position to be within bounds
|
||||
position.x = max(-self.world_size[0] / 2, min(position.x, self.world_size[0] / 2 - 1))
|
||||
position.y = max(-self.world_size[1] / 2, min(position.y, self.world_size[1] / 2 - 1))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user