ЕСТЬ КОД,НО ОН НЕ ЗАПУСКАЕТ В Pygame(что не так?)
# -*- coding: UTF-8 -*-
background_image_filename='pole.jpg'
message=“prog”
import pygame
from pygame.locals import *
from sys import exit
import time
import math
#import os
pygame.init()
screen=pygame.display.set_mode((640,480))
pygame.display.set_caption(message)
background=pygame.image.load(background_image_filename).convert()
class Bricks:
def __init__(self,xpos,ypos,filename):
self.x=xpos
self.y=ypos
self.bitmap=pygame.image.load(filename)
def render(self,angle):
self.ugol=pygame.transform.rotate(self.bitmap,angle)
screen.blit(self.ugol,(self.x,self.y))
stime()
x0=320
y0=240
brick=Bricks(x0,y0,'tank.png')
quit=0
def stime():
time.sleep(0.01)
pygame.display.update()
angle=0
while quit==0:
screen.blit(background,(0,0))
for event in pygame.event.get():
if event.type==QUIT:
exit()
if pygame.mouse.get_pressed():
x1,y1=pygame.mouse.get_pos()
if x1>x0:
a=x1-x0
elif x1<x0:
a=x0-x1
else:
a=x0
if y1>y0:
b=y1-y0
elif y1<y0:
b=y0-y1
else:
b=y0
c=math.hypot(a,b)
c=round(c,1)
rad=math.acos(a/c)
angle=math.degrees(rad)
#if x1>x0:
#angle=-angle
if x1>x0 and y1>y0:
angle=-90-angle
if x1<x0 and y1<y0:
angle=-270-angle
if x1>x0 and y1<y0:
angle=-90+angle
if x1<x0 and y1>y0:
angle=-270+angle
if x1==x0 and y1>y0:
angle=-180
if x1==x0 and y1<y0:
angle=0
if x1>x0 and y1==y0:
angle=-90
if x1<x0 and y1==y0:
angle=-270
z=1
#print x1, y1
#print angle
while c>=z:
dx=z*math.cos(rad)
dy=z*math.sin(rad)
if x1>x0:
brick.x=x0+dx
elif x1<x0:
brick.x=x0-dx
if y1>y0:
brick.y=y0+dy
elif y1<y0:
brick.y=y0-dy
z=z+1
screen.blit(background,(0,0))
brick.render(angle)
x0=brick.x
y0=brick.y
brick.render(angle)