{"id":4737,"date":"2020-01-06T16:13:59","date_gmt":"2020-01-06T15:13:59","guid":{"rendered":"https:\/\/pythonprogramming.altervista.org\/?p=4737"},"modified":"2020-01-07T21:19:04","modified_gmt":"2020-01-07T20:19:04","slug":"map-maker-1-2","status":"publish","type":"post","link":"https:\/\/pythonprogramming.altervista.org\/map-maker-1-2\/","title":{"rendered":"Map Maker 1.2"},"content":{"rendered":"<p>In this version of the pygame app to create maps for a platform game, we can see the player in action into the map, while we build it like you can see in this video:<\/p>\n<p><iframe loading=\"lazy\" title=\"Pygame platform map maker 1.2\" width=\"747\" height=\"420\" src=\"https:\/\/www.youtube.com\/embed\/doaohAlKP6Y?feature=oembed&amp;enablejsapi=1\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h2>Code of Climber map maker 1.2<\/h2>\n<p>These images go in the folder imgs<\/p>\n<p><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/brick2_16-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4743\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/brick2_16-1.png\" alt=\"\" width=\"16\" height=\"16\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/brick16-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4744\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/brick16-1.png\" alt=\"\" width=\"16\" height=\"16\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/health-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4745\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/health-1.png\" alt=\"\" width=\"16\" height=\"16\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/player-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4746\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/player-1.png\" alt=\"\" width=\"5\" height=\"13\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/player_climb-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4747\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/player_climb-1.png\" alt=\"\" width=\"4\" height=\"13\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/player_climbl-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4748\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/player_climbl-1.png\" alt=\"\" width=\"4\" height=\"13\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/player_jump.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4749\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/player_jump.png\" alt=\"\" width=\"5\" height=\"11\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/player_stand-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4750\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/player_stand-1.png\" alt=\"\" width=\"5\" height=\"13\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/space-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4751\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/space-1.png\" alt=\"\" width=\"16\" height=\"16\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/wall-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4752\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/wall-2.png\" alt=\"\" width=\"16\" height=\"16\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/wall2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4753\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/wall2.png\" alt=\"\" width=\"16\" height=\"16\" \/><\/a><\/p>\n<p>Thes are the audio files that go in data\\audio\\<\/p>\n<p>This music was made by me.<\/p>\n<p><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/dawn.mp3\">dawn.wav<\/a><\/p>\n<audio class=\"wp-audio-shortcode\" id=\"audio-4737-1\" preload=\"none\" style=\"width: 100%;\" controls=\"controls\"><source type=\"audio\/mpeg\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/dawn.mp3?_=1\" \/><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/dawn.mp3\">https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/dawn.mp3<\/a><\/audio>\n<p><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/grass_0.wav\">grass_0.wav<\/a><\/p>\n<audio class=\"wp-audio-shortcode\" id=\"audio-4737-2\" preload=\"none\" style=\"width: 100%;\" controls=\"controls\"><source type=\"audio\/wav\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/grass_0.wav?_=2\" \/><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/grass_0.wav\">https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/grass_0.wav<\/a><\/audio>\n<p><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/jump.wav\">jump.wav<\/a><\/p>\n<audio class=\"wp-audio-shortcode\" id=\"audio-4737-3\" preload=\"none\" style=\"width: 100%;\" controls=\"controls\"><source type=\"audio\/wav\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/jump.wav?_=3\" \/><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/jump.wav\">https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/jump.wav<\/a><\/audio>\n<pre class=\"lang:default decode:true \">from pygame.locals import *\r\nimport pygame\r\nfrom time import sleep\r\nfrom tkinter import messagebox\r\nfrom tkinter import Tk\r\n\r\nmap0 =\"\"\"                             \r\n                            \r\nwssss  sss   sss  ss   ss  sw\r\nw                           w\r\nw                           w\r\nw    wwwwww    sssss      www\r\nwww    w                  s w\r\nw      w          w         w\r\nw   wwwww     ssssw  ww  wwww\r\nw      wwwwww     w     w   w\r\nw    w      s   www  wwww   w\r\nw      w          w     w   w\r\nw   wwwwwwwwwwwww w     w   w\r\nw      w          wwwwwww   w\r\nw                           w\r\nwwwwwwwwwwwwwwwwwwwwwwwwwwwww\"\"\"\r\nstart = \"w\"*29\r\nmap1 = \"w\" + \" \" * 27 + \"w\\n\"\r\nmap1 = start + map1 * 15 + start\r\nmap2 = \"\"\"w                          w\r\nw                          w\r\nw       ssswwwss     sssss w\r\nwwsss      w w             w\r\nww         www   ss        w\r\nww         w w             w\r\nww ssss    www         sss w\r\nww         wwwsss          w\r\nww         w w           w w\r\nww         www     ws   sw w\r\nww         w w     w     s w\r\nw   ssswsssssssss w        w\r\nw      s          ssssss   w\r\nw                          w\r\nwwwwwwwwwwwwwwwwwwwwwwwwwwww\"\"\"\r\n\r\ndef map_to_list(map1=map1):\r\n    if map1 == \"\":\r\n        start = \"w\"*29\r\n        map1 = \"w\" + \" \" * 27 + \"w\\n\"\r\n        map1 = start + map1 * 14 + start\r\n    map1 = map1.splitlines()\r\n    map2 = []\r\n    for n, line in enumerate(map1):\r\n        map2.append(list(map1[n]))\r\n    return map2\r\n\r\nmap1 = map_to_list(map1)\r\n\r\ndef screen_init():\r\n    \"Creates globals for screen and map\"\r\n    global game_map, WINDOW_SIZE\r\n    game_map = map1\r\n    WINDOW_SIZE = (29 * 32, 16 * 32)\r\n\r\n\r\ndef music_init():\r\n    \"Initialize sounds avoiding delay\"\r\n    pygame.mixer.pre_init(44100, -16, 1, 512)\r\n    pygame.init()\r\n    pygame.mixer.quit()\r\n    pygame.mixer.init(22050, -16, 2, 512)\r\n    pygame.mixer.set_num_channels(32)\r\n\r\n\r\ndef game_sounds():\r\n    \"Loads the sounds for the game\"\r\n    sounds_list = \"jump\", \"grass_0\"\r\n    sound_dic = {}\r\n    for sound in sounds_list:\r\n        sound_path = f\"data\/audio\/{sound}.wav\"\r\n        sound_dic[sound] = pygame.mixer.Sound(sound_path)\r\n    return sound_dic\r\n\r\n\r\ndef soundtrack():\r\n    \"Call this to put a soundtrack in the game\"\r\n    pygame.mixer.music.load('data\/audio\/dawn.mp3')\r\n    pygame.mixer.music.play(-1)\r\n\r\nscreen_init()\r\nmusic_init()\r\nsoundtrack()\r\nsound_dic = game_sounds()\r\n\r\n\r\n# ======== Game init, Clock and global vars ===\r\npygame.display.set_caption('Game')\r\nscreen = pygame.display.set_mode(WINDOW_SIZE, 0, 32)\r\ndisplay = pygame.Surface((WINDOW_SIZE[0] \/\/ 2, WINDOW_SIZE[1] \/\/ 2))\r\nclock = pygame.time.Clock()\r\nfont = pygame.font.Font(None, 32)\r\nfont2 = pygame.font.Font(None, 16)\r\nfont3 = pygame.font.SysFont(\"Arial\", 10)\r\n# awareness of direction and position\r\nmoving_right = False\r\nmoving_left = False\r\n# stay_right = True\r\ngravity = 0\r\nair_timer = 0\r\n\r\nplayer_image = pygame.image.load('imgs\\\\player.png')\r\nplayer_jump = pygame.image.load('imgs\\\\player_jump.png')\r\nplayer_jumpl = pygame.transform.flip(player_jump, 1, 0)\r\nplayer_climb = pygame.image.load('imgs\\\\player_climb.png')\r\nplayer_climbl = pygame.transform.flip(player_climb, 1, 0)\r\nplayer_stand = pygame.image.load('imgs\\\\player_stand.png')\r\n# player_img.set_colorkey((255, 255, 255))\r\np_right = player_image\r\np_left = pygame.transform.flip(player_image, 1, 0)\r\nplayer_img = p_right\r\nbg = pygame.image.load(\"imgs\\\\bg.png\")\r\n# bg2 = pygame.image.load(\"imgs\\\\bg2.png\")\r\n\r\n# Rectangles for collisions\r\nplayer_rect = pygame.Rect(100, 100, 5, 13)\r\nstarting_pos = 100\r\nhealth = pygame.image.load(\"imgs\\\\health.png\")\r\nhealth_rect = pygame.Rect(150, 225, 16, 16)\r\n\r\n# climber 5\r\nstamina = 100\r\n\r\n\r\ndef load_tiles():\r\n    #symbols and relative image\r\n    symb_img = [\r\n                # (\"o\", \"dirt\"),\r\n                # (\"x\", \"grass\"),\r\n                # (\"&lt;\", \"grassr\"),\r\n                # (\"&gt;\", \"grassl\"),\r\n                (\" \", \"space\"),\r\n                # (\"d\", \"door\"),\r\n                (\"w\", \"brick2_16\"),\r\n                (\"s\", \"brick2_16\")]\r\n    dr = \"imgs\\\\\"\r\n    tl = {}\r\n    for i in symb_img:\r\n        tl[i[0]] = pygame.image.load(f'{dr}{i[1]}.png')\r\n    return tl\r\n\r\n\r\ntl = load_tiles()\r\n\r\n\r\n# =============\r\n#    Functions\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    global stamina\r\n\r\n    hit_list = []\r\n    for tile in tiles:\r\n        if rect.colliderect(tile):\r\n            hit_list.append(tile)\r\n    if rect.colliderect(health_rect):\r\n        if stamina &lt; 100:\r\n            stamina += 10\r\n            print(\"Recovering\")\r\n    return hit_list\r\n\r\ncollision_types = {\r\n        'top': False, 'bottom': False, 'right': False, 'left': False}\r\ngoingright = 0\r\n\r\n\r\ndef move(rect, movement, tiles):\r\n    global player_img\r\n    global air_timer, gravity, collision_types, moving_right, moving_left\r\n    global goingright\r\n    global stamina\r\n    global player_altitude\r\n    global starting_pos\r\n\r\n\r\n    player_altitude = player_rect.y\r\n    collision_types = {\r\n        'top': False, 'bottom': False, 'right': False, 'left': False}\r\n\r\n    rect.x += movement[0]\r\n    tile = collision_test(rect, tiles)\r\n    if tile != []:\r\n        tile = tile[0]\r\n        # ===================&gt; MOVE RIGHT\r\n        if moving_right:\r\n            rect.right = tile.left\r\n            collision_types['right'] = True\r\n            goingright = 1\r\n            gravity = -1\r\n            player_img = player_climb\r\n            stamina -= 0.02\r\n            starting_pos = rect.y\r\n        # ====================&gt; MOVE LEFT\r\n        elif moving_left:\r\n            goingright = 0\r\n            rect.left = tile.right\r\n            collision_types['left'] = True\r\n            gravity = -1\r\n            player_img = player_climbl\r\n            stamina -=0.02\r\n            starting_pos = rect.y\r\n    rect.y += movement[1]\r\n    hit_list = collision_test(rect, tiles)\r\n    for tile in hit_list:\r\n\r\n        #              === DOWN: falls? ===\r\n\r\n        if movement[1] &gt; 0:\r\n            # If it was falling down\r\n            if not moving_left and not moving_right and gravity &gt; 0:\r\n                player_img = player_stand\r\n            if (rect.bottom - starting_pos) &gt; 50:\r\n                stamina -= 30\r\n                pygame.mixer.Sound.play(sound_dic['grass_0'])\r\n                player_img = player_jump\r\n                \r\n\r\n            starting_pos = rect.bottom\r\n            rect.bottom = tile.top\r\n            collision_types['bottom'] = True\r\n        elif movement[1] &lt; 0:\r\n            player_img = player_jump\r\n            gravity = -3 # = -1 it attaches to the wall\r\n            attached = rect.top = tile.bottom\r\n            stamina -= 0.03\r\n            #collision_types['top'] = False\r\n\r\n    if collision_types['bottom']:\r\n        air_timer = 0\r\n        gravity = 0\r\n\r\n    else:\r\n        air_timer += 1\r\n    return rect\r\n\r\n\r\ndef display_tiles():\r\n    \"Makes the Rects for the 'physics'\"\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            display.blit(tl[symbol], (x * 16, y* 16))\r\n            x += 1\r\n        y += 1\r\n\r\ndef create_tile_rects(game_map):\r\n    \"Makes the Rects for the 'physics'\"\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 != \" \":\r\n                tile_rects.append(pygame.Rect(x * 16, y * 16, 16, 15))\r\n            x += 1\r\n        y += 1\r\n    return tile_rects\r\n\r\n\r\n\r\n\r\n\r\nplayer_altitude = player_rect.y\r\ndef display_player(pim):\r\n    global player_rect\r\n    global starting_pos\r\n    #player_img = p_right if stay_right else p_left\r\n    display.blit(health, (150, 225))\r\n    display.blit(pim, (player_rect.x, player_rect.y))\r\n    h = str(player_rect.bottom - starting_pos) \r\n    highness = font3.render(h, 0, pygame.Color(\"blue\"))\r\n    display.blit(highness, (player_rect.x, player_rect.y-10))\r\n\r\n# 500, 500, 50, 50\r\ndef display_stamina():\r\n    #player_img = p_right if stay_right else p_left\r\n    print(\"health\")\r\n\r\ndef display_bg():\r\n    \"Displays the background\"\r\n    global WINDOW_SIZE\r\n    display.blit(bg, (0, 0))\r\n\r\n\r\ndef _display(fnt, what, color, where):\r\n    text_to_show = font.render(what, 0, pygame.Color(color))\r\n    display.blit(text_to_show, where)\r\n\r\ndef display_text():\r\n    # fps\r\n\r\n    _display(\r\n            font,\r\n            what = str(int(clock.get_fps())),\r\n            color = \"white\",\r\n            where = (0,0)),\r\n    \r\n    _display(font2,\r\n            what = \"Wall climber\",\r\n            color = 'blue',\r\n            where = (100,0))\r\n\r\n    _display(font3,\r\n            what = \"Stamina: \" + str(int(stamina)),\r\n            color = 'coral',\r\n            where = (300,0))\r\n\r\n\r\n    _display(font3,\r\n            what = \"altitude: \" + str(int(player_altitude)),\r\n            color = 'blue',\r\n            where = (300, 15))\r\n\r\n\r\ndef clear_screen():\r\n    display.fill((73, 184, 250))\r\n\r\n\r\nVELOCITY = 1\r\n\r\ndef jump():\r\n    # MOVES THE PLAYER WHEN GOES RIGHT OR LEFT\r\n    global moving_right, moving_left, gravity, stamina\r\n\r\n    player_movement = [0, 0]\r\n    if moving_right:\r\n        player_movement[0] += VELOCITY\r\n        stamina += 0.005\r\n    if moving_left:\r\n        player_movement[0] -= VELOCITY\r\n        stamina += 0.005\r\n    player_movement[1] += gravity\r\n    return player_movement\r\n\r\n\r\ndef check_life():\r\n    global stamina, player_rect\r\n    if stamina &lt; 0:\r\n        player_rect.x, player_rect.y = 100, 100\r\n        stamina = 100\r\n        root = Tk()\r\n        root.overrideredirect(1)\r\n        root.withdraw()\r\n        messagebox.showinfo(\"Showinfo\", \"So many windows!\")\r\n        root.destroy()\r\n\r\n\r\n\r\ndef move_player():\r\n    global loop, player_rect, moving_right, air_timer, moving_left, gravity, collision_types, player_img, stamina\r\n    global tile_rects\r\n    check_life()\r\n    player_movement = jump()\r\n\r\n    gravity += 0.3\r\n    if gravity &gt; 3:\r\n        gravity = 3\r\n\r\n    player_rect = move(player_rect, player_movement, tile_rects)\r\n\r\n    # ============ Keyboard pressing detection\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                player_img = p_right\r\n                moving_right = True\r\n            if event.key == K_LEFT:\r\n                player_img = p_left\r\n                moving_left = True\r\n            # ========\r\n            #  JUMP\r\n            # ========\r\n            if event.key == K_UP:\r\n                if air_timer &lt; 6:\r\n                    gravity = -5\r\n                    stamina -= 3\r\n                    pygame.mixer.Sound.play(sound_dic['jump'])\r\n            # ==========\r\n            #  DOWN\r\n            # ==========\r\n            if event.key == K_DOWN:\r\n                if air_timer == 0:\r\n                    player_img = player_jump\r\n                gravity = +1\r\n\r\n\r\n        elif 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        if pygame.mouse.get_pressed()[0]:\r\n            mx, my = pygame.mouse.get_pos()\r\n            mx, my = int(mx \/ 32), int(my \/ 32)\r\n            row, col = my, mx            \r\n            map1[row][col] = \"w\"\r\n            tile_rects = create_tile_rects(map1)\r\n        if pygame.mouse.get_pressed()[2]:\r\n            mx, my = pygame.mouse.get_pos()\r\n            mx, my = int(mx \/ 32), int(my \/ 32)\r\n            row, col = my, mx \r\n            map1[row][col] = \" \"\r\n            tile_rects = create_tile_rects(map1)\r\n\r\n    return player_img\r\n\r\n\r\ndef scale_screen():\r\n    screen.blit(pygame.transform.scale(display, WINDOW_SIZE), (0, 0))\r\n    \r\ntile_rects = create_tile_rects(map1)\r\nloop = 1\r\nwhile loop:\r\n    stamina -= 0.001\r\n    clear_screen()\r\n    display_tiles()\r\n    player_img = move_player()\r\n    display_player(player_img)\r\n    display_text()\r\n    scale_screen()\r\n    pygame.display.update()\r\n    clock.tick(60)\r\n\r\npygame.quit()\r\nprint(\"Game over\")\r\n\"\"\"\r\n------- new in pygame: The climber tutorial 5 -----------\r\ndiplay_text\r\n    shows fps, title and stamina\r\n\r\n\"\"\"<\/pre>\n<h2>Another video with some experiments on the map maker app<\/h2>\n<div style=\"width: 747px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-4737-1\" width=\"747\" height=\"420\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/map_maker_1_2.mp4?_=1\" \/><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/map_maker_1_2.mp4\">https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/map_maker_1_2.mp4<\/a><\/video><\/div>\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":"In this version of the pygame app to create maps for a platform game, we can see the player in action into the \n<a class=\"moretag\" href=\"https:\/\/pythonprogramming.altervista.org\/map-maker-1-2\/\"> [...]<\/a>","protected":false},"author":1,"featured_media":4738,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1,191],"tags":[],"class_list":["post-4737","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-examples","category-pygame"],"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\/4737","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=4737"}],"version-history":[{"count":4,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/4737\/revisions"}],"predecessor-version":[{"id":4757,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/4737\/revisions\/4757"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media\/4738"}],"wp:attachment":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media?parent=4737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/categories?post=4737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/tags?post=4737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}