I’ve still been working with the “Learning Python with Raspberry Pi” book. I know that I have been MIA for a few days but that’s because I have been learning ALOT about “pymunk”. Pymunk is a module that allows your games to appear more life-like. I did have to go through the process of getting this downloaded properly and I did run into some issues while doing so. Throughout the entire process I realized that the command “sudo pip3 install <package>” has made installing modules a lot easier than installing them the way the book suggests. Actually, I found out that the pymunk version in the book is outdated and the most recent version is 5.3.2. To successfully get this module downloaded you will need to use the following command:
After I got this to install smoothly I was able to import most but not all of the needed features to get this program up and running. After getting all of the code written up I ran into an importing error related to the module “Vec2d”. The vec2d module is used to define the gravity vector in a space. You see this work when the gray colored balls fall from the black space. I was super close to giving up and not following through with figuring out what was going on with this program, but I know I was going to go crazy if I didn’t find an answer. So, for novice programmers, like myself, when having issues with modules needed for specific programs you can open up an “Issue” on GitHub. I did this to figure out why python was not able to import the vec2d module and the developer who created pymunk replied with his thoughts. We came to the conclusion that I may have had pymunk installed incorrectly, which I did, and I ended up re-installing it. After the clean install and the author Viblo (https://github.com/viblo) re-vising part of my code it worked! It looks just like the image in the book and works perfectly.
I am now ending chapter 5 and already starting on chapter 6. A recap of what I learned throughout chapter 5:
△ Pygame helps you easily create cool games in python
△ You can use images called “sprites” as little characters in your game
△ You can detect collisions between objects
△ Pygame can produce audio
△ Pymunk allow you to create more realistic games using the physics engine
Want to check out and try this project? Click Here!
Thanks for reading!! ♕