Movement is part of a large portion of games. When jumping between platforms, shooting against a horde of enemies, piloting a space ship and running through the streets, we are causing movement and interacting with the game environment, applying action and causing reactions.
This chapter is to describe the basics of moving objects across the screen and their interaction with other elements through collision detection.
Movement If you are following this series of posts, you already saw an example of movement at the post about the game loop, where we implemented a ball that moves through the screen bouncing around.
Games always connected me with technology since the beginning.
My father and I, we built our first computer (a Pentium 286) and the first thing that I remember to do was to play some DOS games like Prince of Persia and Lunar Lander. I learned a bunch of CLI commands just to play my favorite games.
The passion for playing and making games followed me as a hobby. I have a pygame series of posts on this blog, where I go through basic concepts of game development trying to explain them to someone who is starting to learn about it.
I’m starting this series of posts to give you tips on libraries that can be handy on your day to day as a Developer and also to present libraries I think you should keep on eye on.
One of the perks of a good Developer is having a proper tool-set available on your belt, and nothing more appropriate to start this series than a library that installs other libraries!
How many times did you install some Python CLI tool inside of a Python virtualenv?
Raise your hand if you never versioned the Django’s SECRET_KEY at the beginning of a project and needed to generate a new one before going to production.
This TLDR is a quick reminder of how to generate a secret key locally, without going to some website on the internet to generate it for you.
Django generates a secret key every time that you create a new project, so this function already exists at its code, and you can access it in this way:
Chatting with a friend, Mário Sérgio, about problems that happen when you migrate your codebase from Python versions, I came out with the idea of writing this TLDR.
I hope it can help someone that is trying to work with texts that contain Unicode characters that don’t fall back into the ASCII table like other than the roman alphabet and emoji.
On Python 2 there’s no distinction between byte and string.
Someday, during the Python Tuesdays event at Calango Hacker Club, one of the participants came with a question on how to automate its email reading process at Gmail categorizing their messages into something that could be important and something that is not. That question motivated me looking after how to that, and then into this post that maybe can help someone that is trying to do something similar with Python.
Some libraries aren’t 100% packaged Python code, some of them are bindings to external libraries. They offer a Python interface so you can call them inside your code. On these cases, we need to install them previously at the system so the python package can work.
When that happens, we get this kind of error:
ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named _sqlite3 To solve errors like that, you need to install the external library, and the system configures everything to you.
This post it the result of a bug that haunted me for three months until I finally could isolate the error properly, and get to the root of the issue.
Disclaimer: this information exists at the Django docs, however strengthening the importance of this info is vital to prevent people to spend a lot of time with this kind of bug. One of the core parameters of a Django Model field is the default.
Almost every system that runs on the internet and stores user data has an authentication layer. With the API architecture becoming popular nowadays, the complexity of the authentication layer also grew.
This post was made to explain the authentication process between a frontend written in Angular 6 and a backend written in Django 2 using the architecture proposed on my previous post “Separating Frontend from Backend with Angular and Django”.
Have you ever asked yourself how to publish your Python package, so you can install it using pip? It is less complex than it seems, and anyone can do it.
The first step is to create an account on the Python Package Index (PyPI) were all Python packages are registered.
After that, you need to create a file called setup.py on the root folder of the Python code that you will publish with the following content, changing the values were is needed: