From c17b65d2f332cca09d81fa820b214359ab4d382a Mon Sep 17 00:00:00 2001 From: Lyzzy Date: Sat, 9 Mar 2024 15:54:19 +0100 Subject: [PATCH] added village somehow --- art/images/portal.png | Bin 0 -> 626 bytes main.py | 16 ++++++++-------- viecher.py | 12 ++++++++++++ 3 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 art/images/portal.png diff --git a/art/images/portal.png b/art/images/portal.png new file mode 100644 index 0000000000000000000000000000000000000000..1bc87b02334d94162debc5ec03bbc74596c4bbaa GIT binary patch literal 626 zcmV-&0*(ENP)vGai6opq#q|P`a6bMi(C_3Xn6(2y`hp_MzEq$EQK1D4L(aZ0Sv|wjirCP2DDXBjc zNRBH9WvVdxLx#&C$^On-d#|J6KVRCs`f}k=0ull`T+f51YYkr6p0DtH6k5#yoWjY;bE^qTK_=$#=plL3$Px9E@Uz^rV z7v;i%Ja3%AlOC*o7ak$@O^YxIBfJcq#o^$RQkBcR#OB@vqQ1&S7GIpf)jgQ~4uk+9 z9dyRmYS-AkG$Bc4!&oFtc*v#+sjO)VuvPga|60I z6^yP_4vat=iBJMk7qmbKH_4_s&dTaUfl|RS)*3agBrGanbkO6kM+pgz&u^yhA53TV z=?VjNXN*(G`my|QRRyB}%W1-6qWqCcjXMWpTb%7 literal 0 HcmV?d00001 diff --git a/main.py b/main.py index c91e67d..5b542ae 100644 --- a/main.py +++ b/main.py @@ -52,7 +52,7 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): rooms = genRooms(WIDTH, HEIGHT, 'grass', objects) level.append(Stage('blau', 'normal', None, [], WIDTH, HEIGHT, 'blue', rooms)) scene = Scene('test', 'normal', None, None, WIDTH, HEIGHT, level) - freeze = True #Gameplay is freezed in certain situations + freeze = False #Gameplay is freezed in certain situations while running: screen.fill('#000000') @@ -85,7 +85,7 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): for thing in objects[0]: thing.book.hidden = not freeze if not thing.update(pygame.key.get_pressed(), pygame.mouse.get_pos(), objects): - menu(screen, clock, running, background, isblack, WIDTH, HEIGHT) + village(screen, clock, running, background, isblack, WIDTH, HEIGHT) thing.draw(screen) for mob in objects[1]: @@ -99,7 +99,6 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): objects[0][0].book.addspell('windslash') scene.update(False, objects) - else: objects[0][0].book.hidden = not freeze objects[0][0].book.draw(screen) @@ -113,7 +112,7 @@ def village(screen, clock, running, background, isblack, WIDTH, HEIGHT): main = [MainCharacter('Herbert', 100, 'people/oldman.png', 500, 500, 20, 5, 1, 1, 50)] mobs = [] weapons = [] - others = [Fire('f1', 0, 200, 300)] + others = [Fire('f1', 0, 200, 300), Portal('p1', 0, 1000, 500)] npcs = [NPC('name', 100, 'people/oldlady.png', 1, 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) @@ -139,13 +138,14 @@ def village(screen, clock, running, background, isblack, WIDTH, HEIGHT): objects = room.getObjects() screen.blit(room.background, (32, 32)) + for thing in objects[4]: + if thing.update(objects): + play(screen, clock, running, background, isblack, WIDTH, HEIGHT) + thing.draw(screen) + for weapon in objects[3]: weapon.update(objects) weapon.draw(screen) - - for thing in objects[4]: - thing.update(objects) - thing.draw(screen) for thing in objects[0]: thing.book.hidden = not freeze diff --git a/viecher.py b/viecher.py index 076b915..69ccb6e 100644 --- a/viecher.py +++ b/viecher.py @@ -481,4 +481,16 @@ class Fire(Objects): def update(self, objects): self.warming(objects) + return False + +class Portal(Objects): + def __init__(self, name, ms, x, y, sprite='portal.png') -> None: + super().__init__(name, ms, sprite, x, y) + + def update(self, objects): + touches = pg.sprite.spritecollideany(self, objects[0]) + if touches is not None and isinstance(touches, MainCharacter): + return True + else: + return False \ No newline at end of file