{"id":276,"date":"2025-11-07T16:37:29","date_gmt":"2025-11-07T16:37:29","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/k_rai\/?p=276"},"modified":"2025-12-05T14:25:28","modified_gmt":"2025-12-05T14:25:28","slug":"python-game","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/k_rai\/2025\/11\/07\/python-game\/","title":{"rendered":"Snail Chase"},"content":{"rendered":"\n<p>Today I started new project that introduces pygame to beginners <\/p>\n\n\n\n<p>I first started With Importing the  pygame  and making the window size on the screen<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"619\" height=\"277\" src=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-1.png\" alt=\"\" class=\"wp-image-278\" srcset=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-1.png 619w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-1-300x134.png 300w\" sizes=\"auto, (max-width: 619px) 100vw, 619px\" \/><\/figure>\n\n\n\n<p>While True loop is for when the players decides to quit the window, without the pygame.quit  the players would be just stuck with a black screen.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"681\" height=\"396\" src=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-2.png\" alt=\"\" class=\"wp-image-279\" style=\"width:593px;height:auto\" srcset=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-2.png 681w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-2-300x174.png 300w\" sizes=\"auto, (max-width: 681px) 100vw, 681px\" \/><\/figure>\n\n\n\n<p>The clock.tick tells the while loop to run for 60 Times per second and that it shouldn&#8217;t be any faster or slower, this makes sure the game doesn&#8217;t run too fast<\/p>\n\n\n\n<p>The screen.blit Basically Puts one surface on top of another surface , this helps to put images for the game<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"855\" height=\"268\" src=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-3.png\" alt=\"\" class=\"wp-image-280\" srcset=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-3.png 855w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-3-300x94.png 300w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-3-768x241.png 768w\" sizes=\"auto, (max-width: 855px) 100vw, 855px\" \/><\/figure>\n\n\n\n<p>The screen blit helps to put the image on top of Each other to create an background but You have to make sure the order is Correct  <\/p>\n\n\n\n<p>like for example the sky has to come first and the others on top for the players to be able to see the ground and the character. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"487\" src=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-4-1024x487.png\" alt=\"\" class=\"wp-image-281\" srcset=\"https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-4-1024x487.png 1024w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-4-300x143.png 300w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-4-768x365.png 768w, https:\/\/theroyalscode.com\/students\/k_rai\/wp-content\/uploads\/2025\/11\/pygame-4.png 1127w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I started new project that introduces pygame to beginners I first started With Importing the pygame and making the window size on the screen While True loop is for when the players decides to quit the window, without the pygame.quit the players would be just stuck with a black screen. The clock.tick tells the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":281,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-276","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\/276","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=276"}],"version-history":[{"count":2,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/posts\/276\/revisions"}],"predecessor-version":[{"id":334,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/posts\/276\/revisions\/334"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/media\/281"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/media?parent=276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/categories?post=276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/k_rai\/wp-json\/wp\/v2\/tags?post=276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}