import pygame

from car import Car

class Owncar(Car):
    def __init__(self, position, measures, stats):
        image_path = "assets/owncar.jpg"
        super().__init__(position, measures, stats, image_path)

    def move(self, keys, dt, screen_width):
        if keys[pygame.K_LEFT] and self.x > 0:
            self.x -= self.speed_horizontal * dt

        if keys[pygame.K_RIGHT] and self.x + self.width < screen_width:
            self.x += self.speed_horizontal * dt

        self.hitbox.topleft = (self.x, self.y)