changed to normal version again (no dev shortcuts) #84

Merged
Spafi merged 2 commits from Spafi/game:main into Development 2024-03-12 21:51:24 +01:00
13 changed files with 1077 additions and 1049 deletions
Showing only changes of commit 64a3381eb9 - Show all commits

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 B

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

Binary file not shown.

BIN
audio/soundeffects/door.mp3 Normal file

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.

View file

@ -1,7 +1,10 @@
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',
@ -574,10 +577,15 @@ 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])
@ -585,8 +593,10 @@ 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'
@ -594,6 +604,7 @@ class MainCharacter(Fighter):
return 'wall'
elif isinstance(touches, Door):
if not touches.locked:
door_sound.play()
return f'door-{touches.target}'
else:
return True
@ -650,13 +661,22 @@ 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()
@ -881,7 +901,10 @@ 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()
@ -923,7 +946,10 @@ 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()
@ -941,7 +967,10 @@ 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()
@ -1038,7 +1067,6 @@ 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)

View file