Splitted Drakora.pyw for Enemy.py and Player.py

Player.py - not final version, must be more function from Drakora added.
    Player - may be must control funtion included.
This commit is contained in:
Nikolya Andreychik
2021-03-27 14:26:05 -07:00
parent 5509eabb72
commit 90ffbb6e09
3 changed files with 131 additions and 118 deletions
+34
View File
@@ -0,0 +1,34 @@
import pygame
class Player(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface((50, 75))
self.image.fill((153, 151, 0))
self.rect = self.image.get_rect()
self.rect.center = (100, 400)
self.speed = 0.0
self.isJumping = False
self.isCrouching = False
self.hoverCount = 0
self.isOnFloor = False
def crouch(self):
if not self.isCrouching:
self.isCrouching = True
self.rect = self.rect.inflate(0, -25)
def standup(self):
if self.isCrouching:
self.isCrouching = False
self.rect = self.rect.inflate(0, 25)
def update(self):
if not self.speed: self.rect.y += 1
self.speed += 0.17
self.rect.y += self.speed