{"id":13,"date":"2025-10-17T14:01:38","date_gmt":"2025-10-17T14:01:38","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/q_alobeid\/?p=13"},"modified":"2025-10-17T14:01:38","modified_gmt":"2025-10-17T14:01:38","slug":"space-invaders","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/q_alobeid\/2025\/10\/17\/space-invaders\/","title":{"rendered":"Space Invaders"},"content":{"rendered":"\n<p>I started a new game using pygame its called Space Invaders and this is the code I have for now <br><br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pygame\nimport os\nimport time\nimport random\npygame.font.init()\n\n\n\nWIDTH, HEIGHT = 600, 600\nWIN = pygame.display.set_mode((WIDTH, HEIGHT))\npygame.display.set_caption(\"Space Shooter Game | korsat x parmaga \")\nmain_font = pygame.font.SysFont(\"comicsans\", 35)\nlost_font = pygame.font.SysFont(\"comicsans\", 45)\n\n\ndef collide(obj1, obj2):\n    offset_x = obj2.x - obj1.x\n    offset_y = obj2.x - obj1.y\n    return obj1.mask.overlap(obj2.mask, (offset_x, offset_y)) != None\n\n\n\n\n\ndef draw_lives(lives):\n    lives_label = main_font.render(f\"Lives: {lives}\", 1, (255, 255, 255))\n    WIN.blit(lives_label, (10, 10))<\/code><\/pre>\n\n\n\n<p><br><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I started a new game using pygame its called Space Invaders and this is the code I have for now<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/q_alobeid\/wp-json\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/q_alobeid\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/q_alobeid\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/q_alobeid\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/q_alobeid\/wp-json\/wp\/v2\/comments?post=13"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/q_alobeid\/wp-json\/wp\/v2\/posts\/13\/revisions"}],"predecessor-version":[{"id":14,"href":"https:\/\/theroyalscode.com\/students\/q_alobeid\/wp-json\/wp\/v2\/posts\/13\/revisions\/14"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/q_alobeid\/wp-json\/wp\/v2\/media?parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/q_alobeid\/wp-json\/wp\/v2\/categories?post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/q_alobeid\/wp-json\/wp\/v2\/tags?post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}