Compare commits

..

No commits in common. "c5cc9e6accb6ceafffe3e2eb530641fc893437b3" and "1eb858bc3087b7d6dab0f5b3cb25be4ec29c29bd" have entirely different histories.

71 changed files with 22 additions and 467 deletions

BIN
.idea/InfoProjekt.xlsx generated

Binary file not shown.

44
.idea/ideas.txt generated
View file

@ -1,44 +0,0 @@
Anmerkungen in Klammern
? - unsicher
name? - Name noch unklar, bzw. steht zur Diskussion
! - festgelegt / Einigung
Game:
Rogue-like Game mit Story
Pixel
viele Gegner:
Skelette Schwert
Zombies Knüppel
Ratten -
Kröten(?) -
Gläubige(?) Bogen / Schwert
Story:
Theme
mittelalterlich(?)
fairy-tale-like(?)
medieval(!)
Homeless guy in Berlin (oder so) im Winter in einer Stadtbibliothek, weil warm und Shelter.
er hasst eigentlich Bücher, aber aus Langeweile durchstöbert er die Bibo
findet cool aussehendes antikes/magisches Buch, nimmt es aus dem Regal, blättert es auf und wird ohnmächtig
-> Erwacht als magische Person in magischer Welt wieder
Buch dient als Skillbaum (verschiedene Kapitel)
Kampfmagier (name?)
Heilender Magier -> Priester(name?)
Elementmagier(?)
Hexenkraft / Hexenwerke / Hexenmagie / Flüche (?)
Kampf
Faust
Zauberstab - range und strength von Skills und Level(?) abhängig
NPCS
Priester / Mönch (eher Mönch)
Henker
armer Bauer
"Hexe"
Ziel(e)
-> Zurückkommen
-> Happy werden (?)

53
READ.ME
View file

@ -1,53 +0,0 @@
Brief Explanation of all files and classes and pygame
Button CLass:
Button(position_x, position_y, width, height, font key phrase/word (see dictionary), the function which should be executed, and if the function should be executed while holding the button or only once per press)
fonts = {
'medieval': 'medieval.ttf',
'minecraft': 'Minecraft Evenings.otf',
'3dpixel': '3D-Pixel.ttf',
'8bit': '8bitlim.ttf',
'8bito': '8blimro.ttf',
'arcade': 'ARCADECLASSIC.ttf',
'modern_game': 'astron boy video.otf',
'modern': 'astron boy.otf',
'wonder': 'Beyond Wonderland.ttf',
'curved': 'Digitag.ttf',
'simple': 'DisposableDroidBB.ttf',
'rounded': 'dpcomic.ttf',
'playfull': 'Endalian Script.ttf',
'blocky': 'FREAKSOFNATURE.ttf',
'catchy': 'Future TimeSplitters.otf',
'simple_wide': 'Halo3.ttf',
'simple_fat': 'INVASION2000.ttf',
'very_gamy': 'ka1.ttf',
'simple_round': 'Karma Suture.otf',
'mono': 'manaspc.ttf',
'damaged': 'Merchant Copy.ttf',
'big_natural': 'MorialCitadel.TTF',
'spacy': 'nasalization-rg.otf',
'sci-fi': 'neuropol.otf',
'hollow_big_edge': 'papercut.ttf',
'space_shuttle': 'pdark.ttf',
'thin': 'PixelFJVerdana12pt.ttf',
'random': 'Seattle Avenue.ttf',
'pixel': 'yoster.ttf'
}
Pygame window: (0, 0) is in the top left corner, the height and width are stored in HEIGHT and WIDTH
GameObjects for rooms, scenes and maybe MorialCitadel
Scene:
type - normal, dungeon, cutscene
objects - contain rooms, npcs, mobs, the character etc.
Room:
type - normal, shop, special (?), boss
objects - npcs, mobs, the character etc.
exits - position of exits --> [top:bool, right:bool, down:bool, left:bool]; 1 to 4 exits per room
locked - bool if the room is unlocked; locked upon first entering unless all mobs are dead

Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 703 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 657 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 644 B

View file

