Some cleanup

This commit is contained in:
Christian
2024-08-24 12:03:24 +02:00
parent 31a695f099
commit 923f476303
3 changed files with 44 additions and 36 deletions

54
test.py
View File

@@ -113,32 +113,13 @@ while(gamestate):
player2.move("right")
#print("rechts")
#image = screen.blit(testimage, (pos_x, pos_y))
mouse_pos = pygame.mouse.get_pos()
#print(int(pygame.time.get_ticks()/1000))
#print(mouse_pos)
#print(image.topleft) #Gibt die Position einen Surfaces "obenlinks" aus
#print(image.size) #Gibt die Größe eines Surfaces aus
#max = tuple(map(lambda i, j : i+j, image.topleft, image.size))
#Wenn Mausposition X-Achse innerhalb Anfangsposition+Breite
#if(mouse_pos[0] <= max[0] and mouse_pos[0] >= image.topleft[0]):
#Wenn Mausposition Y-Achse innerhalb Anfangsposition+Höhe
#if(mouse_pos[1] <= max[1] and mouse_pos[1] >= image.topleft[1]):
#print("Treffer")
#pos_x = mouse_pos[0]
#pos_y = mouse_pos[1]
game.run(screen)
healthbar1.update(player1.get_health())
healthbar1.render(screen)
player1.firecontrol(screen)
player2.firecontrol(screen)
game.item_handler(screen)
#print("Spieler1 Lifes: ", player1.lifes)
#print("Spieler2 Lifes: ", player2.lifes)
#TODO If Playerposition are on the same x-axis then gamble hit by 50% chance
for projectiles in GameObject.Projectile.shots:
@@ -201,14 +182,8 @@ while(gamestate):
seconds = milliseconds / 1000
now = time.time_ns()
#print("Playerkills 1:", player1.kills)
#print("Playerkills 2:", player2.kills)
#print(F"Player 1 Health: {player1.get_health()}")
#print(F"Player 2 Health: {player2.get_health()}")
player1.render(screen)
player2.render(screen)
#print(int(seconds), "\r")
rand = random.randint(0, 100)
for enemy in spawned_enemys:
@@ -241,4 +216,27 @@ while(gamestate):
#if(mouse_pos <= (image.topleft+image.size) and mouse_pos >= image.topleft):
# print("HIIIIITTT!!!!")
clock.tick(60)
pygame.display.flip()
pygame.display.flip()
#image = screen.blit(testimage, (pos_x, pos_y))
#mouse_pos = pygame.mouse.get_pos()
#print(int(pygame.time.get_ticks()/1000))
#print(mouse_pos)
#print(image.topleft) #Gibt die Position einen Surfaces "obenlinks" aus
#print(image.size) #Gibt die Größe eines Surfaces aus
#max = tuple(map(lambda i, j : i+j, image.topleft, image.size))
#Wenn Mausposition X-Achse innerhalb Anfangsposition+Breite
#if(mouse_pos[0] <= max[0] and mouse_pos[0] >= image.topleft[0]):
#Wenn Mausposition Y-Achse innerhalb Anfangsposition+Höhe
#if(mouse_pos[1] <= max[1] and mouse_pos[1] >= image.topleft[1]):
#print("Treffer")
#pos_x = mouse_pos[0]
#pos_y = mouse_pos[1]