rungame = True
while rungame:
for event in pygame.event.get():
if event.type == pygame.QUIT:
rungame = False
elif e.type == pygame.KEYDOWN:
if e.key == pygame.K_LEFT:
x -= speed
elif e.key == pygame.K_RIGHT
x += speed
import pygame
from pygame.color import THECOLORS
pygame.init()
screen = pygame.display.set_mode((1200, 820))
screen.fill(THECOLORS["green"])
player_image = pygame.image.load("game_file/Pers_right.png")
x = 500
y = 500
speed = 5
while rungame:
for event in pygame.event.get():
if event.type == pygame.QUIT:
rungame = False
elif e.type == pygame.KEYDOWN:
if e.key == pygame.K_LEFT:
x -= speed
elif e.key == pygame.K_RIGHT
x += speed
screen.blit(player_image, (500, 500))
pygame.quit()
import pygame
from pygame import *
import sys
import subprocess
import random
from config import *
from levels import *
from platforms import *
from player import *
#window
pygame.init()
pygame.mixer.init()
win = pygame.display.set_mode(display)
pygame.display.set_caption(name_program)
clock = pygame.time.Clock()
screen = pygame.image.load("img/BG.jpg")
def make_map(map, platform):
x = 0
y = 0
for row in level1:
for col in row:
if col == "-":
screen.blit(grow.img,(x,y))
if col == '=':
screen.blit(stena.img,(x,y))
x += platform_w
y += platform_h
x = 0
grow = Grow()
stena = Stena()
hero = Player(100, 100)
left=right=False
#game
exit = True
while exit:
for e in pygame.event.get():
if e.type == QUIT:
exit = False
if e.type == KEYDOWN and e.key == K_LEFT:
left = True
if e.type == KEYDOWN and e.key == K_RIGHT:
right = True
if e.type == KEYUP and e.key == K_RIGHT:
right = False
if e.type == KEYUP and e.key == K_LEFT:
left = False
win.blit(screen, (0, 0))
hero.update(left, right)
hero.blit(screen)
make_map(level1, grow)
pygame.display.flip()
clock.tick(60)
pygame.quit()
from pygame.sprite import Sprite
from pygame import Surface
from pygame import Rect
from pygame.image import load
from config import *
class Player(Sprite):
def __init__(self, x, y):
Sprite.__init__(self)
self.xvel = 0
self.x = x
self.y = y
self.image = load("img/player.png")
def update(self, left, right):
if left:
self.xvel = -player_speed
if right:
self.xvel = player_speed
if not(left or right):
self.xvel = 0
self.x += self.xvel
def blit(self, screen):
screen.blit(self.image, (self.x, self.y))
win.blit(screen, (0, 0))
hero.update(left, right)
hero.blit(screen)
import pyowm
from pyowm.utils.config import get_default_config
owm = pyowm.OWM('0ae0a4a2cb17e1eafc99b41e2d08cac6')
config_dict = get_default_config()
config_dict['language'] = 'ru'
mgr = owm.weather_manager()
place = input("Какой город вас интересует ?: ")
observation = mgr.weather_at_place(place)
w = observation.weather
tempetature = w.temperature('celsius')['temp']
print('В городе ' + place + ' сейчас ' + w.detailed_status + ' температура: ' + str(tempetature) + " °С")
input()