@ -1,160 +0,0 @@
import pygame
pygame.font.init()
fonts = {
'medieval': 'medieval.ttf',
'minecraft': 'Minecraft Evenings.otf',
'3dpixel': '3D-Pixel.ttf',
'8bit': '8bitlim.ttf',
'8bito': '8blimro.ttf',
'arcade': 'ARCADECLASSIC.ttf',
'modern_game': 'astron boy video.otf',
'modern': 'astron boy.otf',
'wonder': 'Beyond Wonderland.ttf',
'curved': 'Digitag.ttf',
'simple': 'DisposableDroidBB.ttf',
'rounded': 'dpcomic.ttf',
'playfull': 'Endalian Script.ttf',
'blocky': 'FREAKSOFNATURE.ttf',
'catchy': 'Future TimeSplitters.otf',
'simple_wide': 'Halo3.ttf',
'simple_fat': 'INVASION2000.ttf',
'very_gamy': 'ka1.ttf',
'simple_round': 'Karma Suture.otf',
'mono': 'manaspc.ttf',
'damaged': 'Merchant Copy.ttf',
'big_natural': 'MorialCitadel.TTF',
'spacy': 'nasalization-rg.otf',
'sci-fi': 'neuropol.otf',
'hollow_big_edge': 'papercut.ttf',
'space_shuttle': 'pdark.ttf',
'thin': 'PixelFJVerdana12pt.ttf',
'random': 'Seattle Avenue.ttf',
'pixel': 'yoster.ttf'
}
class Button():
def __init__(self, x, y, width, height, font, font_size, buttonText='Button', onclickFunction=None, onePress=False):
self.font = pygame.font.Font(f'fonts/{fonts[font]}', font_size)
self.x = x
self.y = y
self.width = width
self.height = height
self.onclickFunction = onclickFunction
self.onePress = onePress
self.alreadyPressed = False
with open('art/images/textbox.png', 'r') as tb:
self.box = pygame.image.load(tb)
self.box = pygame.transform.scale(self.box, (width, height))
self.buttonRect = pygame.Rect(self.x, self.y, self.width, self.height)
self.buttonSurf = self.font.render(buttonText, True, '#baab80')
def process(self, screen, clock, running, background, isblack, WIDTH, HEIGHT):
mousePos = pygame.mouse.get_pos()
if self.buttonRect.collidepoint(mousePos):
if pygame.mouse.get_pressed(num_buttons=3)[0]:
if self.onePress:
self.onclickFunction()
elif not self.alreadyPressed:
if 'play' in str(self.onclickFunction):
self.onclickFunction(screen, clock, running, background, isblack, WIDTH, HEIGHT)
self.alreadyPressed = True
else:
self.onclickFunction()
self.alreadyPressed = True
else:
self.alreadyPressed = False
self.box.blit(self.buttonSurf, [
self.buttonRect.width/2 - self.buttonSurf.get_rect().width/2,
self.buttonRect.height/2 - self.buttonSurf.get_rect().height/2
])
screen.blit(self.box, self.buttonRect)
class DropDown():
def __init__(self, x, y, width, height, font, font_size, color_menu, color_option, main, options):
self.rect = pygame.Rect(x, y, width, height)
self.font = pygame.font.Font(f'fonts/{fonts[font]}', font_size)
self.main = main
self.options = options
self.draw_menu = False
self.menu_active = False
self.active_option = -1
with open('art/images/textbox.png', 'r') as tb:
self.box = pygame.image.load(tb)
self.box = pygame.transform.scale(self.box, (width, height))
def draw(self, screen):
#pygame.draw.rect(screen, self.color_menu[self.menu_active], self.rect, 0)
surface = self.font.render(self.main, 1, (0, 0, 0))
self.box.blit(surface, [
self.rect.width/2 - surface.get_rect().width/2,
self.rect.height/2 - surface.get_rect().height/2
])
screen.blit(self.box, surface.get_rect(center = self.rect.center))
if self.draw_menu:
for i, text in enumerate(self.options):
rect = self.rect.copy()
rect.y += (i+1) * self.rect.height
rect.x = self.rect.x
#pygame.draw.rect(screen, self.color_option[1 if i == self.active_option else 0], rect, 0)
#msg = self.font.render(text, 1, (0, 0, 0))
#screen.blit(msg, msg.get_rect(center = rect.center))
surface = self.font.render(text, 1, (0, 0, 0))
self.box.blit(surface, [
rect.width/2 - surface.get_rect().width/2,
rect.height/2 - surface.get_rect().height/2
])
screen.blit(self.box, rect)
def update(self, event_list):
mpos = pygame.mouse.get_pos()
self.menu_active = self.rect.collidepoint(mpos)
self.active_option = -1
for i in range(len(self.options)):
rect = self.rect.copy()
rect.y += (i+1) * self.rect.height
if rect.collidepoint(mpos):
self.active_option = i
break
if not self.menu_active and self.active_option == -1:
self.draw_menu = False
#self.draw_menu = True
#return -1
if pygame.mouse.get_pressed(num_buttons=3)[0]:
if self.menu_active:
self.draw_menu = not self.draw_menu
elif self.draw_menu and self.active_option >= 0:
self.draw_menu = False
return self.active_option
return -1
class GameObjects():
def __init__(self, name:str, _type:str, bg, objects:list) -> None:
self.name = name
self.type = _type
self.background = bg
self.objects = objects
class Scene(GameObjects):
def __init__(self, name:str, _type:str, bg, objects:list) -> None:
super().__init__(name, _type, bg, objects)
class Room(GameObjects):
def __init__(self, name:str, _type:str, bg, objects:list, exits:list) -> None:
super().__init__(name, _type, bg, objects)
self.exits = exits
if self.type == 'normal' or self.type == 'boss':
self.locked = True
else:
self.locked = False

