From cba15433410b3419237399be3ade42aa5a54b83d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Wed, 19 Jun 2024 23:05:04 +0300 Subject: [PATCH] d --- v5/Window.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/v5/Window.py b/v5/Window.py index 94f3c39..b195883 100644 --- a/v5/Window.py +++ b/v5/Window.py @@ -7,22 +7,9 @@ WIDTH = 900 class Window(arcade.Window): def __init__(self): super().__init__(WIDTH, HEIGHT, "OGS Memory") - #arcade.set_background_color(arcade.color.GRAY) arcade.set_background_color(arcade.color.WHITE) self.all_sprites = arcade.SpriteList() -# # Animated begin button. -# player = arcade.AnimatedTimeBasedSprite() -# for i in range(2): -# tex = arcade.load_texture("res/buttons_begin.png", x = i*350, y = 0, width = 350, height = 100) -# player.append_texture(tex) -# #player.color = arcade.color.BLUE -# a = arcade.sprite.AnimationKeyframe(i, 700, tex) -# player.frames.append(a) -# player.center_x = 300 -# player.center_y = 200 -# self.all_sprites.append(player) - positions = [ [9, 1], [14, 1], @@ -49,15 +36,23 @@ class Window(arcade.Window): def on_draw(self): arcade.start_render() - #arcade.draw_circle_filled(400, 300, 15, arcade.color.BLUE) self.all_sprites.draw() + def on_mouse_press(self, x, y, button, key_modifiers): + print("click", x, y) + sprites = arcade.get_sprites_at_point([x, y], self.all_sprites) + if len(sprites) == 1: + print("selected: ", sprites[0].guid) + def on_update(self, delta): self.all_sprites.update_animation() def add_tiles(sprites, positions): + id = 0 for p in positions: tile = arcade.AnimatedTimeBasedSprite() + tile.guid = id + id += 1 for i in range(2): tex = arcade.load_texture("res/tiles_0.png", x = i*75, y = 0, width = 75, height = 100) tile.append_texture(tex)