I do not own any of the images in this project Stage 2: https://www.codesters.com/preview/4aa6cdcae742445f9d8afadaf9ff742b/ Stage 3: Soon!

stage.disable_all_walls() north_wall = codesters.Rectangle(0, 250, 600, 10, "white") south_wall = codesters.Rectangle(0, -250, 600, 2, "white") background = "http://en.touhouwiki.net/images/5/5e/Th135_Palace_of_the_Earth_Spirits.png" stage.set_background(background) stage.set_background_x(-640) start_text = codesters.Text("Use the left and right arrows to move, and press z to shoot", 0, 0, "white") yukari_sprite = "http://en.touhouwiki.net/images/7/7d/Th08YukariBackSprite.png" yukari = codesters.Sprite(yukari_sprite, 0, -220) fairy = "http://en.touhouwiki.net/images/9/9f/Th12.5ZombieFairy.png" lives = 4 lives_display = codesters.Display(lives, 200, -200) def left_key(): yukari.move_left(20) stage.event_key("left", left_key) def right_key(): yukari.move_right(20) stage.event_key("right", right_key) enemies = [] def spawn_enemies(rows, cols): x = -200 y = 220 for count in range(rows): x = -200 for count in range(cols): enemies.append(codesters.Sprite(fairy, x, y)) x += 66 y -= 50 spawn_enemies(4, 7) stage.remove_sprite(start_text) def collision(sprite, hit_sprite): if hit_sprite == north_wall: stage.remove_sprite(sprite) if hit_sprite == south_wall: stage.remove_sprite(sprite) if hit_sprite in enemies: stage.remove_sprite(hit_sprite) stage.remove_sprite(sprite) if hit_sprite in enemies: enemies.remove(hit_sprite) def collision2(sprite, hit_sprite): global lives if hit_sprite == north_wall: stage.remove_sprite(sprite) if hit_sprite == south_wall: stage.remove_sprite(sprite) if hit_sprite == yukari: stage.remove_sprite(sprite) yukari.go_to(0, -220) lives -= 1 lives_display.update(lives) if lives <= 0: codesters.Text("YOU LOST", 0, 0, "red") def shoot(shooter, speed, collision, color): x = shooter.get_x() y = shooter.get_y() sprite = codesters.Circle(x, y, 10, color) sprite.set_y_speed(speed) sprite.event_collision(collision) def interval(): if len(enemies) > 0: enemy = random.choice(enemies) shoot(enemy, -5, collision2, "lavender") else: codesters.Text("YOU WON", 0, 0, "green") stage.event_interval(interval, 1) def z_key(): shoot(yukari, 10, collision, "purple") stage.event_key("z", z_key)
Support