View file

@ -1,7 +0,0 @@
{
"screen":
{
"res":[1280, 720],
"fullscreen": false
}
}

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.

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.

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.

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.

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.

22
ideas.txt Normal file
View file

@ -0,0 +1,22 @@
Game:
Rogue-like Game mit Story
Pixel
viele Gegner:
Skelette
Zombies
Story:
Homeless guy in Berlin (oder so) im Winter in einer Stadtbibliothek, weil warm und Shelter.
er hasst eigentlich Bücher, aber aus Langeweile durchstöbert er die Bibo
findet cool aussehendes antikes/magisches Buch, nimmt es aus dem Regal, blättert es auf und wird ohnmächtig
-> Erwacht als magische Person in magischer Welt wieder
Buch dient als Skillbaum (verschiedene Kapitel)
Kampfmagier
Heilender Magier -> Priester?
Elementmagier(?)
maybe noch irgendwas 4.
Ziel(e)
-> Zurückkommen
-> Happy werden (?)

147
main.py
View file

@ -1,147 +0,0 @@
import pygame
import sys
import json
import time
from classes import *
from viecher import *
fps = 60
def setUp(config):
pygame.init()
if config["fullscreen"]:
screen = pygame.display.set_mode(config["res"], pygame.FULLSCREEN)
else:
screen = pygame.display.set_mode(config["res"])
clock = pygame.time.Clock()
return screen, clock, True, True, "start.png", []
def readConfig():
with open('config.json', 'r') as c:
json_data = c.read()
return json.loads(json_data)
def quitGame():
#save progress somehow, if needed
pygame.quit()
quit()
def play(screen, clock, running, background, isblack, WIDTH, HEIGHT):
objects = []
objects.append(MainCharacter('Herbert', 100, 'reddy.png', 125, 5, 1, 1, 50))
while running:
screen.fill('#000000')
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
quitGame()
# RENDER YOUR GAME HERE
"""with open(background, 'r') as i:
bg = pygame.image.load(i)
bg = pygame.transform.scale(bg, (WIDTH, HEIGHT))
# fill the screen with an image to clear the screen
screen.blit(bg, (0, 0))
"""
for obj in objects:
obj.update(pygame.key.get_pressed())
obj.draw(screen)
# flip() the display to put your work on screen
pygame.display.flip()
clock.tick(fps) # limits FPS to 60
def options(screen, clock, running, background, isblack, WIDTH, HEIGHT):
objects = []
# List that is displayed while selecting the window resolution level
resolution = [("1920x1080", "1920x1080"),
("1920x1200", "1920x1200"),
("1280x720", "1280x720"),
("2560x1440", "2560x1440"),
("3840x2160", "3840x2160")]
# This function displays the currently selected options
def printSettings():
print("\n\n")
# getting the data using "get_input_data" method of the Menu class
settingsData = settings.get_input_data()
for key in settingsData.keys():
print(f"{key}\t:\t{settingsData[key]}")
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# RENDER YOUR GAME HERE
with open(background, 'r') as i:
bg = pygame.image.load(i)
bg = pygame.transform.scale(bg, (WIDTH, HEIGHT))
# fill the screen with an image to clear the screen
screen.blit(bg, (0, 0))
for obj in objects:
obj.process(screen)
# flip() the display to put your work on screen
pygame.display.flip()
clock.tick(60) # limits FPS to 60
def menu(screen, clock, running, background, isblack, WIDTH, HEIGHT):
objects = []
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'medieval', 48, "Play", play))
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Options", uwu))
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame))
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
quitGame()
# RENDER YOUR GAME HERE
with open(f'art/images/{background}', 'r') as i:
bg = pygame.image.load(i)
bg = pygame.transform.scale(bg, (WIDTH, HEIGHT))
# fill the screen with an image to clear the screen
screen.blit(bg, (0, 0))
for obj in objects:
obj.process(screen, clock, running, background, isblack, WIDTH, HEIGHT)
# flip() the display to put your work on screen
pygame.display.flip()
clock.tick(60) # limits FPS to 60
def main():
config = readConfig()
screen, clock, running, isblack, background, objects = setUp(config["screen"])
WIDTH, HEIGHT = screen.get_size()
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Play", play))
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'medieval', 48, "Options", uwu))
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame))
menu(screen, clock, running, background, isblack, WIDTH, HEIGHT)
"""while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
#menu(screen, clock, running, background, isblack, WIDTH, HEIGHT)
if not isblack:
with open(background, 'r') as i:
bg = pygame.image.load(i)
bg = pygame.transform.scale(bg, (WIDTH, HEIGHT))
# fill the screen with a color to wipe away anything from last frame
screen.blit(bg, (0, 0))
# RENDER YOUR GAME HERE
else:
for obj in objects:
obj.process(screen, clock, running, background, isblack, WIDTH, HEIGHT)
# flip() the display to put your work on screen
pygame.display.flip()
clock.tick(60) # limits FPS to 60"""
pygame.quit()
if __name__ == '__main__':
main()

