This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We use the alpine as base image | |
FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine-amd64 | |
# Create a group and user | |
RUN addgroup --gid 1000 -S app && adduser --uid 1000 -S app -G app | |
# Create the work dir and set permissions as WORKDIR set the permissions as root | |
RUN mkdir /home/app/net && chown -R app:app /home/app/net | |
WORKDIR /home/app/net |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_rotation(self, previous_point, current_point): | |
dx = current_point.xpos - previous_point.xpos | |
dy = current_point.ypos - previous_point.ypos | |
return math.degrees(math.atan2(dx, dy)) + 180 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def enemy_shoots(self): | |
nr_of_enemies = len(self.all_enemies) | |
if nr_of_enemies > 0: | |
enemy_index = random.randint(0, nr_of_enemies - 1) | |
start_rocket = None | |
for index, enemy in enumerate(self.all_enemies): | |
if index == enemy_index: | |
start_rocket = enemy.rect.center | |
if start_rocket[1] < 400: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StarField(): | |
def __init__(self): | |
self.star_field_slow = self.create_stars(50) | |
self.star_field_medium = self.create_stars(35) | |
self.star_field_fast = self.create_stars(30) | |
def create_stars(self, number_of_stars): | |
stars = [] | |
for _ in range(number_of_stars): | |
star_loc_x = random.randrange(0, constants.SCREEN_WIDTH) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ControlHandlerMover(): | |
def __init__(self, | |
control_point_quartet_collection: ControlPointQuartetCollection, | |
path_point_selector: PathPointSelector): | |
self.control_point_quartet_collection = control_point_quartet_collection | |
self.path_point_selector = path_point_selector | |
def move_control_handler(self, control_point_handler: ControlPointHandler, x: int, y: int): | |
dx = self.control_point_quartet_collection.get_control_point(control_point_handler).x - x | |
dy = self.control_point_quartet_collection.get_control_point(control_point_handler).y - y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PathPointCalculator(): | |
@staticmethod | |
def calculate_path_point(control_point_quartet: ControlPointQuartet, | |
time_to_calculate: float): | |
time: float = time_to_calculate - int(time_to_calculate) | |
cx: float = 3.0 * (control_point_quartet.get_point(1).x - | |
control_point_quartet.get_point(0).x) | |
cy: float = 3.0 * (control_point_quartet.get_point(1).y - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ControlPointCollectionFactory(): | |
@staticmethod | |
def create_collection1(): | |
control_point_quartet_collection = ControlPointQuartetCollection() | |
control_point_quartet_collection.add(ControlPointQuartet( | |
513, -15, | |
700, 151, | |
888, 650, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
result = pygame.sprite.groupcollide(self.all_rockets, self.all_enemies, True, True) | |
if result: | |
for key in result: | |
self.score += 120 | |
if self.score > self.high_score: | |
self.high_score = self.score | |
self.all_sprites.add(Explosion(self.explosion_sprites, key.rect[0], key.rect[1])) | |
self.kill_sound.play() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def shoot_rocket(self): | |
rocket = Rocket(self.sprites, 0, -15) | |
rocket.rect.centerx = self.player.rect.centerx | |
self.all_rockets.add(rocket) | |
self.all_sprites.add(rocket) | |
self.shoot_sound.play() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player(pygame.sprite.Sprite): | |
def __init__(self, sprites): | |
super(Player, self).__init__() | |
self.timer = 0 | |
self.interval = 2 | |
self.number_of_images = 6 | |
self.images = sprites.load_strip([0, 130, 48, 45], self.number_of_images, -1) | |
self.surf = self.images[0] | |
self.rect = self.surf.get_rect(center=(constants.SCREEN_WIDTH / 2, constants.SCREEN_HEIGHT - 40)) | |
self.image_index = 0 |