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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user