Spawner-Logik hinzugefügt

This commit is contained in:
Benjamin 2026-06-10 18:12:24 +02:00
parent 1e4059dc0d
commit 62c6ae19d8
3 changed files with 10 additions and 1 deletions

View file

@ -23,6 +23,7 @@ class Editor:
"grass": load_images(path="tiles/grass"), "grass": load_images(path="tiles/grass"),
"large_decor": load_images(path="tiles/large_decor"), "large_decor": load_images(path="tiles/large_decor"),
"stone": load_images(path="tiles/stone"), "stone": load_images(path="tiles/stone"),
"spawners": load_images("tiles/spawners"),
} }
self.movement: list[bool] = [False, False, False, False] self.movement: list[bool] = [False, False, False, False]

View file

@ -78,6 +78,12 @@ class Game:
pygame.Rect(4 + tree["pos"][0], 4 + tree["pos"][1], 23, 13) pygame.Rect(4 + tree["pos"][0], 4 + tree["pos"][1], 23, 13)
) )
for spawner in self.tilemap.extract([("spawners", 0), ("spawners", 1)]):
if spawner["variant"] == 0:
self.player.pos = spawner["pos"]
else:
print(spawner["pos"], "enemy")
self.particles: list[Particle] = [] self.particles: list[Particle] = []
self.clouds: Clouds = Clouds(cloud_images=self.assets["clouds"], count=16) self.clouds: Clouds = Clouds(cloud_images=self.assets["clouds"], count=16)
@ -116,6 +122,8 @@ class Game:
frame=random.randint(0, 20), frame=random.randint(0, 20),
) )
) )
self.clouds.update() self.clouds.update()
self.clouds.render(surface=self.display, offset=render_scroll) self.clouds.render(surface=self.display, offset=render_scroll)

View file

@ -216,7 +216,7 @@ class Player(PhysicsEntity):
# self.velocity[1] -= 5 # self.velocity[1] -= 5
# boost_particle = Particle(self.game, "boost", (self.pos[0] + self.size[0]//2, self.pos[1] + self.size[1]//2)) # boost_particle = Particle(self.game, "boost", (self.pos[0] + self.size[0]//2, self.pos[1] + self.size[1]//2))
# self.game.particles.append(boost_particle) # self.game.particles.append(boost_particle)
self.velocity[1] -= 100000 self.velocity[1] -= 5
boost_particle = Particle( boost_particle = Particle(
self.game, self.game,
"boost", "boost",