-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclass_plaer.py
54 lines (35 loc) · 1.16 KB
/
class_plaer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import pygame
from random import randint
class dinozavrik(pygame.sprite.Sprite):
def __init__(self):
super().__init__()
self.dx = 0
self.y_speed = 0
self.image = pygame.image.load("dinizavrik.png")
self.image = pygame.transform.scale(self.image, (50,50))
# self.image = pygame.Surface((50, 50))
# self.image.fill(pygame.Color("green"))
self.rect = self.image.get_rect()
self.rect.center = (50, 350)
self.per = True
def draw(self, screen):
screen.blit(self.image, self.rect)
def draw_coligion(self,screen):
pygame.draw.rect(screen, pygame.Color('red'), (self.rect), 2)
def test(self):
self.per = True
if self.per == True:
if self.y_speed < 0:
self.y_speed *= 0.7
self.rect.y += self.y_speed
self.y_speed += 1
if self.rect.y >= 450:
self.rect.y = 450
self.per = False
qwerty = pygame.key.get_pressed()
if qwerty[pygame.K_w] and self.rect.y >= 450:
self.per = True
self.y_speed = -60
if qwerty[pygame.key_e]:
return 1
return 0