game icon and room update #80

Merged
Spafi merged 4 commits from Spafi/game:main into Development 2024-03-10 23:03:07 +01:00
8 changed files with 9 additions and 5 deletions
Showing only changes of commit 0f755996b6 - Show all commits

BIN
art/image files/dooor.kra Normal file

Binary file not shown.

BIN
art/image files/door.kra Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

BIN
art/images/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

14
main.py
View file

@ -15,7 +15,9 @@ def setUp(config):
screen = pygame.display.set_mode(config["res"])
clock = pygame.time.Clock()
pygame.display.set_caption('Between The Pages')
return screen, clock, True, True, "start.png", []
with open('art/images/icon.png', 'r') as i:
pygame.display.set_icon(pygame.image.load(i))
return screen, clock, True, True, "startscreen.png", []
def readConfig():
with open('config.json', 'r') as c:
@ -33,9 +35,10 @@ def genRooms(WIDTH, HEIGHT, type:str, objects:list):
room_objects.append(Obstacle('river', 'water', 'art/images/background/river.png', True, random.randint(32, round(WIDTH * 0.75)), 32, WIDTH=96, HEIGHT=round(HEIGHT * 0.66)))
room_backgrounds = [f'art/images/background/{type}{i}.png' for i in range(1)]
rooms = [
Room(type, 'normal', room_backgrounds[random.randint(0, 0)], [objects[0], objects[1], objects[2], objects[3], objects[4] + [room_objects[random.randint(0, 0)] for i in range(0, random.randint(0, 1))]], WIDTH - 64, HEIGHT - 64, [True, True, True, True], j)
Room(type, 'normal', room_backgrounds[random.randint(0, 0)], [objects[0], objects[1], objects[2], objects[3], objects[4] + [room_objects[random.randint(0, 0)] for i in range(0, random.randint(0, 1))]], WIDTH - 64, HEIGHT - 64, j)
for j in range(random.randint(5, 10))
]
rooms.append(Room(type, 'boss', room_backgrounds[random.randint(0, 0)], [objects[0], objects[1], [], [], objects[4] + [room_objects[random.randint(0, 0)] for i in range(0, random.randint(0, 1))]], WIDTH - 64, HEIGHT - 64, 88))
#rooms =Room(type, 'normal', room_backgrounds[random.randint(0, 4)], [objects[0], objects[1], objects[2], [room_objects[random.randint(0, len(room_objects) - 1)] for i in range(0, random.randint(0, 1))]], WIDTH - 64, HEIGHT - 64, [True, True, True, True], j)
return rooms
@ -100,6 +103,7 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT):
objects[0][0].book.addspell('windslash')
scene.update(False, objects)
scene.draw(screen)
else:
objects[0][0].book.hidden = not freeze
@ -119,7 +123,7 @@ def village(screen, clock, running, background, isblack, WIDTH, HEIGHT):
Obstacle('house', 'Interactable', 'art/images/background/house.png', False, 500, 150, WIDTH=180, HEIGHT=160)]
npcs = [NPC('oldlady', 100, 'people/oldlady.png', 0, 200, 200)]
objects = [main, mobs, npcs, weapons, others]
room = Room('village', 'village', 'art/images/background/village.png', objects, WIDTH - 64, HEIGHT - 64, [True, True, True, True], 0)
room = Room('village', 'village', 'art/images/background/village.png', objects, WIDTH - 64, HEIGHT - 64, 0)
freeze = True #Gameplay is freezed in certain situations
main[0].health.health = 20
@ -189,7 +193,7 @@ def house(screen, clock, running, background, isblack, WIDTH, HEIGHT):
others = []
npcs = [NPC('oldman', 100, 'people/reddy.png', 0, 200, 200)]
objects = [main, mobs, npcs, weapons, others]
room = Room('house', 'house', 'art/images/background/insideHouse.png', objects, WIDTH - 64, HEIGHT - 64, [True, True, True, True], 0)
room = Room('house', 'house', 'art/images/background/insideHouse.png', objects, WIDTH - 64, HEIGHT - 64, 0)
freeze = False #Gameplay is freezed in certain situations
while running:
@ -288,7 +292,7 @@ def options(screen, clock, running, background, isblack, WIDTH, HEIGHT):
def menu(screen, clock, running, background, isblack, WIDTH, HEIGHT):
objects = []
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'textbox.png', 'medieval', 48, "Play", village, attributes=[screen, clock, running, background, isblack, WIDTH, HEIGHT]))
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'textbox.png', 'medieval', 48, "Play", play, attributes=[screen, clock, running, background, isblack, WIDTH, HEIGHT]))
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'textbox.png', 'medieval', 48, "Options", uwu))
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'textbox.png', 'medieval', 48, "Exit game", quitGame))
while running: