2 Commits

Author SHA1 Message Date
  Jørn Guldberg 4e3468a6c3 Merge 11 months ago
  Jørn Guldberg 6c8780a832 Updates 11 months ago
13 changed files with 46 additions and 11 deletions
Split View
  1. +46
    -11
      julespil/game.py
  2. BIN
      julespil/graphics/jule hus.png
  3. BIN
      julespil/graphics/sne bold der måske er god.png
  4. BIN
      julespil/graphics/sne mand1.png
  5. BIN
      julespil/graphics/sne mand10.png
  6. BIN
      julespil/graphics/sne mand2.png
  7. BIN
      julespil/graphics/sne mand3.png
  8. BIN
      julespil/graphics/sne mand4.png
  9. BIN
      julespil/graphics/sne mand5.png
  10. BIN
      julespil/graphics/sne mand6.png
  11. BIN
      julespil/graphics/sne mand7.png
  12. BIN
      julespil/graphics/sne mand8.png
  13. BIN
      julespil/graphics/sne mand9.png

+ 46
- 11
julespil/game.py View File

@ -229,14 +229,53 @@ class Snowball(pygame.sprite.Sprite):
self.rect = self.image.get_rect()
self.rect.center=(x, y)
def move(self, player):
self.rect.move_ip(4,0)
def move(self, snowball_list, enemy_list):
target_enemy = None
for enemy in enemy_list:
if enemy.alive == 1:
target_enemy = enemy
break
if enemy == None:
return
enemy_x = enemy.rect.x
enemy_y = enemy.rect.y
snowball_x = self.rect.x
snowball_y = self.rect.y
if abs(enemy_x - snowball_x) < 8 and abs(enemy_y - snowball_y) < 8:
snowball_list.remove(self)
enemy.damage(50)
delta_move_x = 0
delta_move_y = 0
if enemy_x < snowball_x:
delta_move_x = -4
elif enemy_x > snowball_x:
delta_move_x = 4
if enemy_y < snowball_y:
delta_move_y = -4
elif enemy_y > snowball_y:
delta_move_y = 4
self.rect.move_ip(delta_move_x, delta_move_y)
#if (self.rect.right > 600):
# self.rect.top = 0
# self.rect.center = (0, 400)
# if self.rect.colliderect(player.rect):
# print("HIT")
#if self.rect.colliderect(player.rect):
# print("HIT")
def draw(self, surface):
surface.blit(self.image, self.rect)
@ -417,14 +456,10 @@ def start_new_level(count, health):
def valid_space(new_tower):
global snowman_list
global cakeman_list
global reindeer_list
combined_tower_list = snowman_list + cakeman_list
combined_tower_list = snowman_list + cakeman_list + reindeer_list
for old_tower in combined_tower_list:
print("new: ")
print(new_tower.rect)
print("old: ")
print(old_tower.rect)
if new_tower.rect.colliderect(old_tower.rect):
return False
@ -619,7 +654,7 @@ while True:
kagemand_animation_step = (kagemand_animation_step + 1) % 8
for snowball in snowball_list:
snowball.move(menu_snowman)
snowball.move(snowball_list, enemy_list)
snowball.draw(DISPLAYSURF)
for laser_beam in laser_beam_list:

BIN
julespil/graphics/jule hus.png View File

Before After
Width: 1039  |  Height: 607  |  Size: 74 KiB

BIN
julespil/graphics/sne bold der måske er god.png View File

Before After
Width: 1039  |  Height: 607  |  Size: 18 KiB

BIN
julespil/graphics/sne mand1.png View File

Before After
Width: 1039  |  Height: 607  |  Size: 34 KiB

BIN
julespil/graphics/sne mand10.png View File

Before After
Width: 1039  |  Height: 607  |  Size: 36 KiB

BIN
julespil/graphics/sne mand2.png View File

Before After
Width: 1039  |  Height: 607  |  Size: 34 KiB

BIN
julespil/graphics/sne mand3.png View File

Before After
Width: 1039  |  Height: 607  |  Size: 34 KiB

BIN
julespil/graphics/sne mand4.png View File

Before After
Width: 1039  |  Height: 607  |  Size: 34 KiB

BIN
julespil/graphics/sne mand5.png View File

Before After
Width: 1039  |  Height: 607  |  Size: 34 KiB

BIN
julespil/graphics/sne mand6.png View File

Before After
Width: 1039  |  Height: 607  |  Size: 34 KiB

BIN
julespil/graphics/sne mand7.png View File

Before After
Width: 1039  |  Height: 607  |  Size: 34 KiB

BIN
julespil/graphics/sne mand8.png View File

Before After
Width: 1039  |  Height: 607  |  Size: 34 KiB

BIN
julespil/graphics/sne mand9.png View File

Before After
Width: 1039  |  Height: 607  |  Size: 34 KiB

Loading…
Cancel
Save