Не могу разобраться с серверами
Сделал что-то вроде игры, и мне хочется выслать её в интернет. Слышал что надо создать сервер но не знаю как. Объясните пожалуйста. Вот код:
import pygame
pygame.init()
# игровое поле
win = pygame.display.set_mode((800, 800))
pygame.display.set_caption('Green Square (0.1)')
bg = [pygame.image.load('bg.png')]
gr = [pygame.image.load('gr.png')]
sx = 0
sy = 0
sspeed = 10
# игрок
width = 80
height = 80
x = 350
y = 350
speed = 10
prstupd = [pygame.image.load('prstup.png'),
pygame.image.load('prstup2.png'),
pygame.image.load('prstup3.png'),
pygame.image.load('prstup4.png'),
pygame.image.load('prstup5.png'),
pygame.image.load('prstup6.png'),
pygame.image.load('prstup7.png'),
pygame.image.load('prstup8.png'),
pygame.image.load('prstup9.png'),
pygame.image.load('prstup10.png'),
pygame.image.load('prstup11.png'),
pygame.image.load('prstup12.png'),
pygame.image.load('prstup13.png'),]
prrt = [pygame.image.load('prrt.png'),
pygame.image.load('prrt2.png'),
pygame.image.load('prrt3.png'),
pygame.image.load('prrt4.png'),
pygame.image.load('prrt5.png'),
pygame.image.load('prrt6.png'),
pygame.image.load('prrt7.png'),
pygame.image.load('prrt8.png'),
pygame.image.load('prrt9.png'),
pygame.image.load('prrt10.png'),
pygame.image.load('prrt11.png'),
pygame.image.load('prrt12.png'),
pygame.image.load('prrt13.png'),]
anim = 0
stup = True
strt = False
stlt = False
stdn = False
# dw
def dw():
global anim
if anim == 39:
anim = 0
win.blit(bg[0], (sx, sy))
win.blit(gr[0], (sx, sy))
if stup:
win.blit(prstupd[anim // 3], (x, y))
anim += 1
if stdn:
win.blit(prstupd[anim // 3], (x, y))
anim += 1
if strt:
win.blit(prrt[anim // 3], (x, y))
anim += 1
if stlt:
win.blit(prrt[anim // 3], (x, y))
anim += 1
pygame.display.update()
# игровой цикл
clock = pygame.time.Clock()
run = True
while run:
clock.tick(30)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
keys = pygame.key.get_pressed()
# вверх, вниз
# вверх
if keys[pygame.K_w] and sy < 0 and y == 350:
sy += sspeed
stup = True
strt = False
stlt = False
stdn = False
if keys[pygame.K_w] and sy == 0 and y > 20:
y -= speed
stup = True
strt = False
stlt = False
stdn = False
if keys[pygame.K_w] and y > 350:
y -= speed
stup = True
strt = False
stlt = False
stdn = False
# вниз
if keys[pygame.K_s] and sy > -4200 and y == 350:
sy -= sspeed
stup = False
strt = False
stlt = False
stdn = True
if keys[pygame.K_s] and sy == -4200 and y < 700:
y += speed
stup = False
strt = False
stlt = False
stdn = True
if keys[pygame.K_s] and y < 350:
y += speed
stup = False
strt = False
stlt = False
stdn = True
# лево, право
# лево
if keys[pygame.K_a] and sx < 0 and x == 350:
sx += sspeed
stup = False
strt = False
stlt = True
stdn = False
if keys[pygame.K_a] and sx == 0 and x > 20:
x -= speed
stup = False
strt = False
stlt = True
stdn = False
if keys[pygame.K_a] and x > 350:
x -= speed
stup = False
strt = False
stlt = True
stdn = False
# право
if keys[pygame.K_d] and sx > -4200 and x == 350:
sx -= sspeed
stup = False
strt = True
stlt = False
stdn = False
if keys[pygame.K_d] and sx == -4200 and x < 660:
x += speed
stup = False
strt = True
stlt = False
stdn = False
if keys[pygame.K_d] and x < 350:
x += speed
stup = False
strt = True
stlt = False
stdn = False
dw()