Last time, we implemented text and simple sprite interactions.
So let's remove the debug output from the previous repository. Because today, we're going to add some missile attacks using the mouse. We'll also talk how to programmatically make shapes.
Also, remember the video from the first part of this series? From this point, we will be discussing topics not found in that talk. After my talks, I usually allocate time for audience suggestions. Its usually a hit or a miss if a topic will be discussed (like mouse input, special effects, GUI, audio, etc), even though I ...[read more]
Last time, we added some pew pew to our game. Now, let's add some text, bad guys, and collision detection.
First thing we need is the font. We can use the font installed in the OS or use our own.
# main.py [...] pygame.init() screen = pygame.display.set_mode(resolution) clock = pygame.time.Clock() font = pygame.font.SysFont("Courier New", 18) [...] while isRunning: [...] text = font.render("Hello world", False, (0, 0, 0)) screen.blit(text, (0, 0)) pygame.display.flip()
font.render("Hello world", False, (0, 0, 0)) allows us to print the string "Hello world", without antialiasing ...[read more]
Last time, we made a simple game where we can move our hero character. But the game world is currently barren. Let's change this by having our avatar shoot some attacks.
Behold my paint drawing of an attack!
Yes, it is still badly drawn, but you're not here to become an artist. You're here to learn to how make games.
What we are going to do is spawn our shot when the player presses the spacebar button. Here is the code for that:
import pygame resolution = (640, 480) isRunning = True pygame.init() screen = pygame.display ...
Right now, we only have the game window. Its boring.
Open up your paint application. I believe Microsoft Paint is installed by default in most computers. Don't be shy with Paint, we are programmers not artists. We'll start with programmer's art and change it later.
Kirby is the most famous example of a programmer art. Not knowing how to draw is not an excuse to start
We are going to draw our main character.
Here's my attempt at making a game character. I saved this as hero.png.
You may laugh, but in ...[read more]
I gave a talk on how to make a game using pygame. It's one hour and can serve as a general overview of this series. You can watch the above and read these articles, or you can read these articles and pretty much ignore the video.
This series will expand on my talk (up until part 4) and will add more explanation than I could give in less than an hour.
You need to install pygame via the pip command.
$ pip install pygame
Then we test that pygame is properly installed:
$ python >>> import ...
In this series, I want to show students and traditional programmers how to make a game using Python. The simplicity and readability of the language lowers the barrier for learning how games engines work.
I am going to assume readers have fundamentals in Python. But you don't need an intermediate level in Python as this series will be beginners friendly.
We will learn how game engines work under the hood. We will use that knowledge to make our own game. You will learn concepts not taught in traditional programming schools.
So you want to make a game
Python have ...[read more]
I didn't play Street Fighter EX when it first came out. I grew up in the province and have limited arcade selections. It doesn't help that I rather play Xmen vs Street Fighter, Marvel Super Heroes, or Metal Slug (going for the 1CC) whenever I'm at our local arcade.
After moving to Metro Manila, I hang out with friends to play Fighting Games at our weekly casuals. A new game was released: EX Fighting Layer, and we got to play it on day 1. I immediately told everyone that I have no experience with the series and ...[read more]
I'm a polyglot computer programmer. I am proficient with C, C++, Visual Basic 6.0, C#, PHP, and Python. I have basic knowledge with Java, Go, and Pawn, but I am very confident I can code with these if I have the manual available.
I personally like Python the most. In this post, I'll point out the advantage of using Python.
Miss Kobayashi's Maid Dragon is an anime where the main character is surprisingly not a teenager but a young adult who have a job as a programmer. Her using Python is just a nice bonus ...
Categories: Programming, Python
Disclaimer: I'm primarily a Python programmer, a board member of Python Philippines, and used Python before it became popular (I don't remember the exact version, but I encountered the language when it was introduced in Blender).
I started programming with Pascal, honed my skills on C and C++, and made commercial products with Visual Basic 6.0, PHP and Python.
Python is the programming language that I found the most fun to work with . Over the years, I've written a lot of code. Based on pure experience, I can see the programming foundation a beginner will ...[read more]
I've been programming since I was a kid. I've experienced saving my code in numerous ways: using the blue IDEs (Turbo C), "copy con <filename>", visual studio (Visual Basic and C++), emacs, vi, and notepad2.
For the last 7+ years, I've been using notepad2 almost exclusively for Python programming. There is a method to my madness.
Before I started teaching programming to college students, I was an emacs user. The idea of having an IDE that you can program appeals to me. I like the idea of an IDE that is custom made to my own intuition ...[read more]