{"id":24,"date":"2006-03-25T06:07:03","date_gmt":"2006-03-25T05:07:03","guid":{"rendered":"http:\/\/blogs.igalia.com\/eocanha\/?p=24"},"modified":"2015-11-08T00:21:18","modified_gmt":"2015-11-07T23:21:18","slug":"my-first-python-game","status":"publish","type":"post","link":"https:\/\/eocanha.org\/blog\/2006\/03\/25\/my-first-python-game\/","title":{"rendered":"My first Python game"},"content":{"rendered":"<p>This evening I&#8217;ve been doing some testing in <a title=\"Python\" href=\"http:\/\/python.org\/\">Python<\/a> to see the language power. I love making little videogames, so, why not to try it in Python?<\/p>\n<p><a title=\"Pygame\" href=\"http:\/\/www.pygame.org\">Pygame<\/a> is a module that makes easier the task, providing classes and functions to manage the display, sprites, collisions, fonts&#8230; and has a <a title=\"Pygame docs\" href=\"http:\/\/www.pygame.org\/docs\/ref\/index.html\">documentation<\/a> good enough. Using that documentacion, the <a title=\"Python language reference\" href=\"http:\/\/docs.python.org\/ref\/ref.html\">Python language reference<\/a>, a <a title=\"Sprite managing tutorial for Python\" href=\"http:\/\/kai.vm.bytemark.co.uk\/~piman\/writing\/sprite-tutorial.shtml\">sprite managing tutorial<\/a> and googling here and there, I&#8217;ve developed this tiny example: a number mental calculus videogame.<\/p>\n<div style=\"text-align: center\"><img alt=\"Number mental calculus videogame\" src=\"\/blog\/wp-content\/uploads\/2006\/03\/pygame1.gif\" \/><\/div>\n<p>The player starts with the number zero, and collecting some sheets in a particular order, can perform arithmetic operations on his\/her base number in order to get the goal number.<\/p>\n<p>The main character in the game has &#8220;momentum&#8221;, so it&#8217;s a bit tricky to have control over it. You can press [ESC] whenever you wish to terminate the program, and then press any key.<\/p>\n<p>If you like, you can <a id=\"p23\" href=\"http:\/\/blogs.igalia.com\/eocanha\/files\/game_pygame.zip\">download the source code<\/a> and try it. I would be very proud of reading comments about it. \ud83d\ude42<\/p>\n<p><b>2007-03-11 UPDATE<\/b>: I&#8217;ve received a request to make clear under which license is the code published. You can consider the python source code file (and NOT the icon files)<b>published under public domain<\/b>, as well as <b>under GPL license<\/b>. The problem about the icons are that they are borrowed from some KDE style package I can&#8217;t remember about (and I&#8217;ve tried hard). Such package should be GPL or similar also, but I can&#8217;t state it for sure.<\/p>\n<p><b>2008-11-26 UPDATE<\/b>:<br \/>\nI&#8217;ve adapted the source code to run on Ubuntu Hardy. <a href=\"http:\/\/blogs.igalia.com\/eocanha\/files\/game_pygame.zip_ubuntu_hardy\">Download the new version from here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This evening I&#8217;ve been doing some testing in Python to see the language power. I love making little videogames, so, why not to try it in Python? Pygame is a module that makes easier the task, providing classes and functions to manage the display, sprites, collisions, fonts&#8230; and has a documentation good enough. Using that &hellip; <a href=\"https:\/\/eocanha.org\/blog\/2006\/03\/25\/my-first-python-game\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">My first Python game<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/posts\/24"}],"collection":[{"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":1,"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"predecessor-version":[{"id":462,"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/posts\/24\/revisions\/462"}],"wp:attachment":[{"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eocanha.org\/blog\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}