{"id":462806,"date":"2025-06-10T15:01:47","date_gmt":"2025-06-10T15:01:47","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=462806"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=462806","title":{"rendered":"<span>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 2D \u0438\u0433\u0440\u044b \u043d\u0430 Python<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><em>*P.S.<\/em><\/p>\n<p><em>\u042f \u0432\u0441\u0451 \u0435\u0449\u0451 \u0448\u043a\u043e\u043b\u044c\u043d\u0438\u043a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0436\u0434\u0430\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442, \u043d\u043e \u0435\u0441\u043b\u0438 \u0442\u0435\u0431\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u043c\u0438\u0440 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440 \u0441 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u0431\u0435 \u0445\u043e\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439.  <\/em><\/p>\n<p>\u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0433\u0430\u0439\u0434 \u043f\u043e\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0441\u0442\u0435\u0446\u043a\u043e\u0439 \u0438\u0433\u0440\u044b \u043d\u0430\u00a0Python. \u0412\u0441\u0451 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0432\u00a0\u043f\u0443\u0447\u0430\u0440\u043c\u0435 \u00ab<a href=\"https:\/\/www.jetbrains.com\/ru-ru\/pycharm\/\" rel=\"noopener noreferrer nofollow\">PyCharm<\/a>\u00bb. \u0415\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u00a0\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435\u00a0\u0431\u0443\u0434\u0435\u0442, \u0432\u0441\u0451 \u044d\u0442\u043e \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u0435\u0441\u0442\u044c \u0440\u0443(\u044e)\u0442\u0443\u0431\u0435.<\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Pygame \u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043d\u0430\u0447\u043d\u0435\u043c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0433\u0440\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pygame.<\/p>\n<ul>\n<li>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Pygame.<\/strong><\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043b\u0438 \u0443 \u0432\u0430\u0441 Python.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0438 \u043f\u0438\u0448\u0435\u043c:\u00a0<code>pip install pygame<\/code><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/strong>\u00a0\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0430\u043f\u043e\u043a \u0438 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<pre><code>\u043f\u0440\u043e\u0435\u043a\u0442\/     \u251c\u2500\u2500 img\/           # \u041f\u0430\u043f\u043a\u0430 \u0434\u043b\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 (\u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432)     \u251c\u2500\u2500 sound\/         # \u041f\u0430\u043f\u043a\u0430 \u0434\u043b\u044f \u0437\u0432\u0443\u043a\u043e\u0432     \u251c\u2500\u2500 config.py      # \u0424\u0430\u0439\u043b \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0438\u0433\u0440\u044b     \u251c\u2500\u2500 objects.py     # \u0424\u0430\u0439\u043b \u0441 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432     \u2514\u2500\u2500 main.py        # \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u0438\u0433\u0440\u044b<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0424\u0430\u0439\u043b\u00a0<\/strong><a href=\"http:\/\/config.py\" rel=\"noopener noreferrer nofollow\"><code><strong>config.py<\/strong><\/code><\/a><strong>\u00a0\u2013 \u0421\u0435\u0440\u0434\u0446\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a.<\/strong>\u00a0\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b\u00a0<a href=\"http:\/\/config.py\" rel=\"noopener noreferrer nofollow\"><code>config.py<\/code><\/a>\u00a0\u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0442\u0443\u0434\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u0433\u0440\u044b. \u042d\u0442\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<pre><code class=\"python\"># config.py from os import path  WIDTH = 480  # \u0428\u0438\u0440\u0438\u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 HEIGHT = 600  # \u0412\u044b\u0441\u043e\u0442\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 FPS = 60  # \u0427\u0430\u0441\u0442\u043e\u0442\u0430 \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (FPS) # --- \u0426\u0432\u0435\u0442\u0430 --- WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) YELLOW = (255, 255, 0) # --- \u041f\u0443\u0442\u0438 \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c --- img_dir = path.join(path.dirname(__file__), 'img')  # \u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 img sound_dir = path.join(path.dirname(__file__), 'sound')  # \u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 sound # --- \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0411\u043e\u0441\u0441\u0430 --- BOSS_LASER_SPEED = 5 BOSS_LASER_COLOR = RED<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0435\u0440\u0435\u0432\u043e\u0436\u0443 \u0441\u043e \u0437\u043c\u0435\u0438\u043d\u043e\u0433\u043e \u043d\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u0438\u0439<\/strong><\/p>\n<ul>\n<li>\n<p><code>WIDTH<\/code>,\u00a0<code>HEIGHT<\/code>: \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043e\u043a\u043d\u0430 \u0438\u0433\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p><code>from os import path<\/code>: \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c <em>path.<\/em> \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a  \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0432\u043e \u0432\u0441\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<\/li>\n<li>\n<p><code>FPS<\/code>: \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430. \u0411\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2013 \u0431\u043e\u043b\u0435\u0435 \u043f\u043b\u0430\u0432\u043d\u0430\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0426\u0432\u0435\u0442\u0430: \u0417\u0430\u0434\u0430\u0435\u043c \u0446\u0432\u0435\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 RGB (\u041a\u0440\u0430\u0441\u043d\u044b\u0439, \u0417\u0435\u043b\u0435\u043d\u044b\u0439, \u0421\u0438\u043d\u0438\u0439).<\/p>\n<\/li>\n<li>\n<p><code>img_dir<\/code>,\u00a0<code>sound_dir<\/code>: \u042d\u0442\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043f\u0443\u0442\u0438 \u043a \u043f\u0430\u043f\u043a\u0430\u043c \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u0437\u0432\u0443\u043a\u0430\u043c\u0438, \u0447\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u0432 \u043a\u043e\u0434\u0435.\u00a0<code>path.join<\/code>\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0443\u0442\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0433\u0440\u044b: \u0421\u043f\u0440\u0430\u0439\u0442\u044b \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0438\u043c\u0438. \u0412 Pygame \u0432\u0441\u0435, \u0447\u0442\u043e \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 (\u0438\u0433\u0440\u043e\u043a, \u0432\u0440\u0430\u0433\u0438, \u043f\u0443\u043b\u0438), \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0441\u043f\u0440\u0430\u0439\u0442\u0430\u043c\u0438.<\/p>\n<ul>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441\u00a0<\/strong><code><strong><s>Entity<\/s><\/strong><\/code><strong>.<\/strong>\u00a0\u041e\u0431\u0449\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445\u00a0<code>Player<\/code>\u00a0\u0438\u00a0<code>Mob<\/code>. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u044d\u0442\u043e \u043e\u0431\u0449\u0438\u0439 \u201c\u0441\u043a\u0435\u043b\u0435\u0442\u201d \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e.<\/p>\n<ul>\n<li>\n<p><strong>\u0427\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0421\u043f\u0440\u0430\u0439\u0442 \u2013 \u044d\u0442\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u043f\u043e \u044d\u043a\u0440\u0430\u043d\u0443.<\/p>\n<\/li>\n<li>\n<p><code>pygame.sprite.Sprite<\/code>\u00a0\u2013 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 \u0432 Pygame.<\/p>\n<\/li>\n<li>\n<p><code>image<\/code>: \u0410\u0442\u0440\u0438\u0431\u0443\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u043f\u0440\u0430\u0439\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><code>rect<\/code>: \u0410\u0442\u0440\u0438\u0431\u0443\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0438\u0439 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043f\u0440\u0430\u0439\u0442\u0430 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><code>x<\/code>,\u00a0<code>y<\/code>: \u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043b\u0435\u0432\u043e\u0433\u043e \u0443\u0433\u043b\u0430 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u00a0<code>rect<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>speed<\/code>: \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441\u00a0<\/strong><code><strong>Player<\/strong><\/code><strong>\u00a0(\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u043a\u0430).<\/strong>\u00a0\u041a\u043b\u0430\u0441\u0441\u00a0<code>Player<\/code>\u00a0(\u0432\u00a0<a href=\"http:\/\/objects.py\" rel=\"noopener noreferrer nofollow\"><code>objects.py<\/code><\/a>) \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 (\u0438\u043b\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442) \u043e\u0431\u0449\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0443\u044e \u0434\u043b\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u043b\u043e\u0433\u0438\u043a\u0443:<\/p>\n<pre><code class=\"python\"># objects.py import pygame from config import *  # \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u0437 config.py  class Player(pygame.sprite.Sprite):  # \u041d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0441\u044f \u043e\u0442 pygame.sprite.Sprite     def __init__(self, all_sprites, bullets):         pygame.sprite.Sprite.__init__(self)         player_img = pygame.image.load(path.join(img_dir, \"player.png\")).convert_alpha()         self.image = pygame.transform.scale(player_img, (50, 50))  # \u041c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435         self.image.set_colorkey(BLACK)  # \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0444\u043e\u043d (\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u043c)         self.rect = self.image.get_rect()  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441\u043f\u0440\u0430\u0439\u0442\u0430         self.rect.centerx = WIDTH \/ 2  # \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u043e x (\u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443)         self.rect.bottom = HEIGHT - 10  # \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u043e y (\u0432\u043d\u0438\u0437\u0443)         self.speedx = 0  # \u0413\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c (\u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e 0)         self.all_sprites = all_sprites         self.bullets = bullets      def update(self):  # \u041c\u0435\u0442\u043e\u0434, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u0434\u0440         self.speedx = 0  # \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c         keystate = pygame.key.get_pressed()  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043a\u043b\u0430\u0432\u0438\u0448         if keystate[pygame.K_LEFT]:             self.speedx = -8  # \u0414\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0432\u043b\u0435\u0432\u043e, \u0435\u0441\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u0432\u043b\u0435\u0432\u043e         if keystate[pygame.K_RIGHT]:             self.speedx = 8  # \u0414\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0432\u043f\u0440\u0430\u0432\u043e         self.rect.x += self.speedx  # \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044e         if self.rect.right &gt; WIDTH:  # \u041d\u0435 \u0434\u0430\u0435\u043c \u0432\u044b\u043b\u0435\u0437\u0442\u0438 \u0437\u0430 \u043f\u0440\u0430\u0432\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443             self.rect.right = WIDTH         if self.rect.left &lt; 0:  # \u041d\u0435 \u0434\u0430\u0435\u043c \u0432\u044b\u043b\u0435\u0437\u0442\u0438 \u0437\u0430 \u043b\u0435\u0432\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443             self.rect.left = 0      def shoot(self):  # \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430         bullet = Bullet(self.rect.centerx, self.rect.top)  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0443\u043b\u044e         self.all_sprites.add(bullet)  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0443\u043b\u044e \u0432 \u043e\u0431\u0449\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443         self.bullets.add(bullet)  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0443\u043b\u044e \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u043f\u0443\u043b\u044c         laser_sound.play()  # \u041f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u043c \u0437\u0432\u0443\u043a \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434?<\/strong><\/p>\n<ul>\n<li>\n<p><code><strong>init<\/strong>()<\/code>: \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u0430. \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u043a\u0430, \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e, \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u0444\u043e\u043d (\u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u043c), \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p><code>update()<\/code>: \u041c\u0435\u0442\u043e\u0434, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u0434\u0440 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430:<\/p>\n<ul>\n<li>\n<p>\u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c (\u0447\u0442\u043e\u0431\u044b \u0438\u0433\u0440\u043e\u043a \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u043d\u0435 \u043d\u0430\u0436\u0430\u0442\u044b).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u0436\u0430\u0442\u044b\u0445 \u043a\u043b\u0430\u0432\u0438\u0448 (\u0432\u043b\u0435\u0432\u043e\/\u0432\u043f\u0440\u0430\u0432\u043e).<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u043a\u0430 \u043f\u043e \u043a\u0440\u0430\u044f\u043c \u044d\u043a\u0440\u0430\u043d\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><code>shoot()<\/code>: \u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u0443\u043b\u044e \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0435 \u0432 \u0433\u0440\u0443\u043f\u043f\u044b \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 Pygame (\u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b).<\/strong>\u00a0\u0422\u0435\u043f\u0435\u0440\u044c, \u0432\u00a0<a href=\"http:\/\/main.py\" rel=\"noopener noreferrer nofollow\"><code>main.py<\/code><\/a>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<pre><code class=\"python\"># main.py import pygame from config import * from objects import *  # --- \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f --- pygame.init() pygame.mixer.init()  # \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0432\u0443\u043a\u0430 screen = pygame.display.set_mode((WIDTH, HEIGHT))  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u043a\u043d\u043e \u0438\u0433\u0440\u044b pygame.display.set_caption(\"Space Shooter\")  # \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043e\u043a\u043d\u0430 clock = pygame.time.Clock()  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f FPS  # --- \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 --- background = pygame.image.load(path.join(img_dir, \"starfield.png\")).convert_alpha() background_rect = background.get_rect()  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0444\u043e\u043d\u0430  # --- \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0433\u0440\u0443\u043f\u043f \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 --- all_sprites = pygame.sprite.Group()  # \u0413\u0440\u0443\u043f\u043f\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 mobs = pygame.sprite.Group()  # \u0413\u0440\u0443\u043f\u043f\u0430 \u0434\u043b\u044f \u0432\u0440\u0430\u0433\u043e\u0432 bullets = pygame.sprite.Group()  # \u0413\u0440\u0443\u043f\u043f\u0430 \u0434\u043b\u044f \u043f\u0443\u043b\u044c boss_lasers = pygame.sprite.Group()  # \u0413\u0440\u0443\u043f\u043f\u0430 \u043b\u0430\u0437\u0435\u0440\u043e\u0432 \u0431\u043e\u0441\u0441\u0430  # --- \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 --- player = Player(all_sprites, bullets)  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u0433\u0440\u043e\u043a\u0430 all_sprites.add(player)  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u043e\u0431\u0449\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443  # --- \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u0443\u0437\u044b\u043a\u0438 \u0438 \u0437\u0432\u0443\u043a\u043e\u0432 --- pygame.mixer.music.load(path.join(sound_dir, 'Star_Wars_-_Rogue_One_-_OST_Izgojj-Odin_Zvjozdnye_Vojjny_65069199.mp3'))  # \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u0443\u0437\u044b\u043a\u0443 pygame.mixer.music.play(-1)  # \u041f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u043c \u043c\u0443\u0437\u044b\u043a\u0443 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e laser_sound = pygame.mixer.Sound(path.join(sound_dir, 'blaster.mp3'))  # \u0417\u0432\u0443\u043a \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430  # --- \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u044b --- game_over = True  # \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0438\u0433\u0440\u0430 \u043d\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430  # --- \u0421\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 \u044d\u043a\u0440\u0430\u043d (\u043f\u043e\u043a\u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c) --- # start_screen() # \u041f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0437\u0436\u0435  # --- \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b --- def start_screen():     # ... (\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430, \u043a\u0430\u043a \u0432 \u043a\u043e\u0434\u0435) ...     pass  # \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u0438\u0433\u0440\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0430\u0441\u044c  def reset_game(self):     # ... (\u0441\u0431\u0440\u043e\u0441 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u0433\u0440\u044b, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432) ...     pass  # \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430  def run():  # \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430     nonlocal game_over     while True:         if game_over:             if not start_screen():  # \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 \u044d\u043a\u0440\u0430\u043d, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c False \u043f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435                 return              continue          # --- \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 FPS ---         clock.tick(FPS)          # --- \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 (\u0432\u0432\u043e\u0434, \u0432\u044b\u0445\u043e\u0434) ---         for event in pygame.event.get():             if event.type == pygame.QUIT:  # \u0415\u0441\u043b\u0438 \u043d\u0430\u0436\u0430\u043b\u0438 \u043d\u0430 \u043a\u0440\u0435\u0441\u0442\u0438\u043a                 pygame.quit()  # \u0412\u044b\u0445\u043e\u0434 \u0438\u0437 Pygame                 return  # \u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e run()             elif event.type == pygame.KEYDOWN:  # \u041d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430                 if event.key == pygame.K_SPACE:  # \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0431\u0435\u043b                     player.shoot()                 elif event.key == pygame.K_ESCAPE:                     pygame.quit()                     return  # \u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0438\u0433\u0440\u0443          # --- \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 ---         all_sprites.update()  # \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c update() \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432          # --- \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 ---         screen.fill(BLACK)  # \u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u044d\u043a\u0440\u0430\u043d \u0447\u0435\u0440\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c         screen.blit(background, background_rect)  # \u0420\u0438\u0441\u0443\u0435\u043c \u0444\u043e\u043d         all_sprites.draw(screen)  # \u0420\u0438\u0441\u0443\u0435\u043c \u0432\u0441\u0435 \u0441\u043f\u0440\u0430\u0439\u0442\u044b          # --- \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u044d\u043a\u0440\u0430\u043d\u0430 ---         pygame.display.flip()  # \u041f\u0435\u0440\u0435\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0431\u0443\u0444\u0435\u0440 \u044d\u043a\u0440\u0430\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f  def main():     run()  if __name__ == \"__main__\":     main()<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434?<\/strong><\/p>\n<ul>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 Pygame.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u043a\u043d\u043e \u0438\u0433\u0440\u044b \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f FPS (<code>clock<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0444\u043e\u043d\u043e\u0432\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u044b \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>all_sprites<\/code>: \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 (\u0438\u0433\u0440\u043e\u043a, \u0432\u0440\u0430\u0433\u0438, \u043f\u0443\u043b\u0438).<\/p>\n<\/li>\n<li>\n<p><code>mobs<\/code>: \u0414\u043b\u044f \u0432\u0440\u0430\u0433\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><code>bullets<\/code>: \u0414\u043b\u044f \u043f\u0443\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p><code>boss_lasers<\/code>: \u0414\u043b\u044f \u043b\u0430\u0437\u0435\u0440\u043e\u0432 \u0431\u043e\u0441\u0441\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043c\u0443\u0437\u044b\u043a\u0443 \u0438 \u0437\u0432\u0443\u043a \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0445\u043e\u0434\u0438\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b\u00a0<code>run()<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412 \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u0446\u0438\u043a\u043b\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><code>clock.tick(FPS)<\/code>: \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u043a\u0430\u0434\u0440\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><code>pygame.event.get()<\/code>: \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f (\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448, \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043e\u043a\u043d\u0430).<\/p>\n<\/li>\n<li>\n<p><code>for event in ...<\/code>: \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<ul>\n<li>\n<p><code>pygame.QUIT<\/code>: \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043e\u043a\u043d\u043e, \u0438\u0433\u0440\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p><code>pygame.KEYDOWN<\/code>: \u0415\u0441\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430:<\/p>\n<ul>\n<li>\n<p><code>K_SPACE<\/code>: \u0418\u0433\u0440\u043e\u043a \u0441\u0442\u0440\u0435\u043b\u044f\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p><code>K_ESCAPE<\/code>: \u0418\u0433\u0440\u043e\u043a \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u0438\u0433\u0440\u044b.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><code>all_sprites.update()<\/code>: \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u00a0<code>update()<\/code>\u00a0\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043f\u0440\u0430\u0439\u0442\u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435. \u042d\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u043a\u0430, \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043f\u0443\u043b\u044c).<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430:<\/p>\n<ul>\n<li>\n<p><code>screen.fill(BLACK)<\/code>: \u0417\u0430\u043b\u0438\u0432\u0430\u0435\u0442 \u044d\u043a\u0440\u0430\u043d \u0447\u0435\u0440\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><code>screen.blit(background, background_rect)<\/code>: \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0444\u043e\u043d.<\/p>\n<\/li>\n<li>\n<p><code>all_sprites.draw(screen)<\/code>: \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u043f\u0440\u0430\u0439\u0442\u044b \u0432 \u0433\u0440\u0443\u043f\u043f\u0435\u00a0<code>all_sprites<\/code>. Pygame \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u00a0<code>image<\/code>\u00a0\u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 \u0438 \u0438\u0445\u00a0<code>rect<\/code>\u00a0\u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><code>pygame.display.flip()<\/code>: \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 (\u043f\u0435\u0440\u0435\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442) \u044d\u043a\u0440\u0430\u043d, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u0412\u0440\u0430\u0433\u0438 \u0438 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0440\u0430\u0433\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0433\u0440\u0443 \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439, \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043f\u0443\u043b\u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432\u043e \u0432\u0440\u0430\u0433\u043e\u0432, \u0438 \u043a\u043e\u0433\u0434\u0430 \u0438\u0433\u0440\u043e\u043a \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u0432\u0440\u0430\u0433\u0430\u043c\u0438.<\/p>\n<ul>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441\u00a0<\/strong><code><strong>Mob<\/strong><\/code><strong>\u00a0(\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0440\u0430\u0433\u043e\u0432).<\/strong>\u00a0\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u00a0<code>Mob<\/code>\u00a0(\u0432\u00a0<a href=\"http:\/\/objects.py\" rel=\"noopener noreferrer nofollow\"><code>objects.py<\/code><\/a>) \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0440\u0430\u0433\u043e\u0432. \u0412\u0440\u0430\u0433\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u0432\u0435\u0440\u0445\u0443 \u0438 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0432\u043d\u0438\u0437.<\/p>\n<pre><code class=\"python\"># objects.py import pygame import random from config import *  class Mob(pygame.sprite.Sprite):     def __init__(self):         pygame.sprite.Sprite.__init__(self)         meteor_img = pygame.image.load(path.join(img_dir, \"Ship.png\")).convert_alpha()  # \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0440\u0430\u0433\u0430         self.image = meteor_img #.convert() # \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 convert_alpha()         self.image.set_colorkey(BLACK)         self.rect = self.image.get_rect()  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0432\u0440\u0430\u0433\u0430         self.rect.x = random.randrange(WIDTH - self.rect.width)  # \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u043e x         self.rect.y = random.randrange(-100, -40)  # \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u043e y (\u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u044d\u043a\u0440\u0430\u043d\u0430)         self.speedy = random.randrange(1, 8)  # \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0430\u0434\u0435\u043d\u0438\u044f         self.speedx = random.randrange(-3, 3)  # \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u043e x      def update(self):  # \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432\u0440\u0430\u0433\u0430         self.rect.x += self.speedx # \u0414\u0432\u0438\u0433\u0430\u0435\u043c \u043f\u043e x         self.rect.y += self.speedy  # \u0414\u0432\u0438\u0433\u0430\u0435\u043c \u0432\u043d\u0438\u0437         if self.rect.top &gt; HEIGHT + 10 or self.rect.left &lt; -25 or self.rect.right &gt; WIDTH + 20:             # \u0415\u0441\u043b\u0438 \u0432\u0440\u0430\u0433 \u0443\u0448\u0435\u043b \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u044d\u043a\u0440\u0430\u043d\u0430, \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0435\u0433\u043e             self.rect.x = random.randrange(WIDTH - self.rect.width)             self.rect.y = random.randrange(-100, -40)             self.speedy = random.randrange(1, 8)<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434?<\/strong><\/p>\n<ul>\n<li>\n<p><code><strong>init<\/strong>()<\/code>: \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0440\u0430\u0433\u0430, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0430\u0434\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><code>update()<\/code>: \u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442 \u0432\u0440\u0430\u0433\u0430 \u0432\u043d\u0438\u0437, \u0430 \u0442\u0430\u043a\u0436\u0435, \u0435\u0441\u043b\u0438 \u0432\u0440\u0430\u0433 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u044d\u043a\u0440\u0430\u043d\u0430, \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442 \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430\u0432\u0435\u0440\u0445.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441\u00a0<\/strong><code><strong>Bullet<\/strong><\/code><strong>\u00a0(\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u043b\u044c).<\/strong>\u00a0\u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0443\u0436\u0435 \u0431\u044b\u043b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0432\u044b\u0448\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439 \u0438 \u043b\u043e\u0433\u0438\u043a\u0430 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f.<\/strong>\u00a0\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u0438\u0433\u0440\u044b (<a href=\"http:\/\/main.py\" rel=\"noopener noreferrer nofollow\"><code>main.py<\/code><\/a>):<\/p>\n<pre><code class=\"python\"># main.py (\u0432\u043d\u0443\u0442\u0440\u0438 \u0446\u0438\u043a\u043b\u0430 run()) # ... (\u043a\u043e\u0434 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430) ...  # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0439 \u043f\u0443\u043b\u044c \u0441 \u0432\u0440\u0430\u0433\u0430\u043c\u0438 (\u043f\u0443\u043b\u0438 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u044e\u0442 \u0432\u0440\u0430\u0433\u043e\u0432) hits = pygame.sprite.groupcollide(self.mobs, self.bullets, True, True)  # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f. True, True = \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0438 \u0432\u0440\u0430\u0433\u0430 \u0438 \u043f\u0443\u043b\u044e for hit in hits:     m = Mob()  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u0432\u0440\u0430\u0433\u0430     self.all_sprites.add(m)  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u043e\u0431\u0449\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443     self.mobs.add(m)  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u0432\u0440\u0430\u0433\u043e\u0432     self.score_counter.add(1)  # \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0441\u0447\u0435\u0442  # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u0441 \u0432\u0440\u0430\u0433\u0430\u043c\u0438 (\u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0448) hits = pygame.sprite.spritecollide(self.player, self.mobs, False)  # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u0441 \u0432\u0440\u0430\u0433\u0430\u043c\u0438. False = \u0432\u0440\u0430\u0433 \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f if hits:     self.game_over = True  # \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0444\u043b\u0430\u0433 game_over     # \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e: \u043c\u043e\u0436\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435 \u0438\u0433\u0440\u043e\u043a\u0430, \u0430 \u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442\u044c \u0438\u0433\u0440\u0443  # ... (\u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430) ...<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434?<\/strong><\/p>\n<ul>\n<li>\n<p><code>pygame.sprite.groupcollide(self.mobs, self.bullets, True, True)<\/code>: \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 \u0432\u0440\u0430\u0433\u043e\u0432 (<code>self.mobs<\/code>) \u0438 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 \u043f\u0443\u043b\u044c (<code>self.bullets<\/code>). \u0415\u0441\u043b\u0438 \u043f\u0443\u043b\u044f \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432\u043e \u0432\u0440\u0430\u0433\u0430, \u0438 \u043f\u0443\u043b\u044f, \u0438 \u0432\u0440\u0430\u0433 \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0437 \u0441\u0432\u043e\u0438\u0445 \u0433\u0440\u0443\u043f\u043f (\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b\u00a0<code>True, True<\/code>). \u041f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0432\u0440\u0430\u0433 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0447\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p><code>pygame.sprite.spritecollide(self.player, self.mobs, False)<\/code>: \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0438\u0433\u0440\u043e\u043a\u043e\u043c \u0438 \u0432\u0440\u0430\u0433\u0430\u043c\u0438. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u043b\u0430\u0433\u00a0<a href=\"http:\/\/self.game\" rel=\"noopener noreferrer nofollow\"><code>self.game<\/code><\/a><code>_over = True<\/code>, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043a\u043e\u043d\u0435\u0446 \u0438\u0433\u0440\u044b.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>4. \u0411\u043e\u0441\u0441: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a\u0430<\/h4>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043e\u0447\u043a\u043e\u0432 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u0441\u0441.<\/p>\n<ul>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441\u00a0<\/strong><code><strong>Boss<\/strong><\/code><strong>\u00a0(\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u043e\u0441\u0441\u0430).<\/strong>\u00a0\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u00a0<code>Boss<\/code>\u00a0(\u0432\u00a0<a href=\"http:\/\/objects.py\" rel=\"noopener noreferrer nofollow\"><code>objects.py<\/code><\/a>).<\/p>\n<pre><code class=\"python\"># objects.py import pygame import random from config import *  class Boss(pygame.sprite.Sprite):     def __init__(self, x, y, all_sprites, boss_lasers):         pygame.sprite.Sprite.__init__(self)         boss_image = pygame.image.load(path.join(img_dir, \"Boss.png\")).convert_alpha()  # \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u043e\u0441\u0441\u0430         self.image = pygame.transform.scale(boss_image, (90, 150))  # \u041c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435         self.image.set_colorkey(BLACK)         self.rect = self.image.get_rect()  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0431\u043e\u0441\u0441\u0430         self.rect.x = x  # \u041f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u043e X         self.rect.y = y  # \u041f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u043e Y         print(\"Boss created at:\", self.rect.x, self.rect.y)         self.health = 50  # \u0417\u0434\u043e\u0440\u043e\u0432\u044c\u0435 \u0431\u043e\u0441\u0441\u0430         self.original_image = self.image  # \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (\u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438)         self.last_shot = pygame.time.get_ticks()  # \u0412\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430         self.shoot_delay = 2000  # \u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430\u043c\u0438 (\u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445)         self.all_sprites = all_sprites  # \u0413\u0440\u0443\u043f\u043f\u0430 \u0432\u0441\u0435\u0445 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432         self.boss_lasers = boss_lasers  # \u0413\u0440\u0443\u043f\u043f\u0430 \u043b\u0430\u0437\u0435\u0440\u043e\u0432 \u0431\u043e\u0441\u0441\u0430      def update(self):         # \u0414\u0432\u0438\u0433\u0430\u0435\u043c \u0431\u043e\u0441\u0441\u0430 (\u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0435\u0435)         self.rect.x += random.choice([-2, -1, 0, 1, 2])  # \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438         if self.rect.left &lt; 0:             self.rect.left = 0  # \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0432\u0430         if self.rect.right &gt; WIDTH:             self.rect.right = WIDTH  # \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0441\u043f\u0440\u0430\u0432\u0430          # \u0421\u0442\u0440\u0435\u043b\u044f\u0435\u043c         now = pygame.time.get_ticks()  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f         if now - self.last_shot &gt; self.shoot_delay:  # \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0448\u043b\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430             self.last_shot = now  # \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430             laser = BossLaser(self.rect.centerx, self.rect.bottom)  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043b\u0430\u0437\u0435\u0440             self.all_sprites.add(laser)  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043b\u0430\u0437\u0435\u0440 \u0432 \u043e\u0431\u0449\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432             self.boss_lasers.add(laser)  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043b\u0430\u0437\u0435\u0440 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u043b\u0430\u0437\u0435\u0440\u043e\u0432 \u0431\u043e\u0441\u0441\u0430      def draw(self, screen):         screen.blit(self.image, self.rect)      def damage(self, amount):         self.health -= amount         if self.health &lt;= 0:             self.kill()  # \u0415\u0441\u043b\u0438 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435 &lt;= 0, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u0435\u043c \u0431\u043e\u0441\u0441\u0430<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434?<\/strong><\/p>\n<ul>\n<li>\n<p><code><strong>init<\/strong>()<\/code>: \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0431\u043e\u0441\u0441\u0430, \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u0442, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e, \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435, \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p><code>update()<\/code>: \u041e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0431\u043e\u0441\u0441\u0430 \u0438 \u0441\u0442\u0440\u0435\u043b\u044c\u0431\u0443 \u043b\u0430\u0437\u0435\u0440\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><code>draw()<\/code>: \u0420\u0438\u0441\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0431\u043e\u0441\u0441\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435.<\/p>\n<\/li>\n<li>\n<p><code>damage()<\/code>: \u0423\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435 \u0431\u043e\u0441\u0441\u0430. \u041f\u0440\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 0, \u0431\u043e\u0441\u0441 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441\u00a0<\/strong><code><strong>BossLaser<\/strong><\/code><strong>\u00a0(\u043b\u0430\u0437\u0435\u0440\u044b \u0431\u043e\u0441\u0441\u0430).<\/strong><\/p>\n<pre><code class=\"python\"># objects.py import pygame from config import *  class BossLaser(pygame.sprite.Sprite):     def __init__(self, x, y):         pygame.sprite.Sprite.__init__(self)         self.image = pygame.Surface((5, 20))  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043b\u0430\u0437\u0435\u0440\u0430 (\u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a)         self.image.fill(BOSS_LASER_COLOR)  # \u0417\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0446\u0432\u0435\u0442\u043e\u043c \u043b\u0430\u0437\u0435\u0440\u0430         self.image = self.image.convert_alpha() # \u041f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c         self.rect = self.image.get_rect()  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043b\u0430\u0437\u0435\u0440\u0430         self.rect.centerx = x  # \u0426\u0435\u043d\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043b\u0430\u0437\u0435\u0440 \u043f\u043e x         self.rect.bottom = y  # \u0420\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c \u043b\u0430\u0437\u0435\u0440 \u043f\u043e\u0434 \u0431\u043e\u0441\u0441\u043e\u043c         self.speedy = BOSS_LASER_SPEED  # \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0430\u0434\u0435\u043d\u0438\u044f      def update(self):         self.rect.y += self.speedy  # \u0414\u0432\u0438\u0433\u0430\u0435\u043c \u043b\u0430\u0437\u0435\u0440 \u0432\u043d\u0438\u0437         if self.rect.bottom &gt; HEIGHT:             self.kill()  # \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043b\u0430\u0437\u0435\u0440, \u0435\u0441\u043b\u0438 \u043e\u043d \u0432\u044b\u0448\u0435\u043b \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u044d\u043a\u0440\u0430\u043d\u0430<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u043e\u0441\u0441\u0430 \u0432 \u0438\u0433\u0440\u0443 (<\/strong><a href=\"http:\/\/main.py\" rel=\"noopener noreferrer nofollow\"><strong>main.py<\/strong><\/a><strong>).<\/strong>\u00a0\u041b\u043e\u0433\u0438\u043a\u0430 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u043e\u0441\u0441\u0430 \u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441 \u043d\u0438\u043c:<\/p>\n<pre><code class=\"python\"># main.py (\u0432\u043d\u0443\u0442\u0440\u0438 run()) # ... (\u043a\u043e\u0434 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430) ...  # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u043e\u0441\u0441\u0430 if self.score_counter.get_score() % 100 == 0 and self.score_counter.get_score()!=0 and self.boss is None:     self.boss = Boss(WIDTH \/\/ 2 - 50, 50, self.all_sprites, self.boss_lasers)  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0431\u043e\u0441\u0441\u0430     self.all_sprites.add(self.boss)  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0431\u043e\u0441\u0441\u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432  # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0439 \u043f\u0443\u043b\u044c \u0441 \u0431\u043e\u0441\u0441\u043e\u043c if self.boss:     for bullet in self.bullets:         if pygame.sprite.collide_rect(bullet, self.boss):  # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435             self.boss.damage(3)  # \u0423\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u043c \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435 \u0431\u043e\u0441\u0441\u0430             self.bullets.remove(bullet)  # \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u0443\u043b\u044e             self.all_sprites.remove(bullet)             break  # \u0412\u0430\u0436\u043d\u043e: \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u0435 \u0437\u0430 \u0440\u0430\u0437      if self.boss.health &lt;= 0:         self.boss.kill()  # \u0415\u0441\u043b\u0438 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435 \u0431\u043e\u0441\u0441\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u043e 0, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u0435\u043c \u0435\u0433\u043e         self.boss = None  # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u0441 \u043b\u0430\u0437\u0435\u0440\u0430\u043c\u0438 \u0431\u043e\u0441\u0441\u0430 (\u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0448) hits = pygame.sprite.spritecollide(self.player, self.boss_lasers, True)  # True - \u043b\u0430\u0437\u0435\u0440\u044b \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f if hits:     self.game_over = True  # \u041a\u043e\u043d\u0435\u0446 \u0438\u0433\u0440\u044b<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434?<\/strong><\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u0431\u0440\u0430\u043b \u043b\u0438 \u0438\u0433\u0440\u043e\u043a \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0447\u043a\u043e\u0432 (<code>self.score_counter.get_score() % 100 == 0 and self.score_counter.get_score()!=0<\/code>) \u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0431\u043e\u0441\u0441 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 (<code>self.boss is None<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u00a0<code>Boss<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043b\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043f\u0443\u043b\u044c \u0441 \u0431\u043e\u0441\u0441\u043e\u043c. \u0415\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u0431\u043e\u0441\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0443\u0440\u043e\u043d, \u0430 \u043f\u0443\u043b\u044f \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d \u043b\u0438 \u0431\u043e\u0441\u0441 (\u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435 &lt;= 0). \u0415\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u0431\u043e\u0441\u0441 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u0441 \u043b\u0430\u0437\u0435\u0440\u0430\u043c\u0438 \u0431\u043e\u0441\u0441\u0430. \u0415\u0441\u043b\u0438 \u0438\u0433\u0440\u043e\u043a \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043b\u0430\u0437\u0435\u0440\u043e\u043c, \u0438\u0433\u0440\u0430 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u0423\u0440\u043e\u0432\u043d\u0438 \u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441: \u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0433\u0440\u044b (\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043e)<\/h4>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 &#8212; \u0438\u0433\u0440\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432\u00a0<code>game_over<\/code>\u00a0\u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438 \u0438\u0433\u0440\u043e\u043a\u0430 \u0441 \u043c\u043e\u0431\u043e\u0432\/\u043f\u0443\u043b\u0435\u0439 \u0431\u043e\u0441\u0441\u0430, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 \u044d\u043a\u0440\u0430\u043d.<\/p>\n<ul>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441\u00a0<\/strong><code><strong>ScoreCount<\/strong><\/code><strong>\u00a0(\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0432 <\/strong><a href=\"http:\/\/objects.py\" rel=\"noopener noreferrer nofollow\"><strong>objects.py<\/strong><\/a><strong>).<\/strong>\u00a0\u041a\u043b\u0430\u0441\u0441, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u043e\u0447\u043a\u0438.<\/p>\n<pre><code class=\"python\"># objects.py import pygame from config import *  class ScoreCount:     def __init__(self, initial_score=0):         self.score = initial_score         self._score = initial_score         self.font = pygame.font.Font(None, 36)  # \u0428\u0440\u0438\u0444\u0442 \u0438 \u0440\u0430\u0437\u043c\u0435\u0440         self.update_score_surface()      def add(self, points):         self.score += points         self.update_score_surface()      def get_score(self):         return self.score      def update_score_surface(self):         self.score_surface = self.font.render(f\"Score: {int(self.score)}\", True, (255, 255, 255))      def reset(self):         self.score = 0      def draw(self, screen, x=10, y=10):         if self.score_surface:             screen.blit(self.score_surface, (x, y))<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u0447\u0435\u0442\u0430 \u0432 \u0438\u0433\u0440\u0435 (<\/strong><a href=\"http:\/\/main.py\" rel=\"noopener noreferrer nofollow\"><strong>main.py<\/strong><\/a><strong>).<\/strong>\u00a0\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u00a0<code>ScoreCount<\/code>\u00a0\u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e.<\/p>\n<pre><code class=\"python\"># main.py # ... (\u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 Application.__init__) ... self.score_counter = ScoreCount()  # ... (\u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 run()) ... self.score_counter.draw(self.screen)<\/code><\/pre>\n<\/li>\n<\/ul>\n<h4>6. \u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0438\u0433\u0440\u044b: \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u044b \u0438 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 \u044d\u043a\u0440\u0430\u043d (main.py)<\/h4>\n<ul>\n<li>\n<p><strong>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u044b:<\/strong>\u00a0\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f\u00a0<a href=\"http:\/\/self.game\" rel=\"noopener noreferrer nofollow\"><code>self.game<\/code><\/a><code>_over<\/code>\u00a0\u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u044b.<\/p>\n<pre><code class=\"python\"># main.py (\u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 Application) def start_screen(self):     start_image = pygame.image.load(path.join(img_dir, \"start.png\")).convert_alpha()     start_rect = start_image.get_rect(center=(WIDTH \/\/ 2, HEIGHT \/\/ 2))      font_name = pygame.font.match_font('arial')     font = pygame.font.Font(font_name, 30)      line1 = \"\u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u043d\u0430 \u043b\u044e\u0431\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443,\"     line2 = \"\u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0433\u0440\u0443, \u0438\u043b\u0438 Esc, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0439\u0442\u0438\"      text_surface1 = font.render(line1, True, WHITE)     text_surface2 = font.render(line2, True, WHITE)      text_rect1 = text_surface1.get_rect(center=(WIDTH \/\/ 2, HEIGHT \/\/ 2 - 20))     text_rect2 = text_surface2.get_rect(center=(WIDTH \/\/ 2, HEIGHT \/\/ 2 + 20))      running = True     while running:         self.clock.tick(FPS)         for event in pygame.event.get():             if event.type == pygame.QUIT:                 pygame.quit()                 return False  # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 False \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0438\u0433\u0440\u044b             if event.type == pygame.KEYDOWN:                 if event.key == pygame.K_ESCAPE:                     pygame.quit()                     return False  # \u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u0438\u0433\u0440\u044b                 else:                     running = False  # \u041d\u0430\u0436\u0430\u0442\u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430 -&gt; \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0438\u0433\u0440\u0443          self.screen.blit(start_image, start_rect)         self.screen.blit(text_surface1, text_rect1)         self.screen.blit(text_surface2, text_rect2)         pygame.display.flip()      self.game_over = False  # \u0418\u0433\u0440\u0430 \u043d\u0430\u0447\u0430\u043b\u0430\u0441\u044c     self.reset_game()  # \u0421\u0431\u0440\u043e\u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432<\/code><\/pre>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434?<\/strong><\/p>\n<ul>\n<li>\n<p>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0442\u0435\u043a\u0441\u0442.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0436\u0438\u0434\u0430\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0438 (\u043b\u044e\u0431\u043e\u0439, \u043a\u0440\u043e\u043c\u0435\u00a0<code>ESC<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430 &#8212;\u00a0<a href=\"http:\/\/self.game\" rel=\"noopener noreferrer nofollow\"><code>self.game<\/code><\/a><code>_over<\/code>\u00a0=\u00a0<code>False<\/code>, \u0438\u0433\u0440\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u00a0<code>False<\/code>, \u0435\u0441\u043b\u0438 \u0431\u044b\u043b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d \u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u0438\u0433\u0440\u044b.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u0418\u0442\u043e\u0433\u0438<\/h4>\n<ul>\n<li>\n<p>\u0412\u043e\u0442 \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fc0\/284\/e01\/fc0284e01a5faafafb6dbe69bf6ca5d2.png\" width=\"599\" height=\"795\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/fc0\/284\/e01\/fc0284e01a5faafafb6dbe69bf6ca5d2.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fc0\/284\/e01\/fc0284e01a5faafafb6dbe69bf6ca5d2.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a4b\/487\/9f7\/a4b4879f79b489807c1686c265a2f9b8.png\" width=\"588\" height=\"771\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/a4b\/487\/9f7\/a4b4879f79b489807c1686c265a2f9b8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a4b\/487\/9f7\/a4b4879f79b489807c1686c265a2f9b8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/917276\/\"> https:\/\/habr.com\/ru\/articles\/917276\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><em>*P.S.<\/em><\/p>\n<p><em>\u042f \u0432\u0441\u0451 \u0435\u0449\u0451 \u0448\u043a\u043e\u043b\u044c\u043d\u0438\u043a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0436\u0434\u0430\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442, \u043d\u043e \u0435\u0441\u043b\u0438 \u0442\u0435\u0431\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u043c\u0438\u0440 \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440 \u0441 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u0431\u0435 \u0445\u043e\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439.  <\/em><\/p>\n<p>\u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0433\u0430\u0439\u0434 \u043f\u043e\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0441\u0442\u0435\u0446\u043a\u043e\u0439 \u0438\u0433\u0440\u044b \u043d\u0430\u00a0Python. \u0412\u0441\u0451 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0432\u00a0\u043f\u0443\u0447\u0430\u0440\u043c\u0435 \u00ab<a href=\"https:\/\/www.jetbrains.com\/ru-ru\/pycharm\/\" rel=\"noopener noreferrer nofollow\">PyCharm<\/a>\u00bb. \u0415\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u00a0\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435\u00a0\u0431\u0443\u0434\u0435\u0442, \u0432\u0441\u0451 \u044d\u0442\u043e \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u0435\u0441\u0442\u044c \u0440\u0443(\u044e)\u0442\u0443\u0431\u0435.<\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Pygame \u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043d\u0430\u0447\u043d\u0435\u043c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0433\u0440\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pygame.<\/p>\n<ul>\n<li>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Pygame.<\/strong><\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043b\u0438 \u0443 \u0432\u0430\u0441 Python.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0438 \u043f\u0438\u0448\u0435\u043c:\u00a0<code>pip install pygame<\/code><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/strong>\u00a0\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0430\u043f\u043e\u043a \u0438 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<pre><code>\u043f\u0440\u043e\u0435\u043a\u0442\/     \u251c\u2500\u2500 img\/           # \u041f\u0430\u043f\u043a\u0430 \u0434\u043b\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 (\u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432)     \u251c\u2500\u2500 sound\/         # \u041f\u0430\u043f\u043a\u0430 \u0434\u043b\u044f \u0437\u0432\u0443\u043a\u043e\u0432     \u251c\u2500\u2500 config.py      # \u0424\u0430\u0439\u043b \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0438\u0433\u0440\u044b     \u251c\u2500\u2500 objects.py     # \u0424\u0430\u0439\u043b \u0441 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432     \u2514\u2500\u2500 main.py        # \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u0438\u0433\u0440\u044b<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0424\u0430\u0439\u043b\u00a0<\/strong><a href=\"http:\/\/config.py\" rel=\"noopener noreferrer nofollow\"><code><strong>config.py<\/strong><\/code><\/a><strong>\u00a0\u2013 \u0421\u0435\u0440\u0434\u0446\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a.<\/strong>\u00a0\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b\u00a0<a href=\"http:\/\/config.py\" rel=\"noopener noreferrer nofollow\"><code>config.py<\/code><\/a>\u00a0\u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0442\u0443\u0434\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u0433\u0440\u044b. \u042d\u0442\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<pre><code class=\"python\"># config.py from os import path  WIDTH = 480  # \u0428\u0438\u0440\u0438\u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 HEIGHT = 600  # \u0412\u044b\u0441\u043e\u0442\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 FPS = 60  # \u0427\u0430\u0441\u0442\u043e\u0442\u0430 \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (FPS) # --- \u0426\u0432\u0435\u0442\u0430 --- WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) YELLOW = (255, 255, 0) # --- \u041f\u0443\u0442\u0438 \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c --- img_dir = path.join(path.dirname(__file__), 'img')  # \u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 img sound_dir = path.join(path.dirname(__file__), 'sound')  # \u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 sound # --- \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0411\u043e\u0441\u0441\u0430 --- BOSS_LASER_SPEED = 5 BOSS_LASER_COLOR = RED<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0435\u0440\u0435\u0432\u043e\u0436\u0443 \u0441\u043e \u0437\u043c\u0435\u0438\u043d\u043e\u0433\u043e \u043d\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u0438\u0439<\/strong><\/p>\n<ul>\n<li>\n<p><code>WIDTH<\/code>,\u00a0<code>HEIGHT<\/code>: \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043e\u043a\u043d\u0430 \u0438\u0433\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p><code>from os import path<\/code>: \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c <em>path.<\/em> \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a  \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0432\u043e \u0432\u0441\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<\/li>\n<li>\n<p><code>FPS<\/code>: \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430. \u0411\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2013 \u0431\u043e\u043b\u0435\u0435 \u043f\u043b\u0430\u0432\u043d\u0430\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0426\u0432\u0435\u0442\u0430: \u0417\u0430\u0434\u0430\u0435\u043c \u0446\u0432\u0435\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 RGB (\u041a\u0440\u0430\u0441\u043d\u044b\u0439, \u0417\u0435\u043b\u0435\u043d\u044b\u0439, \u0421\u0438\u043d\u0438\u0439).<\/p>\n<\/li>\n<li>\n<p><code>img_dir<\/code>,\u00a0<code>sound_dir<\/code>: \u042d\u0442\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043f\u0443\u0442\u0438 \u043a \u043f\u0430\u043f\u043a\u0430\u043c \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u0437\u0432\u0443\u043a\u0430\u043c\u0438, \u0447\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u0432 \u043a\u043e\u0434\u0435.\u00a0<code>path.join<\/code>\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0443\u0442\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0433\u0440\u044b: \u0421\u043f\u0440\u0430\u0439\u0442\u044b \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0438\u043c\u0438. \u0412 Pygame \u0432\u0441\u0435, \u0447\u0442\u043e \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 (\u0438\u0433\u0440\u043e\u043a, \u0432\u0440\u0430\u0433\u0438, \u043f\u0443\u043b\u0438), \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0441\u043f\u0440\u0430\u0439\u0442\u0430\u043c\u0438.<\/p>\n<ul>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441\u00a0<\/strong><code><strong><s>Entity<\/s><\/strong><\/code><strong>.<\/strong>\u00a0\u041e\u0431\u0449\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445\u00a0<code>Player<\/code>\u00a0\u0438\u00a0<code>Mob<\/code>. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u044d\u0442\u043e \u043e\u0431\u0449\u0438\u0439 \u201c\u0441\u043a\u0435\u043b\u0435\u0442\u201d \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e.<\/p>\n<ul>\n<li>\n<p><strong>\u0427\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0421\u043f\u0440\u0430\u0439\u0442 \u2013 \u044d\u0442\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u043f\u043e \u044d\u043a\u0440\u0430\u043d\u0443.<\/p>\n<\/li>\n<li>\n<p><code>pygame.sprite.Sprite<\/code>\u00a0\u2013 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 \u0432 Pygame.<\/p>\n<\/li>\n<li>\n<p><code>image<\/code>: \u0410\u0442\u0440\u0438\u0431\u0443\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u043f\u0440\u0430\u0439\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><code>rect<\/code>: \u0410\u0442\u0440\u0438\u0431\u0443\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0438\u0439 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043f\u0440\u0430\u0439\u0442\u0430 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><code>x<\/code>,\u00a0<code>y<\/code>: \u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043b\u0435\u0432\u043e\u0433\u043e \u0443\u0433\u043b\u0430 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u00a0<code>rect<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>speed<\/code>: \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441\u00a0<\/strong><code><strong>Player<\/strong><\/code><strong>\u00a0(\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u043a\u0430).<\/strong>\u00a0\u041a\u043b\u0430\u0441\u0441\u00a0<code>Player<\/code>\u00a0(\u0432\u00a0<a href=\"http:\/\/objects.py\" rel=\"noopener noreferrer nofollow\"><code>objects.py<\/code><\/a>) \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 (\u0438\u043b\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442) \u043e\u0431\u0449\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0443\u044e \u0434\u043b\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u043b\u043e\u0433\u0438\u043a\u0443:<\/p>\n<pre><code class=\"python\"># objects.py import pygame from config import *  # \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u0437 config.py  class Player(pygame.sprite.Sprite):  # \u041d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0441\u044f \u043e\u0442 pygame.sprite.Sprite     def __init__(self, all_sprites, bullets):         pygame.sprite.Sprite.__init__(self)         player_img = pygame.image.load(path.join(img_dir, \"player.png\")).convert_alpha()         self.image = pygame.transform.scale(player_img, (50, 50))  # \u041c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435         self.image.set_colorkey(BLACK)  # \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0444\u043e\u043d (\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u043c)         self.rect = self.image.get_rect()  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441\u043f\u0440\u0430\u0439\u0442\u0430         self.rect.centerx = WIDTH \/ 2  # \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u043e x (\u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443)         self.rect.bottom = HEIGHT - 10  # \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u043e y (\u0432\u043d\u0438\u0437\u0443)         self.speedx = 0  # \u0413\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c (\u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e 0)         self.all_sprites = all_sprites         self.bullets = bullets      def update(self):  # \u041c\u0435\u0442\u043e\u0434, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u0434\u0440         self.speedx = 0  # \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c         keystate = pygame.key.get_pressed()  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043a\u043b\u0430\u0432\u0438\u0448         if keystate[pygame.K_LEFT]:             self.speedx = -8  # \u0414\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0432\u043b\u0435\u0432\u043e, \u0435\u0441\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u0432\u043b\u0435\u0432\u043e         if keystate[pygame.K_RIGHT]:             self.speedx = 8  # \u0414\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0432\u043f\u0440\u0430\u0432\u043e         self.rect.x += self.speedx  # \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044e         if self.rect.right &gt; WIDTH:  # \u041d\u0435 \u0434\u0430\u0435\u043c \u0432\u044b\u043b\u0435\u0437\u0442\u0438 \u0437\u0430 \u043f\u0440\u0430\u0432\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443             self.rect.right = WIDTH         if self.rect.left &lt; 0:  # \u041d\u0435 \u0434\u0430\u0435\u043c \u0432\u044b\u043b\u0435\u0437\u0442\u0438 \u0437\u0430 \u043b\u0435\u0432\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443             self.rect.left = 0      def shoot(self):  # \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430         bullet = Bullet(self.rect.centerx, self.rect.top)  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0443\u043b\u044e         self.all_sprites.add(bullet)  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0443\u043b\u044e \u0432 \u043e\u0431\u0449\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443         self.bullets.add(bullet)  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0443\u043b\u044e \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u043f\u0443\u043b\u044c         laser_sound.play()  # \u041f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u043c \u0437\u0432\u0443\u043a \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434?<\/strong><\/p>\n<ul>\n<li>\n<p><code><strong>init<\/strong>()<\/code>: \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u0430. \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u043a\u0430, \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e, \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u0444\u043e\u043d (\u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u043c), \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p><code>update()<\/code>: \u041c\u0435\u0442\u043e\u0434, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u0434\u0440 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430:<\/p>\n<ul>\n<li>\n<p>\u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c (\u0447\u0442\u043e\u0431\u044b \u0438\u0433\u0440\u043e\u043a \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u043d\u0435 \u043d\u0430\u0436\u0430\u0442\u044b).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u0436\u0430\u0442\u044b\u0445 \u043a\u043b\u0430\u0432\u0438\u0448 (\u0432\u043b\u0435\u0432\u043e\/\u0432\u043f\u0440\u0430\u0432\u043e).<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u043a\u0430 \u043f\u043e \u043a\u0440\u0430\u044f\u043c \u044d\u043a\u0440\u0430\u043d\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><code>shoot()<\/code>: \u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u0443\u043b\u044e \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0435 \u0432 \u0433\u0440\u0443\u043f\u043f\u044b \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 Pygame (\u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b).<\/strong>\u00a0\u0422\u0435\u043f\u0435\u0440\u044c, \u0432\u00a0<a href=\"http:\/\/main.py\" rel=\"noopener noreferrer nofollow\"><code>main.py<\/code><\/a>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<pre><code class=\"python\"># main.py import pygame from config import * from objects import *  # --- \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f --- pygame.init() pygame.mixer.init()  # \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0432\u0443\u043a\u0430 screen = pygame.display.set_mode((WIDTH, HEIGHT))  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u043a\u043d\u043e \u0438\u0433\u0440\u044b pygame.display.set_caption(\"Space Shooter\")  # \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043e\u043a\u043d\u0430 clock = pygame.time.Clock()  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f FPS  # --- \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 --- background = pygame.image.load(path.join(img_dir, \"starfield.png\")).convert_alpha() background_rect = background.get_rect()  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0444\u043e\u043d\u0430  # --- \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0433\u0440\u0443\u043f\u043f \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 --- all_sprites = pygame.sprite.Group()  # \u0413\u0440\u0443\u043f\u043f\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 mobs = pygame.sprite.Group()  # \u0413\u0440\u0443\u043f\u043f\u0430 \u0434\u043b\u044f \u0432\u0440\u0430\u0433\u043e\u0432 bullets = pygame.sprite.Group()  # \u0413\u0440\u0443\u043f\u043f\u0430 \u0434\u043b\u044f \u043f\u0443\u043b\u044c boss_lasers = pygame.sprite.Group()  # \u0413\u0440\u0443\u043f\u043f\u0430 \u043b\u0430\u0437\u0435\u0440\u043e\u0432 \u0431\u043e\u0441\u0441\u0430  # --- \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 --- player = Player(all_sprites, bullets)  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u0433\u0440\u043e\u043a\u0430 all_sprites.add(player)  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u043e\u0431\u0449\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443  # --- \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u0443\u0437\u044b\u043a\u0438 \u0438 \u0437\u0432\u0443\u043a\u043e\u0432 --- pygame.mixer.music.load(path.join(sound_dir, 'Star_Wars_-_Rogue_One_-_OST_Izgojj-Odin_Zvjozdnye_Vojjny_65069199.mp3'))  # \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u0443\u0437\u044b\u043a\u0443 pygame.mixer.music.play(-1)  # \u041f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u043c \u043c\u0443\u0437\u044b\u043a\u0443 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e laser_sound = pygame.mixer.Sound(path.join(sound_dir, 'blaster.mp3'))  # \u0417\u0432\u0443\u043a \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430  # --- \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u044b --- game_over = True  # \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0438\u0433\u0440\u0430 \u043d\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430  # --- \u0421\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 \u044d\u043a\u0440\u0430\u043d (\u043f\u043e\u043a\u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c) --- # start_screen() # \u041f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0437\u0436\u0435  # --- \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b --- def start_screen():     # ... (\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430, \u043a\u0430\u043a \u0432 \u043a\u043e\u0434\u0435) ...     pass  # \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u0438\u0433\u0440\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0430\u0441\u044c  def reset_game(self):     # ... (\u0441\u0431\u0440\u043e\u0441 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u0433\u0440\u044b, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432) ...     pass  # \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430  def run():  # \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430     nonlocal game_over     while True:         if game_over:             if not start_screen():  # \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 \u044d\u043a\u0440\u0430\u043d, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c False \u043f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435                 return              continue          # --- \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 FPS ---         clock.tick(FPS)          # --- \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 (\u0432\u0432\u043e\u0434, \u0432\u044b\u0445\u043e\u0434) ---         for event in pygame.event.get():             if event.type == pygame.QUIT:  # \u0415\u0441\u043b\u0438 \u043d\u0430\u0436\u0430\u043b\u0438 \u043d\u0430 \u043a\u0440\u0435\u0441\u0442\u0438\u043a                 pygame.quit()  # \u0412\u044b\u0445\u043e\u0434 \u0438\u0437 Pygame                 return  # \u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e run()             elif event.type == pygame.KEYDOWN:  # \u041d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430                 if event.key == pygame.K_SPACE:  # \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0431\u0435\u043b                     player.shoot()                 elif event.key == pygame.K_ESCAPE:                     pygame.quit()                     return  # \u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0438\u0433\u0440\u0443          # --- \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 ---         all_sprites.update()  # \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c update() \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432          # --- \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 ---         screen.fill(BLACK)  # \u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u044d\u043a\u0440\u0430\u043d \u0447\u0435\u0440\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c         screen.blit(background, background_rect)  # \u0420\u0438\u0441\u0443\u0435\u043c \u0444\u043e\u043d         all_sprites.draw(screen)  # \u0420\u0438\u0441\u0443\u0435\u043c \u0432\u0441\u0435 \u0441\u043f\u0440\u0430\u0439\u0442\u044b          # --- \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u044d\u043a\u0440\u0430\u043d\u0430 ---         pygame.display.flip()  # \u041f\u0435\u0440\u0435\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0431\u0443\u0444\u0435\u0440 \u044d\u043a\u0440\u0430\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f  def main():     run()  if __name__ == \"__main__\":     main()<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434?<\/strong><\/p>\n<ul>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 Pygame.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u043a\u043d\u043e \u0438\u0433\u0440\u044b \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f FPS (<code>clock<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0444\u043e\u043d\u043e\u0432\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u044b \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>all_sprites<\/code>: \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 (\u0438\u0433\u0440\u043e\u043a, \u0432\u0440\u0430\u0433\u0438, \u043f\u0443\u043b\u0438).<\/p>\n<\/li>\n<li>\n<p><code>mobs<\/code>: \u0414\u043b\u044f \u0432\u0440\u0430\u0433\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><code>bullets<\/code>: \u0414\u043b\u044f \u043f\u0443\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p><code>boss_lasers<\/code>: \u0414\u043b\u044f \u043b\u0430\u0437\u0435\u0440\u043e\u0432 \u0431\u043e\u0441\u0441\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043c\u0443\u0437\u044b\u043a\u0443 \u0438 \u0437\u0432\u0443\u043a \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0445\u043e\u0434\u0438\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b\u00a0<code>run()<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412 \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u0446\u0438\u043a\u043b\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><code>clock.tick(FPS)<\/code>: \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u043a\u0430\u0434\u0440\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><code>pygame.event.get()<\/code>: \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f (\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448, \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043e\u043a\u043d\u0430).<\/p>\n<\/li>\n<li>\n<p><code>for event in ...<\/code>: \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<ul>\n<li>\n<p><code>pygame.QUIT<\/code>: \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043e\u043a\u043d\u043e, \u0438\u0433\u0440\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p><code>pygame.KEYDOWN<\/code>: \u0415\u0441\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430:<\/p>\n<ul>\n<li>\n<p><code>K_SPACE<\/code>: \u0418\u0433\u0440\u043e\u043a \u0441\u0442\u0440\u0435\u043b\u044f\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p><code>K_ESCAPE<\/code>: \u0418\u0433\u0440\u043e\u043a \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u0438\u0433\u0440\u044b.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><code>all_sprites.update()<\/code>: \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u00a0<code>update()<\/code>\u00a0\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043f\u0440\u0430\u0439\u0442\u0430 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435. \u042d\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u043a\u0430, \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043f\u0443\u043b\u044c).<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430:<\/p>\n<ul>\n<li>\n<p><code>screen.fill(BLACK)<\/code>: \u0417\u0430\u043b\u0438\u0432\u0430\u0435\u0442 \u044d\u043a\u0440\u0430\u043d \u0447\u0435\u0440\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><code>screen.blit(background, background_rect)<\/code>: \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0444\u043e\u043d.<\/p>\n<\/li>\n<li>\n<p><code>all_sprites.draw(screen)<\/code>: \u041e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u043f\u0440\u0430\u0439\u0442\u044b \u0432 \u0433\u0440\u0443\u043f\u043f\u0435\u00a0<code>all_sprites<\/code>. Pygame \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u00a0<code>image<\/code>\u00a0\u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 \u0438 \u0438\u0445\u00a0<code>rect<\/code>\u00a0\u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><code>pygame.display.flip()<\/code>: \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 (\u043f\u0435\u0440\u0435\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442) \u044d\u043a\u0440\u0430\u043d, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u0412\u0440\u0430\u0433\u0438 \u0438 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438<\/h4>\n<p>\u0422\u0435\u043f\u0435<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-462806","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/462806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=462806"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/462806\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=462806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=462806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=462806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}