{"id":4485,"date":"2019-12-25T10:22:05","date_gmt":"2019-12-25T09:22:05","guid":{"rendered":"https:\/\/pythonprogramming.altervista.org\/?p=4485"},"modified":"2019-12-26T08:12:08","modified_gmt":"2019-12-26T07:12:08","slug":"python-platform-game-2","status":"publish","type":"post","link":"https:\/\/pythonprogramming.altervista.org\/python-platform-game-2\/","title":{"rendered":"Python Platform Game 2"},"content":{"rendered":"<p>Python and Pygame to make a platform game, second part&#8230; collitions, physics, maps.<\/p>\n<p>In the second part of this <strong>tutorial<\/strong> to make a platform based on the <strong>dafluffypotato<\/strong> work, we will do this:<\/p>\n<div style=\"width: 600px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-4485-1\" width=\"600\" height=\"400\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/12\/output3_xp.mp4?_=1\" \/><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/12\/output3_xp.mp4\">https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/12\/output3_xp.mp4<\/a><\/video><\/div>\n<h2>The video explanation<\/h2>\n<p><iframe loading=\"lazy\" width=\"727\" height=\"409\" src=\"https:\/\/www.youtube.com\/embed\/I-D5Z8iB3do\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>&nbsp;<\/p>\n<h2>The initializing and the variables for movements<\/h2>\n<pre class=\"lang:default decode:true\">pygame.init()\r\n\r\nclock = pygame.time.Clock()\r\n\r\npygame.display.set_caption('Game')\r\n\r\nWINDOW_SIZE = (600, 400)\r\n# This will be the Surface where we will blit everything\r\ndisplay = pygame.Surface((300, 200))\r\n# Then we will scale (every frame) the display onto the screen\r\nscreen = pygame.display.set_mode(WINDOW_SIZE, 0, 32)\r\n\r\nmoving_right = False\r\nmoving_left = False\r\n# For the pygame.transform.flip(player_img, 1, 0)\r\nstay_right = True\r\nmomentum = 0\r\nair_timer = 0<\/pre>\n<h2>The variables holding the map and its tiles<\/h2>\n<pre class=\"lang:default decode:true \">game_map1 = \"\"\"\r\n&lt;----&gt;xxxx&lt;----xxxx\r\nox&lt;----ooo-------oo\r\no------ooo--------o\r\no---&gt;xxoo-----xxxxo\r\no------ooxxx&lt;-----o\r\noxx&lt;---oo-------xxo\r\no------oo---------o\r\no---&gt;xxooxxxxxxx&lt;-o\r\no------oo---------o\r\noxxxxxxoo-xxxxxxxxo\r\nooooooooo----------\r\nooooooooooooooooooo\r\n\"\"\".splitlines()\r\n\r\ngame_map = [list(lst) for lst in game_map1]\r\n\r\ntl = {}\r\ntl[\"o\"] = dirt_img = pygame.image.load('dirt.png')\r\ntl[\"x\"] = grass_img = pygame.image.load('grass.png')\r\ntl[\"&lt;\"] = grassr = pygame.image.load('grassr.png')\r\ntl[\"&gt;\"] = grassr = pygame.image.load('grassl.png')<\/pre>\n<h2>The player image converted to transparent and its rect object<\/h2>\n<pre class=\"lang:default decode:true \">player_img = pygame.image.load('player.png').convert()\r\nplayer_img.set_colorkey((255, 255, 255))\r\nplayer_rect = pygame.Rect(100, 100, 5, 13)<\/pre>\n<h2>This returns a list of the tiles colliding with the player<\/h2>\n<pre class=\"lang:default decode:true \">def collision_test(rect, tiles):\r\n    \"Returns the Rect of the tile with which the player collides\"\r\n    hit_list = []\r\n    for tile in tiles:\r\n        if rect.colliderect(tile):\r\n            hit_list.append(tile)\r\n    return hit_list<\/pre>\n<h2>This returns the player rect and where the collision is (up, left&#8230;)<\/h2>\n<pre class=\"lang:default decode:true \">def move(rect, movement, tiles):\r\n    collision_types = {\r\n        'top': False, 'bottom': False, 'right': False, 'left': False}\r\n    rect.x += movement[0]\r\n    hit_list = collision_test(rect, tiles)\r\n    for tile in hit_list:\r\n        if movement[0] &gt; 0:\r\n            rect.right = tile.left\r\n            collision_types['right'] = True\r\n        elif movement[0] &lt; 0:\r\n            rect.left = tile.right\r\n            collision_types['left'] = True\r\n    rect.y += movement[1]\r\n    hit_list = collision_test(rect, tiles)\r\n    for tile in hit_list:\r\n        if movement[1] &gt; 0:\r\n            rect.bottom = tile.top\r\n            collision_types['bottom'] = True\r\n        elif movement[1] &lt; 0:\r\n            rect.top = tile.bottom\r\n            collision_types['top'] = True\r\n    return rect, collision_types<\/pre>\n<h2>The while loop that draw the map of tiles<\/h2>\n<pre class=\"lang:default decode:true \">loop = 1\r\nwhile loop:\r\n    # CLEAR THE SCREEN\r\n    display.fill((146, 244, 255))\r\n\r\n    # Tiles are blitted  ==========================\r\n    tile_rects = []\r\n    y = 0\r\n    for line_of_symbols in game_map:\r\n        x = 0\r\n        for symbol in line_of_symbols:\r\n            if symbol in tl:\r\n                # draw the symbol for image\r\n                display.blit(\r\n                    tl[symbol], (x * 16, y * 16))\r\n            # draw a rectangle for every symbol except for the empty one\r\n            if symbol != \"-\":\r\n                tile_rects.append(pygame.Rect(x * 16, y * 16, 16, 16))\r\n            x += 1\r\n        y += 1\r\n    # ================================================<\/pre>\n<h2>The movement detection to draw the player (in the while loop)<\/h2>\n<pre class=\"lang:default decode:true \">    # MOVEMENT OF THE PLAYER\r\n    player_movement = [0, 0]\r\n    if moving_right:\r\n        player_movement[0] += 2\r\n    if moving_left:\r\n        player_movement[0] -= 2\r\n    player_movement[1] += momentum\r\n    momentum += 0.3\r\n    if momentum &gt; 3:\r\n        momentum = 3\r\n\r\n    player_rect, collisions = move(player_rect, player_movement, tile_rects)\r\n\r\n    if collisions['bottom']:\r\n        air_timer = 0\r\n        momentum = 0\r\n    else:\r\n        air_timer += 1\r\n\r\n    # Flip the player image when goes to the left\r\n    if stay_right:\r\n        display.blit(\r\n            player_img, (player_rect.x, player_rect.y))\r\n    else:\r\n        display.blit(\r\n            pygame.transform.flip(player_img, 1, 0),\r\n            (player_rect.x, player_rect.y))<\/pre>\n<h2>The key command to move the player<\/h2>\n<pre class=\"lang:default decode:true \">    for event in pygame.event.get():\r\n        if event.type == QUIT:\r\n            loop = 0\r\n        if event.type == KEYDOWN:\r\n            if event.key == K_RIGHT:\r\n                moving_right = True\r\n                stay_right = True\r\n            if event.key == K_LEFT:\r\n                moving_left = True\r\n                stay_right = False\r\n            if event.key == K_SPACE:\r\n                if air_timer &lt; 6:\r\n                    momentum = -5\r\n        if event.type == KEYUP:\r\n            if event.key == K_RIGHT:\r\n                moving_right = False\r\n            if event.key == K_LEFT:\r\n                moving_left = False<\/pre>\n<h2>Scaling the display on the screen (and quitting)<\/h2>\n<pre class=\"lang:default decode:true \">    screen.blit(pygame.transform.scale(display, (600, 400)), (0, 0))\r\n    pygame.display.update()\r\n    clock.tick(60)\r\n\r\npygame.quit()<\/pre>\n<p>and now &#8230;<\/p>\n<h2>The whole code<\/h2>\n<pre class=\"lang:default decode:true \">import pygame\r\nimport sys\r\nfrom pygame.locals import *\r\n\r\n\r\npygame.init()\r\n\r\nclock = pygame.time.Clock()\r\n\r\npygame.display.set_caption('Game')\r\n\r\nWINDOW_SIZE = (600, 400)\r\n# This will be the Surface where we will blit everything\r\ndisplay = pygame.Surface((300, 200))\r\n# Then we will scale (every frame) the display onto the screen\r\nscreen = pygame.display.set_mode(WINDOW_SIZE, 0, 32)\r\n\r\nmoving_right = False\r\nmoving_left = False\r\n# For the pygame.transform.flip(player_img, 1, 0)\r\nstay_right = True\r\nmomentum = 0\r\nair_timer = 0\r\n\r\ngame_map1 = \"\"\"\r\n&lt;----&gt;xxxx&lt;----xxxx\r\nox&lt;----ooo-------oo\r\no------ooo--------o\r\no---&gt;xxoo-----xxxxo\r\no------ooxxx&lt;-----o\r\noxx&lt;---oo-------xxo\r\no------oo---------o\r\no---&gt;xxooxxxxxxx&lt;-o\r\no------oo---------o\r\noxxxxxxoo-xxxxxxxxo\r\nooooooooo----------\r\nooooooooooooooooooo\r\n\"\"\".splitlines()\r\n\r\ngame_map = [list(lst) for lst in game_map1]\r\n\r\ntl = {}\r\ntl[\"o\"] = dirt_img = pygame.image.load('dirt.png')\r\ntl[\"x\"] = grass_img = pygame.image.load('grass.png')\r\ntl[\"&lt;\"] = grassr = pygame.image.load('grassr.png')\r\ntl[\"&gt;\"] = grassr = pygame.image.load('grassl.png')\r\n\r\nplayer_img = pygame.image.load('player.png').convert()\r\nplayer_img.set_colorkey((255, 255, 255))\r\nplayer_rect = pygame.Rect(100, 100, 5, 13)\r\n\r\n\r\ndef collision_test(rect, tiles):\r\n    \"Returns the Rect of the tile with which the player collides\"\r\n    hit_list = []\r\n    for tile in tiles:\r\n        if rect.colliderect(tile):\r\n            hit_list.append(tile)\r\n    return hit_list\r\n\r\n\r\ndef move(rect, movement, tiles):\r\n    collision_types = {\r\n        'top': False, 'bottom': False, 'right': False, 'left': False}\r\n    rect.x += movement[0]\r\n    hit_list = collision_test(rect, tiles)\r\n    for tile in hit_list:\r\n        if movement[0] &gt; 0:\r\n            rect.right = tile.left\r\n            collision_types['right'] = True\r\n        elif movement[0] &lt; 0:\r\n            rect.left = tile.right\r\n            collision_types['left'] = True\r\n    rect.y += movement[1]\r\n    hit_list = collision_test(rect, tiles)\r\n    for tile in hit_list:\r\n        if movement[1] &gt; 0:\r\n            rect.bottom = tile.top\r\n            collision_types['bottom'] = True\r\n        elif movement[1] &lt; 0:\r\n            rect.top = tile.bottom\r\n            collision_types['top'] = True\r\n    return rect, collision_types\r\n\r\n\r\nloop = 1\r\nwhile loop:\r\n    # CLEAR THE SCREEN\r\n    display.fill((146, 244, 255))\r\n\r\n    # Tiles are blitted  ==========================\r\n    tile_rects = []\r\n    y = 0\r\n    for line_of_symbols in game_map:\r\n        x = 0\r\n        for symbol in line_of_symbols:\r\n            if symbol in tl:\r\n                # draw the symbol for image\r\n                display.blit(\r\n                    tl[symbol], (x * 16, y * 16))\r\n            # draw a rectangle for every symbol except for the empty one\r\n            if symbol != \"-\":\r\n                tile_rects.append(pygame.Rect(x * 16, y * 16, 16, 16))\r\n            x += 1\r\n        y += 1\r\n    # ================================================\r\n\r\n    # MOVEMENT OF THE PLAYER\r\n    player_movement = [0, 0]\r\n    if moving_right:\r\n        player_movement[0] += 2\r\n    if moving_left:\r\n        player_movement[0] -= 2\r\n    player_movement[1] += momentum\r\n    momentum += 0.3\r\n    if momentum &gt; 3:\r\n        momentum = 3\r\n\r\n    player_rect, collisions = move(player_rect, player_movement, tile_rects)\r\n\r\n    if collisions['bottom']:\r\n        air_timer = 0\r\n        momentum = 0\r\n    else:\r\n        air_timer += 1\r\n\r\n    # Flip the player image when goes to the left\r\n    if stay_right:\r\n        display.blit(\r\n            player_img, (player_rect.x, player_rect.y))\r\n    else:\r\n        display.blit(\r\n            pygame.transform.flip(player_img, 1, 0),\r\n            (player_rect.x, player_rect.y))\r\n\r\n    for event in pygame.event.get():\r\n        if event.type == QUIT:\r\n            loop = 0\r\n        if event.type == KEYDOWN:\r\n            if event.key == K_RIGHT:\r\n                moving_right = True\r\n                stay_right = True\r\n            if event.key == K_LEFT:\r\n                moving_left = True\r\n                stay_right = False\r\n            if event.key == K_SPACE:\r\n                if air_timer &lt; 6:\r\n                    momentum = -5\r\n        if event.type == KEYUP:\r\n            if event.key == K_RIGHT:\r\n                moving_right = False\r\n            if event.key == K_LEFT:\r\n                moving_left = False\r\n\r\n    screen.blit(pygame.transform.scale(display, (600, 400)), (0, 0))\r\n    pygame.display.update()\r\n    clock.tick(60)\r\n\r\npygame.quit()\r\n<\/pre>\n<h3>Pygame's Platform Game<\/h3>\r\n\r\n<a href=\"https:\/\/pythonprogramming.altervista.org\/pygame-platform-game-5-sounds-and-mixer\/\"><img decoding=\"async\" src=\"https:\/\/i1.wp.com\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/climbercover.png?w=557&ssl=1\"\/ width=\"50%\"><\/a>\r\n<script>\r\nvar title = \"Platform Pygame\";\r\n\t\tvar links = [\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-animation-of-a-sprite-v-1-3\/\",\"Animation 1.3\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-sprite-animation-v-2-better-coding-test-it-checking-fps-on-the-screen\/\",\"Animation 1.2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-how-to-display-the-frame-rate-fps-on-the-screen\/\",\"Display Frame rate\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-sprite-animation-update\/\",\"Animation 1.1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platformer-1\/\",\"Pygame Platform Game 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/python-platform-game-2\/\",\"Pygame Platform 2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platform-game-3-recap-cheatsheet\/\",\"Pygame PLatform 3 - recap and some Cheat Sheet\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platform-game-4-background-and-stuffs\/\",\"Pygame Platform 4 - Background & organizing code\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platform-game-5-sounds-and-mixer\/\",\"Pygame Platform 5 - Sounds\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/platform-game-in-detail-part-1\/\",\"Game in detail part 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/map-maker-1-2\/\", \"Map maker 1.2\"]\r\n\t\t];\r\n\t\t<\/script>\r\n<script>\r\n\t\r\nif (typeof next2 != \"undefined\"){let next2 = 0;}\r\n\t\r\nnext2 = 0;\r\n\thtml = \"\";\/\/<b style='color:coral;font-size:1.2em'>Other posts about \" + title + \"<\/b><br>\";\r\nfor (address of links) \r\n{\r\n\r\n\tif (next2 == 1){\r\n\t\thtml += \"<div style='background:coral'>\";\r\n\t\thtml += \"Next link => <a href='\" + address[0] + \"'>\" + address[1] + \"<\/a>\";\r\n\t\thtml += \"<\/div><br>\";\r\n\t\tnext2 = 0;\r\n\t}\r\n\tif (address[0] == document.URL) {\r\n\t\tnext2 = 1;\r\n\t}\r\n}\r\n\r\nif (typeof next != \"undefined\") {let next = 0;}\r\nif (typeof addressStart != \"undefined\") {let addressStart = \"\";}\r\nnext = 0;\r\naddressStart = \"<a href='\";\r\nfor (address of links) {\r\n\tif (next == 1){\r\n\t\thtml += \">>>\" + addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t\tnext = 0;\r\n\t}\r\n\telse if (addressStart + address[0] != document.URL)\r\n\t{\r\n\t\thtml += addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\tnext = 1;\r\n\t\tnext_address = address[0]\r\n\t\tnext_title = address[1]\r\n\t\thtml += \"<span style='color:gray'>\" + address[1] + \"<\/span><br>\";\r\n\t}\r\n\r\n}\r\n\r\n\thtml += `<span style=\"font-size:8px\">Powered by <a href=\"https:\/\/pythonprogramming.altervista.org\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2673\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png\" alt=\"\" width=\"70\" height=\"25\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png 156w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2-150x56.png 150w\" sizes=\"auto, (max-width: 70px) 100vw, 70px\" \/>pythonprogramming.altervista.org<\/a><\/span>`\r\n\thtml = \"<div style='background:yellow'>\" + html + \"<\/div>\";\r\n\tdocument.write(html)\r\n<\/script>\r\n\r\n<h3>Other Pygame's posts<\/h3>\r\n\r\n<script>\r\nvar title = \"Pygame's Posts\"\r\nvar links = [\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platformer-1\/\",\"Platform game 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/make-a-platform-game-with-pygame-dafluffypotato\/\",\"DaFluffyPotato Platform Tutorials\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/python-and-classic-arcade-games-pong\/\",\"Pong Game Full\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/python-draws-in-colors-app-to-draw-with-pygame\/\",\"PyGameGIF 2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-draw-app-with-animation\/\",\"PyGameGIF 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pydraw-2-0-app-to-draw-gif\/\",\"PyDraw 2.0\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-drawing-2\/\",\"Draw with Pygame\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/animation-with-pygame\",\"Sprite animation 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/animation-on-pygame-2-free-characters-and-more-actions\/\",\"Sprite animation 2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/starting-with-pygame\/\",\"Starting movements with Pygame\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-3-move-sprite\/\", \"Move a Sprite\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-4-fonts\/\",\"Text and Fonts\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-animate-a-sprite\/\", \"Animate a sprite\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-and-mouse-events\/\",\"Mouse events\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pgp-aka-pygamepresentation-project\/\",\"Pygame presentation\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/moving-the-player-in-pygame-with-key-get_pressed\/\",\"How to use key.get_pressed()\"]\r\n]\r\n<\/script>\r\n\r\n\r\n<script>\r\n\t\r\nif (typeof next2 != \"undefined\"){let next2 = 0;}\r\n\t\r\nnext2 = 0;\r\n\thtml = \"\";\/\/<b style='color:coral;font-size:1.2em'>Other posts about \" + title + \"<\/b><br>\";\r\nfor (address of links) \r\n{\r\n\r\n\tif (next2 == 1){\r\n\t\thtml += \"<div style='background:coral'>\";\r\n\t\thtml += \"Next link => <a href='\" + address[0] + \"'>\" + address[1] + \"<\/a>\";\r\n\t\thtml += \"<\/div><br>\";\r\n\t\tnext2 = 0;\r\n\t}\r\n\tif (address[0] == document.URL) {\r\n\t\tnext2 = 1;\r\n\t}\r\n}\r\n\r\nif (typeof next != \"undefined\") {let next = 0;}\r\nif (typeof addressStart != \"undefined\") {let addressStart = \"\";}\r\nnext = 0;\r\naddressStart = \"<a href='\";\r\nfor (address of links) {\r\n\tif (next == 1){\r\n\t\thtml += \">>>\" + addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t\tnext = 0;\r\n\t}\r\n\telse if (addressStart + address[0] != document.URL)\r\n\t{\r\n\t\thtml += addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\tnext = 1;\r\n\t\tnext_address = address[0]\r\n\t\tnext_title = address[1]\r\n\t\thtml += \"<span style='color:gray'>\" + address[1] + \"<\/span><br>\";\r\n\t}\r\n\r\n}\r\n\r\n\thtml += `<span style=\"font-size:8px\">Powered by <a href=\"https:\/\/pythonprogramming.altervista.org\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2673\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png\" alt=\"\" width=\"70\" height=\"25\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png 156w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2-150x56.png 150w\" sizes=\"auto, (max-width: 70px) 100vw, 70px\" \/>pythonprogramming.altervista.org<\/a><\/span>`\r\n\thtml = \"<div style='background:yellow'>\" + html + \"<\/div>\";\r\n\tdocument.write(html)\r\n<\/script>\n","protected":false},"excerpt":{"rendered":"A new study on a Platform game with Pytgame (following dafluffypotato).\n<a class=\"moretag\" href=\"https:\/\/pythonprogramming.altervista.org\/python-platform-game-2\/\"> [...]<\/a>","protected":false},"author":1,"featured_media":4491,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1,154,191],"tags":[655,137,652,194,4],"class_list":["post-4485","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-examples","category-games","category-pygame","tag-dafluffypotato","tag-game","tag-platform-game","tag-pygame","tag-python"],"avopt_banners_inside_post":true,"avopt_banners_on_page":true,"av_copy_from":"","av_sharing_message":"","av_sharing_allowed":true,"av_sharing_on":{"fb":[],"tw":[]},"av_allow_affiliate_banner":false,"av_allow_affiliate_multi_banner":false,"av_show_affiliation_buy_button":false,"av_post_rating":true,"av_have_post_rating_value":false,"av_is_artificial_intelligence_content":false,"_links":{"self":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/4485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/comments?post=4485"}],"version-history":[{"count":9,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/4485\/revisions"}],"predecessor-version":[{"id":4504,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/4485\/revisions\/4504"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media\/4491"}],"wp:attachment":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media?parent=4485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/categories?post=4485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/tags?post=4485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}