![]() ![]() By drawing the background first, more active content (characters, moveable/static objects, and explosions) will reside above(or on top of the background). For this instance, our interpretation of outer space is the background to the game window. Things that would be further in the background are draw at the bottom most layers(things like distant mountains or scenery). The objects that would display more activity are on the top-most layers. One point of reference is that pygame deals with drawing in the same way that a cartoon animator would. Skip the source code in red, it is the psyco try/except block! If you are already using it you can choose to include it, if you’re not using psyco then avoid the install unless your confident that you can make it work. UPDATE: Psyco is no longer supported as of March 12, 2012. If you’re using a different IDE your mileage may vary, if in doubt, use IDLE as your benchmark(or use IDLE to run this example). When I ran the starfield.py file in Python IDLE 2.6, it never crashed(but you need to have the pygame.quit() statement, so the app window does not crash). I typically use Editra v0.7.12 to write Python code, when including the psyco try/except block, Editra would occasionally crash. If there’s information that I have glossed over or skipped entirely, let me know, and I will add it in, with future edits of the tutorials. If there are any comments about the tutorials, whether they are critical or complimentary, you’re welcome to post them. If you have already coded the first tutorial you should do just fine with this one. ![]() There are some very good resources available for Python, either through THE OFFICIAL PYTHON WEB-SITE or by completing a Google search on the Python version you have installed. If that is not the case, then you should, at the very least, want to have the Python documentation(included in the Python install) at hand incase you wanted it for a reference. One important point about these tutorials is the assumption that anyone following along already has at least a basic knowledge of how Python code is structured. The next step, will be building on that example, we will create a star field background, then write the code to animate it. In the first tutorial, we created a simple window using Python and Pygame. Tags: Editra, Python 3.x, Pygame, programming, star-field simulation
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |