Михаил Капелько 6 月之前
父節點
當前提交
cba1543341
共有 1 個文件被更改,包括 9 次插入14 次删除
  1. +9
    -14
      v5/Window.py

+ 9
- 14
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)


Loading…
取消
儲存