sas2py/levels.py
2026-04-28 23:40:24 +02:00

691 lines
No EOL
41 KiB
Python

import random, variables
from main import pygame
from render_sprites import load_sprite, render_character
from variables import playerstrength, unlimited_slappeartext, lastclickpos, enemyreadytoattack, playerstamina
def level1(screen, sheet, font, buttonx, buttony, mouse, clicked, lastclickpos):
#print("level 1")
playbutton = pygame.surface.Surface((210, 60), pygame.SRCALPHA)
playbutton_inside = pygame.surface.Surface((200, 50), pygame.SRCALPHA)
playbutton_text = font.render("PLAY", True, (255, 255, 255))
playbutton_collision = pygame.Rect(buttonx, buttony, 210, 60)
if playbutton_collision.collidepoint(mouse.get_pos()):
playbutton_inside.fill((255, 105, 15))
if playbutton_collision.collidepoint(lastclickpos) and clicked:
variables.clicked = False
variables.level = 2
else:
playbutton_inside.fill((210, 105, 40))
playbutton_inside.blit(playbutton_text, (52, 5))
playbutton.fill((130, 50, 0))
playbutton.blit(playbutton_inside, (5, 5))
screen.blit(load_sprite(sheet, 0, 0, 160, 96, variables.screen_width, variables.screen_height), (0, 0))
screen.blit(playbutton, (buttonx, buttony))
def level2(screen, sheet, font, buttonx, buttony, mouse, clicked, lastclickpos):
#print("level 2")
playbutton = pygame.surface.Surface((210, 60), pygame.SRCALPHA)
playbutton_inside = pygame.surface.Surface((200, 50), pygame.SRCALPHA)
playbutton_text = font.render("Create a gladiator", True, (255, 255, 255))
playbutton_collision = pygame.Rect(buttonx, buttony, 210, 60)
if playbutton_collision.collidepoint(mouse.get_pos()):
playbutton_inside.fill((255, 105, 15))
if playbutton_collision.collidepoint(lastclickpos) and clicked:
variables.clicked = False
variables.level = 3
else:
playbutton_inside.fill((210, 105, 40))
playbutton_inside.blit(playbutton_text, (15, 12))
playbutton.fill((130, 50, 0))
playbutton.blit(playbutton_inside, (5, 5))
screen.blit(load_sprite(sheet, 0, 0, 160, 96, variables.screen_width, variables.screen_height), (0, 0))
screen.blit(playbutton, (buttonx, buttony))
def level3(screen, sheet, font, mouse, clicked, lastclickpos, playername, smallerfont, ticks, fps, chunkfont):
# FOR ENTER NAME SQUARE BOX
namesquare = pygame.surface.Surface((300, 70), pygame.SRCALPHA)
namesquare.fill((190, 115, 65))
namesquare_entersquare = pygame.surface.Surface((290, 35), pygame.SRCALPHA)
namesquare_entersquare_collision = pygame.Rect(85, 90, 290, 35)
namesquare_entersquare_inside = pygame.surface.Surface((286, 31), pygame.SRCALPHA)
namesquare_entersquare.fill((0, 0, 0))
namesquare_entersquare_inside.fill((190, 115, 65))
if namesquare_entersquare_collision.collidepoint(mouse.get_pos()):
namesquare_entersquare.fill((255, 255, 255))
if clicked:
namesquare_entersquare_inside.fill((255, 200, 125))
else:
if clicked:
if not namesquare_entersquare_collision.collidepoint(lastclickpos):
namesquare_entersquare_inside.fill((190, 115, 65))
else:
namesquare_entersquare_inside.fill((255, 200, 125))
namesquare_entersquare.fill((255, 255, 255))
variables.clicked = False
if namesquare_entersquare_collision.collidepoint(lastclickpos):
variables.canyoutypethename = True
namesquare_entersquare.fill((255, 255, 255))
namesquare_entersquare_inside.fill((255, 200, 125))
else:
variables.canyoutypethename = False
playernametext = smallerfont.render(str(playername), True, (0, 0, 0))
namesquare_entersquare_inside.blit(playernametext, (2, 2))
namesquare_entersquare.blit(namesquare_entersquare_inside, (2, 2))
nametext = font.render("enter name below", True, (255, 255, 255))
appearance_square = pygame.surface.Surface((300, 150), pygame.SRCALPHA)
appearance_square.fill((190, 115, 65))
textskincolor = font.render("skin color", True, (255, 255, 255))
skinleft = pygame.Rect(260, 143, 20, 20)
skinright = pygame.Rect(286, 143, 20, 20)
appearance_square.blit(load_sprite(sheet, 1913, 0, 7, 7, 20, 20), (180, 5))
appearance_square.blit(load_sprite(sheet, 1913, 7, 7, 7, 20, 20), (205, 5))
texthairstyle = font.render("hair style", True, (255, 255, 255))
hairleft = pygame.Rect(260, 188, 20, 20)
hairright = pygame.Rect(286, 188, 20, 20)
appearance_square.blit(load_sprite(sheet, 1913, 0, 7, 7, 20, 20), (180, 50))
appearance_square.blit(load_sprite(sheet, 1913, 7, 7, 7, 20, 20), (205, 50))
haircolorleft = pygame.Rect(330, 188, 10, 15)
haircolorright = pygame.Rect(350, 188, 10, 15)
appearance_square.blit(load_sprite(sheet, 1907, 14, 2, 3, 10, 15), (250, 52))
appearance_square.blit(load_sprite(sheet, 1910, 14, 2, 3, 10, 15), (270, 52))
textstubble = font.render("stubble", True, (255, 255, 255))
stubbleleft = pygame.Rect(260, 238, 20, 20)
stubbleright = pygame.Rect(286, 238, 20, 20)
appearance_square.blit(load_sprite(sheet, 1913, 0, 7, 7, 20, 20), (180, 100))
appearance_square.blit(load_sprite(sheet, 1913, 7, 7, 7, 20, 20), (205, 100))
randomisecol = pygame.Rect(353, 260, 25, 25)
appearance_square.blit(load_sprite(sheet, 1912, 17, 8, 8, 25, 25), (272, 122))
skills_square = pygame.surface.Surface((175, 225), pygame.SRCALPHA)
skills_square.fill((190, 115, 65))
textstrength = smallerfont.render("strength - "+str(variables.playerstrength), True, (255, 255, 255))
textagility = smallerfont.render("agility - "+str(variables.playeragility), True, (255, 255, 255))
textattack = smallerfont.render("attack - "+str(variables.playerattack), True, (255, 255, 255))
textdefense = smallerfont.render("defence - "+str(variables.playerdefense), True, (255, 255, 255))
textvitality = smallerfont.render("vitality - "+str(variables.playervitality), True, (255, 255, 255))
textcharisma = smallerfont.render("charisma - "+str(variables.playercharisma), True, (255, 255, 255))
textstamina = smallerfont.render("stamina - "+str(variables.playerstamina), True, (255, 255, 255))
textmagicka = smallerfont.render("magicka - "+str(variables.playermagicka), True, (255, 255, 255))
skills_square.blit(load_sprite(sheet, 1913, 0, 7, 7, 15, 15), (140, 5))
skills_square.blit(load_sprite(sheet, 1913, 7, 7, 7, 15, 15), (157, 5))
strengthdown = pygame.Rect(220, 297, 15, 15)
strengthup = pygame.Rect(237, 297, 15, 15)
skills_square.blit(load_sprite(sheet, 1913, 0, 7, 7, 15, 15), (140, 30))
skills_square.blit(load_sprite(sheet, 1913, 7, 7, 7, 15, 15), (157, 30))
agilitydown = pygame.Rect(220, 322, 15, 15)
agilityup = pygame.Rect(237, 322, 15, 15)
skills_square.blit(load_sprite(sheet, 1913, 0, 7, 7, 15, 15), (140, 55))
skills_square.blit(load_sprite(sheet, 1913, 7, 7, 7, 15, 15), (157, 55))
attackdown = pygame.Rect(220, 347, 15, 15)
attackup = pygame.Rect(237, 347, 15, 15)
skills_square.blit(load_sprite(sheet, 1913, 0, 7, 7, 15, 15), (140, 80))
skills_square.blit(load_sprite(sheet, 1913, 7, 7, 7, 15, 15), (157, 80))
defensedown = pygame.Rect(220, 372, 15, 15)
defenseup = pygame.Rect(237, 372, 15, 15)
skills_square.blit(load_sprite(sheet, 1913, 0, 7, 7, 15, 15), (140, 105))
skills_square.blit(load_sprite(sheet, 1913, 7, 7, 7, 15, 15), (157, 105))
vitalitydown = pygame.Rect(220, 397, 15, 15)
vitalityup = pygame.Rect(237, 397, 15, 15)
skills_square.blit(load_sprite(sheet, 1913, 0, 7, 7, 15, 15), (140, 130))
skills_square.blit(load_sprite(sheet, 1913, 7, 7, 7, 15, 15), (157, 130))
charismadown = pygame.Rect(220, 422, 15, 15)
charismaup = pygame.Rect(237, 422, 15, 15)
skills_square.blit(load_sprite(sheet, 1913, 0, 7, 7, 15, 15), (140, 155))
skills_square.blit(load_sprite(sheet, 1913, 7, 7, 7, 15, 15), (157, 155))
staminadown = pygame.Rect(220, 447, 15, 15)
staminaup = pygame.Rect(237, 447, 15, 15)
skills_square.blit(load_sprite(sheet, 1913, 0, 7, 7, 15, 15), (140, 180))
skills_square.blit(load_sprite(sheet, 1913, 7, 7, 7, 15, 15), (157, 180))
magickadown = pygame.Rect(220, 472, 15, 15)
magickaup = pygame.Rect(237, 472, 15, 15)
screen.blit(load_sprite(sheet, 162, 0, 160, 96, variables.screen_width, variables.screen_height), (0, 0))
screen.blit(load_sprite(sheet, 1884, 0, 10, 10, 75, 75), (variables.screen_width/10*9, variables.screen_height/11*9))
screen.blit(load_sprite(sheet, 1894, 0, 10, 10, 75, 75), (variables.screen_width/10*9, variables.screen_height/13.2*9))
backbutt = pygame.Rect(variables.screen_width/10*9, variables.screen_height/11*9, 75, 75)
continuebutt = pygame.Rect(variables.screen_width/10*9, variables.screen_height/13.2*9, 75, 75)
if skinleft.collidepoint(mouse.get_pos()):
appearance_square.blit(load_sprite(sheet, 1906, 7, 7, 7, 20, 20), (180, 5))
if clicked:
if variables.skincolor <= 1:
variables.skincolor = 3
else:
variables.skincolor -= 1
variables.clicked = False
elif skinright.collidepoint(mouse.get_pos()):
appearance_square.blit(load_sprite(sheet, 1906, 0, 7, 7, 20, 20), (205, 5))
if clicked:
if variables.skincolor >= 3:
variables.skincolor = 1
else:
variables.skincolor += 1
variables.clicked = False
elif hairleft.collidepoint(mouse.get_pos()):
appearance_square.blit(load_sprite(sheet, 1906, 7, 7, 7, 20, 20), (180, 50))
if clicked:
if variables.hairstyle <= 1:
variables.hairstyle = 5
else:
variables.hairstyle -= 1
variables.clicked = False
elif hairright.collidepoint(mouse.get_pos()):
appearance_square.blit(load_sprite(sheet, 1906, 0, 7, 7, 20, 20), (205, 50))
if clicked:
if variables.hairstyle >= 5:
variables.hairstyle = 1
else:
variables.hairstyle += 1
variables.clicked = False
elif haircolorleft.collidepoint(mouse.get_pos()):
appearance_square.blit(load_sprite(sheet, 1914, 14, 2, 3, 10, 15), (250, 52))
if clicked:
if variables.haircolor <= 1:
variables.haircolor = 4
else:
variables.haircolor -= 1
variables.clicked = False
elif haircolorright.collidepoint(mouse.get_pos()):
appearance_square.blit(load_sprite(sheet, 1917, 14, 2, 3, 10, 15), (270, 52))
if clicked:
if variables.haircolor >= 4:
variables.haircolor = 1
else:
variables.haircolor += 1
variables.clicked = False
elif stubbleleft.collidepoint(mouse.get_pos()):
appearance_square.blit(load_sprite(sheet, 1906, 7, 7, 7, 20, 20), (180, 100))
if clicked:
if variables.stubble <= 1:
variables.stubble = 6
else:
variables.stubble -= 1
variables.clicked = False
elif stubbleright.collidepoint(mouse.get_pos()):
appearance_square.blit(load_sprite(sheet, 1906, 0, 7, 7, 20, 20), (205, 100))
if clicked:
if variables.stubble >= 6:
variables.stubble = 1
else:
variables.stubble += 1
variables.clicked = False
elif randomisecol.collidepoint(mouse.get_pos()):
appearance_square.blit(load_sprite(sheet, 1904, 17, 8, 8, 25, 25), (272, 122))
if clicked:
variables.skincolor, variables.hairstyle, variables.haircolor, variables.stubble = random.randint(1, 3), random.randint(1, 5), random.randint(1, 4), random.randint(1, 6)
elif strengthdown.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 7, 7, 7, 15, 15), (140, 5))
if clicked:
if variables.playerstrength <= 1:
pass
else:
variables.playerstrength -= 1
variables.availablepoints += 1
variables.clicked = False
elif strengthup.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 0, 7, 7, 15, 15), (157, 5))
if clicked:
if variables.availablepoints <= 0:
pass
else:
variables.playerstrength += 1
variables.availablepoints -= 1
variables.clicked = False
elif agilitydown.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 7, 7, 7, 15, 15), (140, 30))
if clicked:
if variables.playeragility <= 1:
pass
else:
variables.playeragility -= 1
variables.availablepoints += 1
variables.clicked = False
elif agilityup.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 0, 7, 7, 15, 15), (157, 30))
if clicked:
if variables.availablepoints <= 0:
pass
else:
variables.playeragility += 1
variables.availablepoints -= 1
variables.clicked = False
elif attackdown.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 7, 7, 7, 15, 15), (140, 55))
if clicked:
if variables.playerattack <= 1:
pass
else:
variables.playerattack -= 1
variables.availablepoints += 1
variables.clicked = False
elif attackup.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 0, 7, 7, 15, 15), (157, 55))
if clicked:
if variables.availablepoints <= 0:
pass
else:
variables.playerattack += 1
variables.availablepoints -= 1
variables.clicked = False
elif defensedown.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 7, 7, 7, 15, 15), (140, 80))
if clicked:
if variables.playerdefense <= 1:
pass
else:
variables.playerdefense -= 1
variables.availablepoints += 1
variables.clicked = False
elif defenseup.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 0, 7, 7, 15, 15), (157, 80))
if clicked:
if variables.availablepoints <= 0:
pass
else:
variables.playerdefense += 1
variables.availablepoints -= 1
variables.clicked = False
elif vitalitydown.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 7, 7, 7, 15, 15), (140, 105))
if clicked:
if variables.playervitality <= 1:
pass
else:
variables.playervitality -= 1
variables.availablepoints += 1
variables.clicked = False
elif vitalityup.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 0, 7, 7, 15, 15), (157, 105))
if clicked:
if variables.availablepoints <= 0:
pass
else:
variables.playervitality += 1
variables.availablepoints -= 1
variables.clicked = False
elif charismadown.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 7, 7, 7, 15, 15), (140, 130))
if clicked:
if variables.playercharisma <= 1:
pass
else:
variables.playercharisma -= 1
variables.availablepoints += 1
variables.clicked = False
elif charismaup.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 0, 7, 7, 15, 15), (157, 130))
if clicked:
if variables.availablepoints <= 0:
pass
else:
variables.playercharisma += 1
variables.availablepoints -= 1
variables.clicked = False
elif staminadown.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 7, 7, 7, 15, 15), (140, 155))
if clicked:
if variables.playerstamina <= 1:
pass
else:
variables.playerstamina -= 1
variables.availablepoints += 1
variables.clicked = False
elif staminaup.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 0, 7, 7, 15, 15), (157, 155))
if clicked:
if variables.availablepoints <= 0:
pass
else:
variables.playerstamina += 1
variables.availablepoints -= 1
variables.clicked = False
elif magickadown.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 7, 7, 7, 15, 15), (140, 180))
if clicked:
if variables.playermagicka <= 1:
pass
else:
variables.playermagicka -= 1
variables.availablepoints += 1
variables.clicked = False
elif magickaup.collidepoint(mouse.get_pos()):
skills_square.blit(load_sprite(sheet, 1906, 0, 7, 7, 15, 15), (157, 180))
if clicked:
if variables.availablepoints <= 0:
pass
else:
variables.playermagicka += 1
variables.availablepoints -= 1
variables.clicked = False
elif backbutt.collidepoint(mouse.get_pos()):
screen.blit(load_sprite(sheet, 1884, 10, 10, 10, 75, 75), (variables.screen_width/10*9, variables.screen_height/11*9))
if clicked:
variables.level = 1
variables.player_reset()
variables.clicked = False
elif continuebutt.collidepoint(mouse.get_pos()):
screen.blit(load_sprite(sheet, 1894, 10, 10, 10, 75, 75), (variables.screen_width/10*9, variables.screen_height/13.2*9))
if clicked and variables.availablepoints == 0:
if variables.playername == "":
variables.playername = "Nameless"
variables.level = 4
variables.clicked = False
match variables.haircolor:
case 1:
variables.haircolormodifier = 0
case 2:
variables.haircolormodifier = 1
case 3:
variables.haircolormodifier = 2
case 4:
variables.haircolormodifier = 3
skillspoints_square = pygame.surface.Surface((118, 118), pygame.SRCALPHA)
skillspoints_square.fill((190, 115, 65))
textskillpoints = chunkfont.render(str(variables.availablepoints), True, (255, 255, 255))
textskillsinfo = font.render("skill points", True, (255, 255, 255))
skillspoints_square.blit(textskillsinfo, (10, 5))
skillspoints_square.blit(textskillpoints, (40, 40))
# ACTUALLY DISPLAYS THE SHIT
namesquare.blit(namesquare_entersquare, (5, 30))
namesquare.blit(nametext, (5, 5))
appearance_square.blit(textskincolor, (5, 5))
appearance_square.blit(texthairstyle, (5, 50))
appearance_square.blit(textstubble, (5, 100))
skills_square.blit(textstrength, (5, 5))
skills_square.blit(textagility, (5, 30))
skills_square.blit(textattack, (5, 55))
skills_square.blit(textdefense, (5, 80))
skills_square.blit(textvitality, (5, 105))
skills_square.blit(textcharisma, (5, 130))
skills_square.blit(textstamina, (5, 155))
skills_square.blit(textmagicka, (5, 180))
screen.blit(namesquare, (80, 60))
screen.blit(appearance_square, (80, 135))
screen.blit(skills_square, (80, 292))
screen.blit(skillspoints_square, (262, 292))
playertex = pygame.surface.Surface((190+variables.playerstrength, 435+variables.playerstrength), pygame.SRCALPHA)
match variables.skincolor:
case 1:
playertex.blit(load_sprite(sheet, 1901 - variables.ticksanimation * 2, 1886, 19, 34, 190+variables.playerstrength, 340+variables.playerstrength/19*34), (0,70))
case 2:
playertex.blit(load_sprite(sheet, 1901 - variables.ticksanimation * 2, 1851, 19, 34, 190+variables.playerstrength, 340+variables.playerstrength/19*34), (0,70))
case 3:
playertex.blit(load_sprite(sheet, 1901 - variables.ticksanimation * 2, 1816, 19, 34, 190+variables.playerstrength, 340+variables.playerstrength/19*34), (0,70))
match variables.hairstyle:
case 1:
pass
case 2:
playertex.blit(load_sprite(sheet, 1869, 1911 + variables.haircoloroffset * variables.haircolormodifier, 11, 9, 110, 90), (40 + variables.playerstrength/2+1, 12 + variables.ticksanimation))
case 3:
playertex.blit(load_sprite(sheet, 1857, 1911 + variables.haircoloroffset * variables.haircolormodifier, 11, 9, 110, 90), (40 + variables.playerstrength/2+1, 12 + variables.ticksanimation))
case 4:
playertex.blit(load_sprite(sheet, 1845, 1911 + variables.haircoloroffset * variables.haircolormodifier, 11, 9, 110, 90), (40 + variables.playerstrength/2+1, 12 + variables.ticksanimation))
case 5:
playertex.blit(load_sprite(sheet, 1833, 1911 + variables.haircoloroffset * variables.haircolormodifier, 11, 9, 110, 90), (40 + variables.playerstrength/2+1, 12 + variables.ticksanimation))
match variables.stubble:
case 1:
pass
case 2:
playertex.blit(load_sprite(sheet, 1821, 1916 + variables.stubbleoffset * variables.haircolormodifier, 11, 4, 110, 40), (40 + variables.playerstrength/2+1, 111 + variables.ticksanimation + variables.playerstrength/3))
case 3:
playertex.blit(load_sprite(sheet, 1809, 1916 + variables.stubbleoffset * variables.haircolormodifier, 11, 4, 110, 40), (40 + variables.playerstrength/2+1, 111 + variables.ticksanimation + variables.playerstrength/3))
case 4:
playertex.blit(load_sprite(sheet, 1797, 1916 + variables.stubbleoffset * variables.haircolormodifier, 11, 4, 110, 40), (40 + variables.playerstrength/2+1, 111 + variables.ticksanimation + variables.playerstrength/3))
case 5:
playertex.blit(load_sprite(sheet, 1785, 1916 + variables.stubbleoffset * variables.haircolormodifier, 11, 4, 110, 40), (40 + variables.playerstrength/2+1, 111 + variables.ticksanimation + variables.playerstrength/3))
case 6:
playertex.blit(load_sprite(sheet, 1773, 1916 + variables.stubbleoffset * variables.haircolormodifier, 11, 4, 110, 40), (40 + variables.playerstrength/2+1, 111 + variables.ticksanimation + variables.playerstrength/3))
screen.blit(playertex, (575, 80-variables.playerstrength/19*34))
if ticks >= fps/2:
variables.ticksanimation = 0
else:
variables.ticksanimation = 10
def level4(screen, sheet, font, mouse, clicked, lastclickpos, playername, smallerfont, ticks, fps, chunkfont, chgfont, slappeartext):
screensurface = pygame.surface.Surface((variables.screen_width, variables.screen_height), pygame.SRCALPHA)
#print(str(slappeartext)+"x"+str(variables.unlimited_slappeartext))
variables.unlimited_slappeartext += 1
if slappeartext < 255:
variables.textcolor = (slappeartext, slappeartext, slappeartext)
variables.slowly_appearing_text = variables.unlimited_slappeartext
else:
variables.textcolor = (255, 255, 255)
match variables.dialognum:
case 1:
screensurface.fill((0,0,0))
currenttext = chunkfont.render("Prologue", True, variables.textcolor)
currentsubtext = chgfont.render("Enslaved", True, variables.textcolor)
screensurface.blit(currenttext, (variables.screen_width/2-150, variables.screen_height/2-75))
screensurface.blit(currentsubtext, (variables.screen_width/2-111, variables.screen_height/2))
if slappeartext > 350:
variables.unlimited_slappeartext = 0
variables.dialognum = 2
case 2: #MISSING HAIR AND STUBBLE TOO LAZY TO FIX RN
screensurface.blit(load_sprite(sheet, 323, 0, 160, 96, variables.screen_width, variables.screen_height), (0, 0))
screensurface.blit(load_sprite(sheet, variables.hangingx, variables.getskinhangingcolory(), 33, 34, 330, 340+variables.ticksanimation/2), (variables.screen_width/2-165, variables.screen_height/2-75))
if variables.gethairstylex() != None:
screensurface.blit(load_sprite(sheet, variables.gethairstylex(), 1911 + variables.haircoloroffset * variables.haircolormodifier, 11, 9, 105,85), (447, 167.5+variables.ticksanimation/10))
if variables.getstubblex() != None:
screensurface.blit(load_sprite(sheet, variables.getstubblex(), 1916 + variables.stubbleoffset * variables.haircolormodifier, 11, 4, 110,40), (445, 265+variables.ticksanimation/9.9))
dialogsquare = pygame.surface.Surface((variables.screen_width/25*23, variables.screen_height/5), pygame.SRCALPHA)
dialogsquare.fill((190, 115, 65))
if slappeartext > 600:
variables.unlimited_slappeartext = 0
variables.dialognum = 3
if variables.playername != "Nameless":
dialogue = font.render(str(variables.playername)+"..."+str(variables.playername)+".... yes... that was your name.", True, (190-int(variables.slowly_appearing_text/3*2), 115-int(variables.slowly_appearing_text/3), 65-int(variables.slowly_appearing_text/4)))
dialogue2 = font.render("But it seems an eternity since anyone has called you that.", True, (190-int(variables.slowly_appearing_text/3*2), 115-int(variables.slowly_appearing_text/3), 65-int(variables.slowly_appearing_text/4)))
dialogsquare.blit(dialogue, (315 - len(variables.playername) * 9, 30))
else:
dialogue = font.render("Once... you had a name of your own.", True, (190 - int(variables.slowly_appearing_text / 3 * 2), 115 - int(variables.slowly_appearing_text / 3), 65 - int(variables.slowly_appearing_text / 4)))
dialogue2 = font.render("But it seems an eternity since anyone has called you it.", True, (190-int(variables.slowly_appearing_text/3*2), 115-int(variables.slowly_appearing_text/3), 65-int(variables.slowly_appearing_text/4)))
dialogsquare.blit(dialogue, (300, 30))
dialogsquare.blit(dialogue2, (200, 70))
screensurface.blit(dialogsquare, (variables.screen_width/25, variables.screen_height/25))
case 3:
screensurface.blit(load_sprite(sheet, 323, 0, 160, 96, variables.screen_width, variables.screen_height), (0, 0))
#screensurface.blit(load_sprite(sheet, 1901, variables.getskincolory(), 19, 34, 510, 920), (variables.screen_width/2-253, variables.screen_height/3))
screensurface.blit(render_character(sheet, variables.skincolor, variables.hairstyle, variables.stubble, variables.haircolor, variables.playerstrength, 380, 680), (variables.screen_width/2-190, 150-variables.ticksanimation*2))
dialogsquare = pygame.surface.Surface((variables.screen_width/25*23, variables.screen_height/5), pygame.SRCALPHA)
dialogsquare.fill((190, 115, 65))
dialogue = font.render("And so, in a frenzy of blood and with the stench of fear, your days as a gladiator begin.", True, (190-int(variables.slowly_appearing_text/3*2), 115-int(variables.slowly_appearing_text/3), 65-int(variables.slowly_appearing_text/4)))
dialogsquare.blit(dialogue, (45, 45))
if slappeartext > 600:
variables.unlimited_slappeartext = 0
variables.dialognum = 4
#if variables.gethairstylex() != None:
# screensurface.blit(load_sprite(sheet, variables.gethairstylex(), 1911 + variables.haircoloroffset * variables.haircolormodifier, 11, 9, 294,247), (355, 35))
#if variables.getstubblex() != None:
# screensurface.blit(load_sprite(sheet, variables.getstubblex(), 1916 + variables.stubbleoffset * variables.haircolormodifier, 11, 4, 300,110), (352, 308))
screensurface.blit(dialogsquare, (variables.screen_width/25, variables.screen_height/25))
case 4:
screensurface.blit(load_sprite(sheet, 643, 0, 160, 96, variables.screen_width, variables.screen_height), (0, 0))
screensurface.blit(render_character(sheet, variables.skincolor, variables.hairstyle, variables.stubble, variables.haircolor, variables.playerstrength, 190, 340), (100, variables.screen_height-420-variables.playerstrength/340*420))
screensurface.blit(render_character(sheet, 1, 5, 6, 5, 1, 190, 340), (variables.screen_width/1.55, variables.screen_height-420-variables.playerstrength/340*420))
name1 = chgfont.render(variables.playername, True, (255,255,0))
name2 = chgfont.render("Fearful Prisoner", True, (255,255,0))
level1_1 = font.render("Level 1", True, (255,255,255))
level1_2 = font.render("Level 1", True, (255,255,255))
versusdialog = font.render("Live from the Dungeon", True, (255,255,255))
screensurface.blit(name1, (50, 50))
screensurface.blit(level1_1, (50, 100))
screensurface.blit(name2, (variables.screen_width-450, 50))
screensurface.blit(level1_2, (variables.screen_width-125, 100))
screensurface.blit(load_sprite(sheet, 483, 0, 160, 96, variables.screen_width, variables.screen_height), (0, 0))
screensurface.blit(versusdialog, (variables.screen_width/2-85, 390))
screensurface.blit(load_sprite(sheet, 1894, 0, 10, 10, 100, 100), (variables.screen_width/2-35, variables.screen_height/2-18))
continuebutt = pygame.Rect(variables.screen_width/2-35, variables.screen_height/2-18, 100, 100)
if continuebutt.collidepoint(pygame.mouse.get_pos()):
screensurface.blit(load_sprite(sheet, 1894, 10, 10, 10, 100, 100), (variables.screen_width/2-35, variables.screen_height/2-18))
if continuebutt.collidepoint(lastclickpos):
variables.player_active = True
variables.level = 5
variables.playermana = 10 + variables.playerstamina * 20 # this is the players mana, calculated from stamina
variables.playerhealth = 10 + variables.playervitality * 20 # this is the players health, calculated from vitality
# OK so this is basically the animation for the character.
if ticks >= fps/2:
variables.ticksanimation = 0
else:
variables.ticksanimation = 10
screen.blit(screensurface, (0, 0))
def level5(screen, sheet, font, mouse, clicked, lastclickpos, playername, smallerfont, ticks, fps, chunkfont, chgfont, slappeartext):
enemyrect = pygame.Rect(variables.enemyX, variables.enemyY, 95, 170)
playerrect = pygame.Rect(variables.playerX, variables.playerY, 95, 170)
screensurface = pygame.surface.Surface((variables.screen_width, variables.screen_height), pygame.SRCALPHA)
screensurface.blit(load_sprite(sheet, 803, 0, 160, 96, variables.screen_width, variables.screen_height), (0, 0))
if not variables.enemyreadytoattack:
screensurface.blit(render_character(sheet, 1, 5, 6, 5, 1, 95, 170), (variables.enemyX, variables.enemyY))
if variables.playerhealth < 0:
variables.playerhealth = 0
if variables.enemyhealth < 0:
variables.enemyhealth = 0
if variables.playerhealth >= variables.playervitality*20+10:
screensurface.blit(load_sprite(sheet, 1913, 49, 7, 8, 96, 110), (30, 30))
elif (variables.playervitality * 20 + 10) > variables.playerhealth >= (variables.playervitality * 20 + 10)/5:
screensurface.blit(load_sprite(sheet, 1913, 57, 7, 8, 96, 110), (30, 30))
elif 0 < variables.playerhealth < (variables.playervitality*20+10)/5:
screensurface.blit(load_sprite(sheet, 1913, 65, 7, 8, 96, 110), (30, 30))
else:
screensurface.blit(load_sprite(sheet, 1913, 73, 7, 8, 96, 110), (30, 30))
if variables.playermana >= variables.playerstamina*20+10:
screensurface.blit(load_sprite(sheet, 1906, 49, 7, 8, 96, 110), (160, 30))
elif (variables.playerstamina * 20 + 10) > variables.playermana >= (variables.playerstamina * 20 + 10)/5:
screensurface.blit(load_sprite(sheet, 1906, 57, 7, 8, 96, 110), (160, 30))
elif 0 < variables.playermana < (variables.playerstamina*20+10)/5:
screensurface.blit(load_sprite(sheet, 1906, 65, 7, 8, 96, 110), (160, 30))
else:
screensurface.blit(load_sprite(sheet, 1906, 73, 7, 8, 96, 110), (160, 30))
if variables.enemyhealth >= 10:
screensurface.blit(load_sprite(sheet, 1913, 49, 7, 8, 96, 110), (variables.screen_width-30-96, 30))
elif 10 > variables.enemyhealth >= 3:
screensurface.blit(load_sprite(sheet, 1913, 57, 7, 8, 96, 110), (variables.screen_width-30-96, 30))
elif 0 < variables.enemyhealth < 3:
screensurface.blit(load_sprite(sheet, 1913, 65, 7, 8, 96, 110), (variables.screen_width-30-96, 30))
else:
screensurface.blit(load_sprite(sheet, 1913, 73, 7, 8, 96, 110), (variables.screen_width-30-96, 30))
if variables.enemymana >= 100:
screensurface.blit(load_sprite(sheet, 1906, 49, 7, 8, 96, 110), (variables.screen_width-160-96, 30))
elif 100 > variables.enemymana >= 30:
screensurface.blit(load_sprite(sheet, 1906, 57, 7, 8, 96, 110), (variables.screen_width-160-96, 30))
elif 0 < variables.enemymana < 30:
screensurface.blit(load_sprite(sheet, 1906, 65, 7, 8, 96, 110), (variables.screen_width-160-96, 30))
else:
screensurface.blit(load_sprite(sheet, 1906, 73, 7, 8, 96, 110), (variables.screen_width-160-96, 30))
playerhealthtext = font.render("HP="+str(variables.playerhealth)+"/"+str((10+variables.playervitality*20)), True, (255, 255, 255))
playermanatext = font.render("ST="+str(variables.playermana)+"/"+str((90+variables.playerstamina*20)), True, (255, 255, 255))
screensurface.blit(playerhealthtext, (32, 140))
screensurface.blit(playermanatext, (162, 140))
enemyhealthtext = font.render("HP=" + str(variables.enemyhealth) + "/" + str((10)), True, (255, 255, 255))
enemymanatext = font.render("ST=" + str(variables.enemymana) + "/" + str((90 + 1 * 20)),True, (255, 255, 255))
screensurface.blit(enemyhealthtext, (variables.screen_width-32-96, 140))
screensurface.blit(enemymanatext, (variables.screen_width-162-96, 140))
if variables.blocked0:
variables.slowly_appearing_text += 1
if variables.slowly_appearing_text < 100:
screensurface.blit(font.render("blocked", True, (255, 255, 255)), (variables.enemyX+20, variables.enemyY - 10))
else:
variables.blocked0 = False
if variables.whoseturn:
screensurface.blit(render_character(sheet, variables.skincolor, variables.hairstyle, variables.stubble, variables.haircolor, variables.playerstrength, 95, 170), (variables.playerX, variables.playerY))
screensurface.blit(load_sprite(sheet, 1894, 21, 10, 10, 40, 40),(variables.playerX+130, variables.playerY+80))
screensurface.blit(load_sprite(sheet, 1884, 21, 10, 10, 40, 40),(variables.playerX+115, variables.playerY+35))
screensurface.blit(load_sprite(sheet, 1874, 21, 10, 10, 40, 40),(variables.playerX+100, variables.playerY-10))
screensurface.blit(load_sprite(sheet, 1844, 21, 10, 10, 40, 40), (variables.playerX+65, variables.playerY-45))
screensurface.blit(load_sprite(sheet, 1854, 21, 10, 10, 40, 40), (variables.playerX+22, variables.playerY-45))
screensurface.blit(load_sprite(sheet, 1864, 21, 10, 10, 40, 40), (variables.playerX-21, variables.playerY-45))
fight = pygame.Rect(variables.playerX+130, variables.playerY+80, 40, 40)
goright = pygame.Rect(variables.playerX+115, variables.playerY+35, 40, 40)
jumpright = pygame.Rect(variables.playerX+100, variables.playerY-10, 40, 40)
scream = pygame.Rect(variables.playerX+65, variables.playerY-45, 40, 40)
goleft = pygame.Rect(variables.playerX+22, variables.playerY-45, 40, 40)
jumpleft = pygame.Rect(variables.playerX-21, variables.playerY-45, 40, 40)
if fight.collidepoint(pygame.mouse.get_pos()):
screensurface.blit(load_sprite(sheet, 1894, 31, 10, 10, 40, 40), (variables.playerX+130, variables.playerY+80))
if fight.collidepoint(lastclickpos) and clicked:
variables.lastplayerX = variables.playerX
variables.fightingright = True
variables.whoseturn = 0
clicked = False
elif goright.collidepoint(pygame.mouse.get_pos()):
screensurface.blit(load_sprite(sheet, 1884, 31, 10, 10, 40, 40), (variables.playerX+115, variables.playerY+35))
if goright.collidepoint(lastclickpos) and clicked:
variables.lastplayerX = variables.playerX
variables.walkingright = True
variables.whoseturn = 0
clicked = False
elif jumpright.collidepoint(pygame.mouse.get_pos()):
screensurface.blit(load_sprite(sheet, 1874, 31, 10, 10, 40, 40), (variables.playerX+100, variables.playerY-10))
if jumpright.collidepoint(lastclickpos):
print("yo")
elif scream.collidepoint(pygame.mouse.get_pos()):
screensurface.blit(load_sprite(sheet, 1844, 31, 10, 10, 40, 40), (variables.playerX+65, variables.playerY-45))
if scream.collidepoint(lastclickpos):
print("yo")
elif goleft.collidepoint(pygame.mouse.get_pos()):
screensurface.blit(load_sprite(sheet, 1854, 31, 10, 10, 40, 40), (variables.playerX+22, variables.playerY-45))
if goleft.collidepoint(lastclickpos):
print("yo")
elif jumpleft.collidepoint(pygame.mouse.get_pos()):
screensurface.blit(load_sprite(sheet, 1864, 31, 10, 10, 40, 40), (variables.playerX-21, variables.playerY-45))
if jumpleft.collidepoint(lastclickpos):
print("yo")
if not variables.whoseturn and variables.enemyreadytoattack:
screensurface.blit(render_character(sheet, variables.skincolor, variables.hairstyle, variables.stubble, variables.haircolor,variables.playerstrength, 95, 170), (variables.playerX, variables.playerY))
match variables.enemyattack:
case _:
if variables.enemychoosing:
variables.lastenemyX = variables.enemyX
variables.enemychoosing = False
elif variables.enemyX > variables.lastenemyX-1 * 3 - 100 and variables.enemyX-variables.playerX>100: # WALKING RIGHT FUNCTION
variables.enemyX -= 2
else:
variables.enemyreadytoattack = False
variables.whoseturn = 1
screensurface.blit(render_character(sheet, 1, 5, 6, 5, 1, 95, 170, "leftwalk"),(variables.enemyX, variables.enemyY))
#case 2:
# print()
#
# case _:
# print()
if variables.playerX <= variables.lastplayerX+variables.playeragility*3+100 and variables.walkingright and variables.enemyX-variables.playerX>100: # WALKING RIGHT FUNCTION
variables.playerX += 3.5
screensurface.blit(render_character(sheet, variables.skincolor, variables.hairstyle, variables.stubble, variables.haircolor,variables.playerstrength, 95, 170, "rightwalk"), (variables.playerX, variables.playerY))
if variables.playerX <= variables.lastplayerX+variables.playeragility*3+100 and variables.fightingright: # WALKING RIGHT FUNCTION
screensurface.blit(render_character(sheet, variables.skincolor, variables.hairstyle, variables.stubble, variables.haircolor,variables.playerstrength, 95, 170, "rightattack"), (variables.playerX, variables.playerY+50))
if not playerrect.colliderect(enemyrect) and variables.enemyX-variables.playerX>100:
variables.playerX += 2
else:
if random.randint(1, 100) <= 55+variables.playerattack*3:
variables.enemyhealth -= random.randint(1, 8+variables.playerstrength*2)
screensurface.blit(font.render("ST=" + str(variables.enemymana) + "/" + str((90 + 1 * 20)), True, (255, 255, 255)),(variables.screen_width - 162 - 96, 140))
else:
variables.blocked0 = True
variables.slowly_appearing_text = 0
variables.whoseturn = 0
variables.enemyattack = random.randint(1, 4)
variables.enemyreadytoattack = True
variables.enemychoosing = True
variables.walkingright = False
variables.fightingright = False
variables.clicked = False
elif (variables.walkingright or variables.fightingright):
if variables.playerX >= variables.lastplayerX+variables.playeragility*3+100 or not variables.enemyX-variables.playerX>100:
print("READY")
variables.whoseturn = 0
variables.enemyattack = random.randint(1,4)
variables.enemyreadytoattack = True
variables.enemychoosing = True
variables.walkingright = False
variables.fightingright = False
variables.clicked = False
if ticks >= fps / 2:
variables.ticksanimation = 0
else:
variables.ticksanimation = 10
screen.blit(screensurface, (0, 0))