![]() Next, create a Tile class to establish the template from which each tile gets cast. So, before creating the game board, you must first create the infrastructure for the board's building blocks: tiles.įirst, set up a simple Pygame project, creating a display (your window into the game world), a group to represent the game board, and a few standard variables: import pygame In object-oriented programming, you consider each component as a unique object based upon a template (or class, in programming terminology). ![]() To construct a two-dimensional array, or game board as the case may be, you must have tiles. ![]() If you feel confident enough to translate code to other libraries, though, there's nothing specific to Pygame in the "important" parts of this code (the array constructor), so you can use any library or language.įor simplicity, I'll call the individual squares in the game board array tiles. If you're not familiar with Python, you should take some time to review this Python (and Pygame) introductory series. If you can comfortably create a two-dimensional array, you have a great start at programming any number of games. Free online course: RHEL Technical Overview.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |