miércoles, 10 de diciembre de 2014
Picking up from where we left off
I haven't been able to continue with my game making journey for some months. The reason behind this is that I was accepted in a PhD program in physics! I have been studying hard this whole semester, and though I like the idea of writing a few posts here, it really wasn't an option.
On the bright side, what I've learned can help me become a better programmer, especially the math related stuff. Now that the semester is over, I plan to finish the first graphical game, taking into account the suggestions I received on the last post. I'm currently using a laptop running Lubuntu, and I haven't been able to get Python and pygame running correctly. Once I get this done, I'll start with the game again.
During the semester, I had to write a program, and I used C++ and SFML for it. Now that I revisited C++ I feel like sticking to it, but the blog has already started out with Python. If anyone reads this, let me know if you'd like to see the change to SFML or at least hear some more about it.
See you on the next post!
lunes, 7 de julio de 2014
First game with graphics, part 3
After an unplanned abscence, finally I'll show you how to control an image on screen with the mouse.
This example is actually very similar to the last one. I added a generous amount of whitespace in order to clearly read each function and each class.
This example is actually very similar to the last one. I added a generous amount of whitespace in order to clearly read each function and each class.
Almost a month!
I can't believe it's been almost a month since my last post. I've been very busy at work lately, and I haven't been able to continue playing around with pygame. But soon enough I'll continue making my first game with graphics. I actually have some code ready, but I have to take some time to comment on it, or else there would be little point in posting it.
lunes, 9 de junio de 2014
First Game with Graphics, part 2
On the last post we managed to draw an image to the screen, and now we are going to make a program that allows us to move that image.
First of all, since our program is going to become a little longer, we must give it a little more structure. It's time to divide the program into classes, and give each piece a specific job. This will make it much easier to modify parts of the program without affecting others. Let's start by drawing the same image to the screen, but this time with classes
First of all, since our program is going to become a little longer, we must give it a little more structure. It's time to divide the program into classes, and give each piece a specific job. This will make it much easier to modify parts of the program without affecting others. Let's start by drawing the same image to the screen, but this time with classes
jueves, 5 de junio de 2014
Must-watch video!!!
As you may know, I'm no expert programmer. What I add to this blog is whatever I'm learning at the moment. As I got more and more into pygame I found this video, and it's very, very helpful. This guy really knows what he's talking about. Enjoy!
miércoles, 4 de junio de 2014
First Game with Graphics
We are done with console programs. The fact is that we want to make video games, and while making console programs is a great exercise, they require a lot of effort that we could just as easily spend doing graphical games. Let's get started!
First of all, there seems to be a bit of a version gap between python and pygame. I had Python 3.4 64-bit installed, but pygame can only work with python 3.2 32 bit. I uninstalled 3.4 first, and then downloaded 3.2. Here's where you can get python: Python's Homepage. Pygame can be downloaded here: Pygame's Homepage,
When downloading pygame make sure to notice the version number. The file you're looking for is pygame-1.9.2a0.win32-py3.2.msi.
Install python first, then pygame.
Installing pygame
First of all, there seems to be a bit of a version gap between python and pygame. I had Python 3.4 64-bit installed, but pygame can only work with python 3.2 32 bit. I uninstalled 3.4 first, and then downloaded 3.2. Here's where you can get python: Python's Homepage. Pygame can be downloaded here: Pygame's Homepage,
When downloading pygame make sure to notice the version number. The file you're looking for is pygame-1.9.2a0.win32-py3.2.msi.
Install python first, then pygame.
lunes, 2 de junio de 2014
Guess the number, part 5
Finally, the high score system works, and the program now runs from start to finish without trouble, and has all the features that we set as goals in the beginning. Let's take a look at the different files:
This file is the one from which we are going to access the program. It imports all the functions we're going to need, and serves as a sort of 'hub' where the program returns to receive new instructions. This while loop is the main game loop.
main.py
from functions import *
from mainGame import *
gamestate = 'menu'
def GameManager(state):
while True:
if state == 'menu':
state = ShowMenu()
elif state == 'game':
MainGame()
state = ShowMenu()
elif state == 'score':
ViewHighScores(LoadScoreFileData())
state = ShowMenu()
elif state == 'quit':
print("\nSee you soon!\n")
break
GameManager(gamestate)
from mainGame import *
gamestate = 'menu'
def GameManager(state):
while True:
if state == 'menu':
state = ShowMenu()
elif state == 'game':
MainGame()
state = ShowMenu()
elif state == 'score':
ViewHighScores(LoadScoreFileData())
state = ShowMenu()
elif state == 'quit':
print("\nSee you soon!\n")
break
GameManager(gamestate)
This file is the one from which we are going to access the program. It imports all the functions we're going to need, and serves as a sort of 'hub' where the program returns to receive new instructions. This while loop is the main game loop.
Suscribirse a:
Entradas (Atom)