{"id":290,"date":"2025-11-17T14:31:25","date_gmt":"2025-11-17T14:31:25","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/k_rai\/?p=290"},"modified":"2025-11-17T14:31:25","modified_gmt":"2025-11-17T14:31:25","slug":"11-14-25-2d-pygame","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/k_rai\/2025\/11\/17\/11-14-25-2d-pygame\/","title":{"rendered":"11\/14\/25 2D Pygame"},"content":{"rendered":"\n<p>Today I decided to work futher on that snake dash I made and this project is similar to the box dash I made earlier. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"464\" src=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame-1024x464.png\" alt=\"\" class=\"wp-image-291\" srcset=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame-1024x464.png 1024w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame-300x136.png 300w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame-768x348.png 768w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame.png 1135w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I first started with importing pygame <\/p>\n\n\n\n<p>I made a function called class that contains all the games window&#8217;s description like height and width<\/p>\n\n\n\n<p>The codes display_surface are responsible for the length of the  pop up window on the screen <\/p>\n\n\n\n<p>The display.set_caption puts the caption on the top left of the pop of window of your choice<\/p>\n\n\n\n<p>self.clock is responsible for how long frames per second you want it on the screen <\/p>\n\n\n\n<p>The pygame.Quit allows for the player to quit out of the game <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"644\" height=\"347\" src=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame-2.png\" alt=\"\" class=\"wp-image-292\" srcset=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame-2.png 644w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame-2-300x162.png 300w\" sizes=\"auto, (max-width: 644px) 100vw, 644px\" \/><\/figure>\n\n\n\n<p>The settings contains the extra changes we want to make like the width, height of the game window.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"456\" src=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame-3-1024x456.png\" alt=\"\" class=\"wp-image-293\" srcset=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame-3-1024x456.png 1024w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame-3-300x134.png 300w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame-3-768x342.png 768w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/2d-pygame-3.png 1139w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This is what it looks like right now I&#8217;m not finished but I&#8217;m still working on it<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I decided to work futher on that snake dash I made and this project is similar to the box dash I made earlier. I first started with importing pygame I made a function called class that contains all the games window&#8217;s description like height and width The codes display_surface are responsible for the length [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":293,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-290","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\/290","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=290"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/posts\/290\/revisions"}],"predecessor-version":[{"id":294,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/posts\/290\/revisions\/294"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/media\/293"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/media?parent=290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/categories?post=290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/tags?post=290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}