Python Exploration #4

In our last update, Jordan Hurst talked with us about how a character was rendered on the screen. Today, we discussed how to add movement, interaction, and shooting to the game.

The first step in adding movement to a game is to set up event listeners that will dictate the movement of the character. These event listeners can be added to keys on the keyboard, such as the arrow keys, to control the movement. By binding the movement to different arrow keys, you can make the character move in different directions.

By default, movements in games usually happen in whole numbers. However, by using floats, you can achieve higher precision of movement. This means that your character can move more smoothly and realistically.

Next, we looked at how to add shooting to the game. To do this, we needed to first define the bullets as a sprite. This meant giving them dimensions, colors, and a maximum allowable number on the screen. Once the bullet sprite was defined, an event with a key binding was needed to fire a bullet. This allowed the player to shoot at enemies or obstacles in the game.

Previous
Previous

Codewars Part 2

Next
Next

OutSystems Security Specialization