I'm in the early stages of learning how to code (python 2.76 is my first language) and one thing that's bugging me is not being able to make animated backgrounds.
Anyone wish to help me out by giving me an example of how to do this?
If you want you can just add it to this basic python/pygame script.
Code
bif = "bg.jpg"
mif = "rectile.gif"
import pygame, sys, pygame.mixer
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((480,320),0,32)
sound = pygame.mixer.Sound("music.wav")
sound.play(loops=999)
background = pygame.image.load(bif).convert()
mouse_c = pygame.image.load(mif).convert_alpha()
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
screen.blit(background, (0,0))
x,y = pygame.mouse.get_pos()
x -= mouse_c.get_width()/2
y -= mouse_c.get_height()/2
screen.blit(mouse_c,(x,y))
pygame.display.update()
This post was edited by Metalkon on May 29 2014 12:22am