import pygame
import random
import modules.rect as rect


class Player(rect.Rect):

    def __init__(self, x, y, spriteFile, displayWidth, displayHeight):
        self.sprite = pygame.image.load(spriteFile)
        self.x = x
        self.y = y
        self.height = self.sprite.get_height()
        self.width = self.sprite.get_width()
        self.displayWidth = displayWidth
        self.displayHeight = displayHeight
        self.speedIncrease = 6
        self.xSpeed = 0
        self.ySpeed = 0
        self.up = False
        self.down = False

    def update(self):
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                quit()
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_UP and self.up == False:
                    self.ySpeed += -self.speedIncrease
                    self.up = True
                elif event.key == pygame.K_DOWN and self.down == False:
                    self.ySpeed += self.speedIncrease
                    self.down = True
            if event.type == pygame.KEYUP:
                if event.key == pygame.K_UP:
                    self.ySpeed += self.speedIncrease
                    self.up = False
                elif event.key == pygame.K_DOWN:
                    self.ySpeed += -self.speedIncrease
                    self.down = False
        if self.y + self.ySpeed > self.displayHeight - self.height:
            self.y = self.displayHeight - self.height
        elif self.y + self.ySpeed < 0:
            self.y = 0
        else:
            self.y += self.ySpeed

f3fa2b78c4b94976b85e3c0235474459e13713f5
<mask token>


class Player(rect.Rect):
    <mask token>
    <mask token>

<mask token>


class Player(rect.Rect):

    def __init__(self, x, y, spriteFile, displayWidth, displayHeight):
        self.sprite = pygame.image.load(spriteFile)
        self.x = x
        self.y = y
        self.height = self.sprite.get_height()
        self.width = self.sprite.get_width()
        self.displayWidth = displayWidth
        self.displayHeight = displayHeight
        self.speedIncrease = 6
        self.xSpeed = 0
        self.ySpeed = 0
        self.up = False
        self.down = False
    <mask token>

<mask token>


class Player(rect.Rect):

    def __init__(self, x, y, spriteFile, displayWidth, displayHeight):
        self.sprite = pygame.image.load(spriteFile)
        self.x = x
        self.y = y
        self.height = self.sprite.get_height()
        self.width = self.sprite.get_width()
        self.displayWidth = displayWidth
        self.displayHeight = displayHeight
        self.speedIncrease = 6
        self.xSpeed = 0
        self.ySpeed = 0
        self.up = False
        self.down = False

    def update(self):
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                quit()
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_UP and self.up == False:
                    self.ySpeed += -self.speedIncrease
                    self.up = True
                elif event.key == pygame.K_DOWN and self.down == False:
                    self.ySpeed += self.speedIncrease
                    self.down = True
            if event.type == pygame.KEYUP:
                if event.key == pygame.K_UP:
                    self.ySpeed += self.speedIncrease
                    self.up = False
                elif event.key == pygame.K_DOWN:
                    self.ySpeed += -self.speedIncrease
                    self.down = False
        if self.y + self.ySpeed > self.displayHeight - self.height:
            self.y = self.displayHeight - self.height
        elif self.y + self.ySpeed < 0:
            self.y = 0
        else:
            self.y += self.ySpeed

import pygame
import random
import modules.rect as rect


class Player(rect.Rect):

    def __init__(self, x, y, spriteFile, displayWidth, displayHeight):
        self.sprite = pygame.image.load(spriteFile)
        self.x = x
        self.y = y
        self.height = self.sprite.get_height()
        self.width = self.sprite.get_width()
        self.displayWidth = displayWidth
        self.displayHeight = displayHeight
        self.speedIncrease = 6
        self.xSpeed = 0
        self.ySpeed = 0
        self.up = False
        self.down = False

    def update(self):
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                quit()
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_UP and self.up == False:
                    self.ySpeed += -self.speedIncrease
                    self.up = True
                elif event.key == pygame.K_DOWN and self.down == False:
                    self.ySpeed += self.speedIncrease
                    self.down = True
            if event.type == pygame.KEYUP:
                if event.key == pygame.K_UP:
                    self.ySpeed += self.speedIncrease
                    self.up = False
                elif event.key == pygame.K_DOWN:
                    self.ySpeed += -self.speedIncrease
                    self.down = False
        if self.y + self.ySpeed > self.displayHeight - self.height:
            self.y = self.displayHeight - self.height
        elif self.y + self.ySpeed < 0:
            self.y = 0
        else:
            self.y += self.ySpeed
