Ich habe mir neulich einen Raspberry Pi mit dem "wheezy" OS geholt.
Weil pygame unf 2 Python versionen schon installiert waren, konnte ich
gany gemuetlich anfangen zu programmieren. Doch nun will ich es
als stand-alone ohne abhaengigkeit von python compilen.
Mir wurde freeze.py fuer Linux empfohlen, aber ich kann keine
geignete version dieser datei finden. Immer wenn ich versuche
yu compilen, sagt er mir, dass er checkextension nicht gefunden hat.
Falls es hilft, hier ist der Code vom Programm:
Code: Alles auswählen
####IMAGE_LOADING#####################
pl = "left.png"
pr = "right.png"
black = "black.jpg"
cloud="sky.png"
boulder="Rock.gif"
st="gem4.png"
#####LIBRARY_IMPORT##################
import pygame
from pygame import *
from random import uniform
####INITIALIzATION###################
pygame.init()
QUIT = pygame.quit
screen = pygame.display.set_mode((400,300),0,32)
screen.fill((255,255,255))
#####VARIABLE_DECLARATION###############
movex,movey=0,0
x,y=250,250
speed=0.06
speedplus=0.006
fric=0.3
leftdown=0
rightdown=0
highspeed=6
z1=44
z2=134
z3=250
z4=375
y1=0.2
y2=0.2
y3=0.2
y4=0.2
score=0
####IMAGE_CONVERSION####################
player=pygame.image.load(pr).convert_alpha()
bg=pygame.image.load(black).convert_alpha()
rock=pygame.image.load(boulder).convert_alpha()
star=pygame.image.load(st).convert_alpha()
sky=pygame.image.load(cloud).convert()
pygame.display.set_caption("Squirrel")
#####KEY_INPUT##########################
while True:
screen.fill((0,0,0))
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
quit
if event.type==KEYDOWN:
if event.key==K_LEFT:
player=pygame.image.load(pl).convert_alpha()
rightdown=0
leftdown=1
if event.key==K_RIGHT:
player=pygame.image.load(pr).convert_alpha()
leftdown=0
rightdown=1
if event.type==KEYUP:
if event.key==K_LEFT:
leftup=1
if event.key==K_RIGHT:
rightup=1
######CALCULATIONS######################
speed=speed+speedplus
y1=y1+speed
y2=y2+speed
y3=y3+speed
y4=y4+speed
if y1>300:
y1=3
z1=uniform(0,375)
if y2>300:
y2=3
z2=uniform(0,375)
if y3>300:
y3=3
z3=uniform(0,375)
if y4>300:
y4=3
z4=uniform(0,375)
if x<=0:
x=5
movex=0
if x>380:
x=379
movex=0
if leftdown==1:
if movex>=-highspeed:
movex=movex-fric
if rightdown==1:
if movex<=highspeed:
movex=movex+fric
######COLLISIONS#####################################
if y1>y-1:
if y1<y+30:
if z1>x-4:
if z1<x+16:
print"Your score is", score
movex,movey=0,0
x,y=-200,-200
speed=0
speedplus=0
fric=0
leftdown=0
rightdown=0
highspeed=0
z1=44
z2=134
z3=250
z4=375
y1=-60
y2=-60
y3=-60
y4=-60
if y2>y-1:
if y2<y+30:
if z2>x-4:
if z2<x+16:
print "Your score is", score
movex,movey=0,0
x,y=-200,-200
speed=0
speedplus=0
fric=0
leftdown=0
rightdown=0
highspeed=0
z1=44
z2=134
z3=250
z4=375
y1=-60
y2=-60
y3=-60
y4=-60
if y3>y-1:
if y3<y+17:
if z3>x-1:
if z3<x+16:
score=score+1
y3=3
z3=uniform(0,375)
if y4>y-1:
if y4<y+17:
if z4>x-1:
if z4<x+16:
score=score+1
y4=3
z4=uniform(0,375)
######DRAWING######################################
x=x+movex
y=y+movey
screen.fill((120,135,255))
screen.blit(sky, (0,0))
screen.blit(bg, (0,268))
screen.blit(player,(x,y))
screen.blit(rock,(z1,y1))
screen.blit(rock,(z2,y2))
screen.blit(star,(z3,y3))
screen.blit(star,(z4,y4))
pygame.display.update()