资讯

Our game needs interesting people to speak to, so let's create one. You will see on line 57 of the code that we have a new function that handles a random villager.
Coding tells the game what to do Coding is like telling a computer what to do, and in games, it’s how you make stuff happen. Imagine code as a conversation between the creator and the game.
Simply create a new .py file in the same folder as your main Python code. Then “import” that file as you now know how to do, then access the functions from within that module.
That’s how to create a file in Python, update it, rename it, and destroy it. The circle of life! Of course, this is only really scratching the surface of what you can accomplish with Python.