BIN
test.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 529 KiB

View file

@ -1,56 +0,0 @@
import pygame
fps = 60
class Character():
def __init__(self, name, ms, sprite) -> None:
self.name = name
self.speed = ms
with open(f'art/images/{sprite}') as i:
self.sprite = pygame.image.load(i)
self.x = 524
self.y = 524
self.hidden = False
self.rect = pygame.Rect(self.x, self.y, self.sprite.get_width(), self.sprite.get_height())
def draw(self, screen):
if self.hidden:
return
self.rect.x, self.rect.y = self.x, self.y
screen.blit(self.sprite, self.rect)
class NPC(Character):
pass
class Fighter(Character):
def __init__(self, name, ms, sprite, health, damage, level, asp, atr) -> None:
super().__init__(name, ms, sprite)
self.health = health
self.damage = damage
self.level = level
self.attack_speed = asp
self.attack_range = atr
class MainCharacter(Fighter):
def __init__(self, name, ms, sprite, health, damage, level, asp, atr, weapon=None, shield=None) -> None:
super().__init__(name, ms, sprite, health, damage, level, asp, atr)
self.attack_spell = weapon
self.shield_spell = shield
self.talking = False
def update(self, keys):
if keys[pygame.K_w]:
self.y -= self.speed / fps
if keys[pygame.K_a]:
self.x -= self.speed / fps
if keys[pygame.K_s]:
self.y += self.speed / fps
if keys[pygame.K_d]:
self.x += self.speed / fps
class Mobs(Fighter):
def __init__(self, name, ms, sprite, health, damage, level, asp, atr, drops) -> None:
super().__init__(name, ms, sprite, health, damage, level, asp, atr)
self.drops = drops * (self.level / 2)