Sets collectibles for ascending.
This commit is contained in:
@@ -261,7 +261,7 @@ class GameLoop(Room):
|
|||||||
|
|
||||||
self.draw_water()
|
self.draw_water()
|
||||||
|
|
||||||
thumby.display.drawText(str(self.score), thumby.display.width - (len(str(self.score)) + 2) * 5, 1, 1)
|
thumby.display.drawText(str(self.score), thumby.display.width - (len(str(self.score)) + 2) * 5, 1, int(self.player.y > 0))
|
||||||
|
|
||||||
|
|
||||||
class EndRoom(Room):
|
class EndRoom(Room):
|
||||||
|
|||||||
24
sprites.py
24
sprites.py
@@ -131,17 +131,25 @@ def update_entities(entities, difficulty: int, current_depth: int, prev_depth: i
|
|||||||
return set()
|
return set()
|
||||||
|
|
||||||
spawned = set()
|
spawned = set()
|
||||||
|
if current_depth > 0:
|
||||||
max_spawned = randrange(0, difficulty + 1)
|
max_spawned = randrange(0, difficulty + 1)
|
||||||
while len(spawned) < max_spawned and random() < (2 * math.pow(difficulty + 0.01, 2)) / (3 * math.pow(difficulty + 0.01, 2) + 20 * (difficulty + 0.01)) + 0.05:
|
|
||||||
if random() < 0.2:
|
|
||||||
Clazz = Collectible
|
|
||||||
if current_depth >= 0:
|
|
||||||
sprite_image = collectibleunder
|
|
||||||
else:
|
|
||||||
sprite_image = collectibleover
|
|
||||||
else:
|
else:
|
||||||
|
max_spawned = randrange(0, int(5 / (0.3 * difficulty + 0.7)))
|
||||||
|
print(f"Spawning {max_spawned} entities this tick")
|
||||||
|
while len(spawned) < max_spawned:
|
||||||
|
if current_depth > 0:
|
||||||
|
if random() >= (2 * math.pow(difficulty + 0.01, 2)) / (3 * math.pow(difficulty + 0.01, 2) + 20 * (difficulty + 0.01)) + 0.05:
|
||||||
|
print(f"Cancelling obstacles after {len(spawned)} entities")
|
||||||
|
break
|
||||||
Clazz = Obstacle
|
Clazz = Obstacle
|
||||||
sprite_image = OBSTACLES[randrange(0, min((difficulty + 1) * 3, len(OBSTACLES)))]
|
sprite_image = OBSTACLES[randrange(0, min((difficulty + 1) * 3, len(OBSTACLES)))]
|
||||||
|
else:
|
||||||
|
if random() >= 1 / (math.pow(difficulty, 2) + 3):
|
||||||
|
print(f"Cancelling obstacles after {len(spawned)} entities")
|
||||||
|
break
|
||||||
|
Clazz = Collectible
|
||||||
|
sprite_image = collectibleover
|
||||||
|
|
||||||
if sprite_image.width >= thumby.display.width:
|
if sprite_image.width >= thumby.display.width:
|
||||||
x = 0
|
x = 0
|
||||||
else:
|
else:
|
||||||
@@ -157,6 +165,6 @@ def update_entities(entities, difficulty: int, current_depth: int, prev_depth: i
|
|||||||
error = True
|
error = True
|
||||||
break
|
break
|
||||||
if not error:
|
if not error:
|
||||||
sprite = thumby.Sprite(sprite_image.width, sprite_image.height, sprite_image.image, 0, 0, 0, False, False)
|
sprite = thumby.Sprite(sprite_image.width, sprite_image.height, sprite_image.image, 0, 0, int(y < 0), False, False)
|
||||||
spawned.add(Clazz(x, y, sprite_image.width, sprite_image.height, sprite_image.collision or sprite_image.image, sprite))
|
spawned.add(Clazz(x, y, sprite_image.width, sprite_image.height, sprite_image.collision or sprite_image.image, sprite))
|
||||||
return spawned
|
return spawned
|
||||||
|
|||||||
Reference in New Issue
Block a user