forked from InfoProjekt/game
Compare commits
No commits in common. "64a3381eb9da0223a2573b493ed3cfed36537f70" and "a72349f7dfd232d8eda98a137b731fdcd1b6c7a3" have entirely different histories.
64a3381eb9
...
a72349f7df
13 changed files with 1049 additions and 1077 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 380 B |
Binary file not shown.
|
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
32
classes.py
32
classes.py
|
|
@ -1,10 +1,7 @@
|
|||
import pygame
|
||||
import random
|
||||
# from viecher import Skeleton, Zombie
|
||||
from pygame import mixer
|
||||
"""
|
||||
cultistattack_sound = mixer.Sound('audio/soundeffects/cultistattack.mp3')
|
||||
"""
|
||||
|
||||
pygame.font.init()
|
||||
fonts = {
|
||||
'medieval': 'medieval.ttf',
|
||||
|
|
@ -577,15 +574,10 @@ class MainCharacter(Fighter):
|
|||
self.thinks.draw(screen, self.x + 20, self.y - 100)
|
||||
|
||||
def hurt(self, damage, objects):
|
||||
hit_sound = mixer.Sound('audio/soundeffects/hitsound.mp3')
|
||||
hit_sound.set_volume(0.5)
|
||||
if not self.talking:
|
||||
hit_sound.play()
|
||||
self.health.hurt(damage)
|
||||
|
||||
def obstacle_interaction(self, objects):
|
||||
portal_sound = mixer.Sound('audio/soundeffects/portalsound.mp3')
|
||||
door_sound = mixer.Sound('audio/soundeffects/door.mp3')
|
||||
if len(objects) <= 5:
|
||||
objects.append([])
|
||||
touches = pygame.sprite.spritecollideany(self, objects[4] + objects[5])
|
||||
|
|
@ -593,10 +585,8 @@ class MainCharacter(Fighter):
|
|||
if touches.name == 'fireplace':
|
||||
self.freezing = False
|
||||
elif touches.name == 'portal' and self.level.level != 1:
|
||||
portal_sound.play()
|
||||
return 'play'
|
||||
elif touches.name == 'house' and self.level.level != 1:
|
||||
door_sound.play()
|
||||
self.x = 500
|
||||
self.y = 400
|
||||
return 'house'
|
||||
|
|
@ -604,7 +594,6 @@ class MainCharacter(Fighter):
|
|||
return 'wall'
|
||||
elif isinstance(touches, Door):
|
||||
if not touches.locked:
|
||||
door_sound.play()
|
||||
return f'door-{touches.target}'
|
||||
else:
|
||||
return True
|
||||
|
|
@ -661,22 +650,13 @@ class MainCharacter(Fighter):
|
|||
"""
|
||||
|
||||
def attack(self, obj, mouse):
|
||||
fireball_sound = mixer.Sound('audio/soundeffects/firebalhitl.mp3')
|
||||
wind_sound = mixer.Sound('audio/soundeffects/wind.mp3')
|
||||
oldmanattack_sound = mixer.Sound('audio/soundeffects/oldmanattack.mp3')
|
||||
fireball_sound.set_volume(0.2)
|
||||
wind_sound.set_volume(0.2)
|
||||
oldmanattack_sound.set_volume(0.2)
|
||||
if self.lastAttack + self.attack_speed * 1000 < pygame.time.get_ticks():
|
||||
moveto = mouse - vec(self.x, self.y)
|
||||
if self.book.current_sp == 'fireball':
|
||||
fireball_sound.play()
|
||||
weapon = Fireball('fb1', 100, self.x, self.y, moveto, 5)
|
||||
elif self.book.current_sp == 'windslash':
|
||||
wind_sound.play()
|
||||
weapon = Windslash('ws1', 100, self.x, self.y, moveto, 10)
|
||||
else:
|
||||
oldmanattack_sound.play()
|
||||
weapon = Punch('punch', 100, self.x, self.y, moveto, 1, Mobs, life_ticks=500)
|
||||
obj[3].append(weapon)
|
||||
self.lastAttack = pygame.time.get_ticks()
|
||||
|
|
@ -901,10 +881,7 @@ class Skeleton(Mobs):
|
|||
super().__init__(name, ms, sprite, x, y, health, damage, level, asp, atr, drops)
|
||||
|
||||
def attack(self, moveto, obj):
|
||||
arrow_sound = mixer.Sound('audio/soundeffects/arrowsound.mp3')
|
||||
arrow_sound.set_volume(0.3)
|
||||
if self.lastAttack + self.attack_speed * 1000 < pygame.time.get_ticks():
|
||||
arrow_sound.play()
|
||||
obj[3].append(Arrow("arrow", 200, self.x, self.y, moveto, self.damage))
|
||||
self.lastAttack = pygame.time.get_ticks()
|
||||
|
||||
|
|
@ -946,10 +923,7 @@ class Zombie(Mobs):
|
|||
|
||||
|
||||
def attack(self, moveto, obj):
|
||||
zombieattack_sound = mixer.Sound('audio/soundeffects/zombieattack.mp3')
|
||||
zombieattack_sound.set_volume(0.3)
|
||||
if self.lastAttack + self.attack_speed * 1000 < pygame.time.get_ticks():
|
||||
zombieattack_sound.play()
|
||||
obj[3].append(Punch('punch', 100, self.x, self.y, moveto, self.damage, MainCharacter))
|
||||
self.lastAttack = pygame.time.get_ticks()
|
||||
|
||||
|
|
@ -967,10 +941,7 @@ class Boss(Mobs):
|
|||
super().__init__(name, ms, sprite, x, y, health, damage, level, asp, atr, drops)
|
||||
|
||||
def attack(self, moveto, obj):
|
||||
reddyattack_sound = mixer.Sound('audio/soundeffects/reddyattack.mp3')
|
||||
reddyattack_sound.set_volume(0.8)
|
||||
if self.lastAttack + self.attack_speed * 1000 < pygame.time.get_ticks():
|
||||
reddyattack_sound.play()
|
||||
obj[3].append(RedBlob("blob", 50, self.x, self.y, moveto, self.damage))
|
||||
self.lastAttack = pygame.time.get_ticks()
|
||||
|
||||
|
|
@ -1067,6 +1038,7 @@ class Arrow(Weapons):
|
|||
self.move(objects)
|
||||
self.die(objects, MainCharacter)
|
||||
|
||||
|
||||
class Punch(Weapons):
|
||||
def __init__(self, name, ms, x, y, moveto, damage, kills, sprite = 'weapons/empty.png', life_ticks=100) -> None:
|
||||
super().__init__(name, ms, sprite, x, y, moveto, damage, life_ticks)
|
||||
|
|
|
|||
0
viecher.py
Normal file
0
viecher.py
Normal file
Loading…
Add table
Reference in a new issue