Archive for the 'pygame' Category

14
Aug
09

back to pygame


I’ve spent about 3-4 hours today familiarizing myself to pygame. I wrote a prototype for a wario clone, pario.
Right now, my character can move around ( to the left and to the right ), and he can jump. I never thought game development would be so fun ( yet, difficult ).

I have big plans for my pario 🙂

06
Mar
09

can has learn pygame ?


Lately, I’ve been reading a bit about pygame. My game development skills are inexistent, so I guess that a high level framework will provide a quick boost into game writing. I’m still reading about it, but I would like to share a bit of code I found was fun to code :



import pygame
from pygame.locals import *

pygame.init()
message 	= "Long time ago, on a blog, not that far away..."
screen  	= pygame.display.set_mode((640,480))
font    	= pygame.font.SysFont("arial",30)
text_srf	= font.render(message,True,(0,0,255))
background	= pygame.image.load("path_to_image").convert()

x = 0
y = screen.get_height()
defy = screen.get_height()

while True:
	for event in pygame.event.get():
		if event.type == QUIT:
			exit()
	if y < -30:
		y = defy
	screen.blit(background,(0,0))
	screen.blit(text_srf,(x,y))
	y -= 0.5
	pygame.display.update()

Make sure you set a valid image path as parameter to load. A picture of a galaxy, so that the effect will be nicer 🙂
I will post something more instructive as soon as I become more knowledgeable in pygame.




Blog Stats

  • 216,750 hits