{"id":272,"date":"2025-11-07T14:20:33","date_gmt":"2025-11-07T14:20:33","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/k_rai\/?p=272"},"modified":"2025-12-05T14:29:10","modified_gmt":"2025-12-05T14:29:10","slug":"python-platform-10-24-25","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/k_rai\/2025\/11\/07\/python-platform-10-24-25\/","title":{"rendered":"Python Platform 10\/24\/25"},"content":{"rendered":"\n<p>Today I resumed my Platformer game which I had started last friday<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"295\" height=\"141\" src=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-4.png\" alt=\"\" class=\"wp-image-264\"\/><\/figure>\n\n\n\n<p>The event checks whether the player exists out or not and if the player clicks the x button, the if event will stop the event loop, stopping the game<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"486\" height=\"183\" src=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-5.png\" alt=\"\" class=\"wp-image-265\" srcset=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-5.png 486w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-5-300x113.png 300w\" sizes=\"auto, (max-width: 486px) 100vw, 486px\" \/><\/figure>\n\n\n\n<p>The function get_background returns the tiles(image) to the background window<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1002\" height=\"296\" src=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-6.png\" alt=\"\" class=\"wp-image-266\" style=\"width:508px;height:auto\" srcset=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-6.png 1002w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-6-300x89.png 300w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-6-768x227.png 768w\" sizes=\"auto, (max-width: 1002px) 100vw, 1002px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"474\" height=\"169\" src=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-7.png\" alt=\"\" class=\"wp-image-267\" srcset=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-7.png 474w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-7-300x107.png 300w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/figure>\n\n\n\n<p>the for tile in background  loops over every tile there is <\/p>\n\n\n\n<p> window.blit(bg_image) draws the background image in a certain spot supported by the (tile) This will fill the entire screen with the image <\/p>\n\n\n\n<p>Pygame.display.update updates the screen every single frame making sure the old drawing stuck on the screen<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"569\" height=\"100\" src=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-8.png\" alt=\"\" class=\"wp-image-268\" srcset=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-8.png 569w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/10\/platform-pic-8-300x53.png 300w\" sizes=\"auto, (max-width: 569px) 100vw, 569px\" \/><\/figure>\n\n\n\n<p>The double sprite helps to put perfect pixel movement on the screen and it also helps to tell if the sprites are interacting with each other. <\/p>\n\n\n\n<p>self.rect is like an tuple that stores indivual values makes it easier to move the player<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I resumed my Platformer game which I had started last friday The event checks whether the player exists out or not and if the player clicks the x button, the if event will stop the event loop, stopping the game The function get_background returns the tiles(image) to the background window the for tile in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":335,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-272","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-free-friday"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/posts\/272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/comments?post=272"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/posts\/272\/revisions"}],"predecessor-version":[{"id":273,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/posts\/272\/revisions\/273"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/media\/335"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/media?parent=272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/categories?post=272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/tags?post=272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}