Research portable Memory game | Исследовать портируемую игру Память
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Window.py 1.7KB

3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import arcade
  2. CELL = 25
  3. HEIGHT = 600
  4. WIDTH = 900
  5. class Window(arcade.Window):
  6. def __init__(self):
  7. super().__init__(WIDTH, HEIGHT, "OGS Memory")
  8. #arcade.set_background_color(arcade.color.GRAY)
  9. arcade.set_background_color(arcade.color.WHITE)
  10. self.all_sprites = arcade.SpriteList()
  11. # # Animated begin button.
  12. # player = arcade.AnimatedTimeBasedSprite()
  13. # for i in range(2):
  14. # tex = arcade.load_texture("res/buttons_begin.png", x = i*350, y = 0, width = 350, height = 100)
  15. # player.append_texture(tex)
  16. # #player.color = arcade.color.BLUE
  17. # a = arcade.sprite.AnimationKeyframe(i, 700, tex)
  18. # player.frames.append(a)
  19. # player.center_x = 300
  20. # player.center_y = 200
  21. # self.all_sprites.append(player)
  22. positions = [
  23. [9, 1],
  24. [14, 1],
  25. [19, 1],
  26. [24, 1],
  27. [9, 7],
  28. [14, 7],
  29. [19, 7],
  30. [24, 7],
  31. [9, 13],
  32. [14, 13],
  33. [19, 13],
  34. [24, 13],
  35. [9, 19],
  36. [14, 19],
  37. [19, 19],
  38. [24, 19],
  39. ]
  40. add_tiles(self.all_sprites, positions)
  41. def on_draw(self):
  42. arcade.start_render()
  43. #arcade.draw_circle_filled(400, 300, 15, arcade.color.BLUE)
  44. self.all_sprites.draw()
  45. def on_update(self, delta):
  46. self.all_sprites.update_animation()
  47. def add_tiles(sprites, positions):
  48. for p in positions:
  49. tile = arcade.AnimatedTimeBasedSprite()
  50. for i in range(2):
  51. tex = arcade.load_texture("res/tiles_0.png", x = i*75, y = 0, width = 75, height = 100)
  52. tile.append_texture(tex)
  53. a = arcade.sprite.AnimationKeyframe(i, 700, tex)
  54. tile.frames.append(a)
  55. tile.center_x = CELL * 2 + p[0] * CELL
  56. tile.center_y = HEIGHT - CELL * 2 - p[1] * CELL
  57. sprites.append(tile)