From 4d40e44e2d5dcfc5189f586e16d42eb6fc1c6bca Mon Sep 17 00:00:00 2001 From: Lyzzy Date: Sun, 10 Mar 2024 12:58:59 +0100 Subject: [PATCH 1/9] starting to add some storyline, added Rat --- art/images/weapons/empty.png | Bin 68 -> 87 bytes classes.py | 4 ++++ main.py | 2 +- viecher.py | 36 ++++++++++++++++++++++++----------- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/art/images/weapons/empty.png b/art/images/weapons/empty.png index 3c86ed194c66bb0d6e27a6b1804b826ae8081782..bbfeb274e7a3480c1f842a61e425a05757df9c19 100644 GIT binary patch literal 87 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`a-J@ZAr}70DGLM)f>z8=yu#3S k(SSj1(Zv!2i9-wwYBLxFmkVE;2vo`7>FVdQ&MBb@069<=IsgCw literal 68 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx1|;Q0k8}blZci7-5RT~N1O_Gs237_}Ir%pt PKw$ None: + def __init__(self, x, y, width, height, level, text, font='simple', font_size=20, font_color='#1e90ff', sprite='label.png') -> None: super().__init__(x, y, width, height, text, font, font_size, font_color, sprite) + self.level = level class Thinks(Label): def __init__(self, x, y, width, height, text, font='simple', font_size=15, font_color='#000000', sprite='thinks.png') -> None: @@ -438,6 +442,16 @@ class Zombie(Mobs): obj[3].append(Punch('punch', 100, self.x, self.y, moveto, self.damage)) self.lastAttack = pg.time.get_ticks() +class Rat(Mobs): + def __init__(self, name, ms, x, y, health, damage, level, asp, atr, sprite='people/rat.png', drops=0) -> None: + super().__init__(name, ms, sprite, x, y, health, damage, level, asp, atr, drops) + + + def attack(self, moveto, obj): + if self.lastAttack + self.attack_speed * 1000 < pg.time.get_ticks(): + obj[3].append(Punch('punch', 100, self.x, self.y, moveto, self.damage)) + self.lastAttack = pg.time.get_ticks() + class Weapons(Objects): def __init__(self, name, ms, sprite, x, y, moveto, damage, life_ticks) -> None: super().__init__(name, ms, sprite, x, y) From 726c5ee2a21b6d8d624421f17060635dcd6dc53f Mon Sep 17 00:00:00 2001 From: Lyzzy Date: Sun, 10 Mar 2024 14:23:22 +0100 Subject: [PATCH 2/9] storyline --- viecher.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/viecher.py b/viecher.py index 9f987e6..f75babf 100644 --- a/viecher.py +++ b/viecher.py @@ -33,7 +33,7 @@ fonts = { 'spacy': 'nasalization-rg.otf', 'sci-fi': 'neuropol.otf', 'hollow_big_edge': 'papercut.ttf', - 'f_shuttle': 'pdark.ttf', + 'space_shuttle': 'pdark.ttf', 'thin': 'PixelFJVerdana12pt.ttf', 'random': 'Seattle Avenue.ttf', 'pixel': 'yoster.ttf' @@ -75,13 +75,13 @@ class NPC(Objects): self.conversation.draw(screen) def update(self, keys, objects): - if self.lastUpdate + 150 < pg.time.get_ticks(): + if self.lastUpdate + 200 < pg.time.get_ticks(): if self.talking: self.conversation.update(keys, objects) self.lastUpdate = pg.time.get_ticks() else: touches = pg.sprite.spritecollideany(self, objects[0]) - if touches is not None and keys[pg.K_SPACE] and isinstance(touches, MainCharacter): + if touches is not None and keys[pg.K_f] and isinstance(touches, MainCharacter): self.talk(objects) self.lastUpdate = pg.time.get_ticks() From 248fc2a11206030396c39054155140422a1b31a9 Mon Sep 17 00:00:00 2001 From: Lyzzy Date: Sun, 10 Mar 2024 14:30:20 +0100 Subject: [PATCH 3/9] fix fix --- viecher.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/viecher.py b/viecher.py index f75babf..9aa4fa1 100644 --- a/viecher.py +++ b/viecher.py @@ -137,7 +137,7 @@ class Fighter(Objects): class MainCharacter(Fighter): - def __init__(self, name, ms, sprite, x, y, health, damage, level, asp, atr) -> None: + def __init__(self, name, ms, sprite, x, y, health, damage, level, asp, atr, killed =[]) -> None: super().__init__(name, ms, sprite, x, y, health, damage, level, asp, atr) self.book = Book(0, 0, [], None, None) self.talking = False @@ -145,6 +145,7 @@ class MainCharacter(Fighter): self.health = Hearts(health, sprite=['fullheart.png', 'fullheart.png', 'fullheart.png', 'fullheart.png', 'fullheart.png'], x=900, y= 50, hurtCooldown=self.hurtCooldown) self.thinks = Thinks(self.x+20, self.y-50, 150, 100, 'brr Im freezing') self.freezing = True + self.killed = killed #amount of mobs that were killed def draw(self, screen): if self.hidden: @@ -208,11 +209,7 @@ class MainCharacter(Fighter): self.y -= (2 + self.rect.height - (touches.rect.y - self.y)) return elif isinstance(touches, NPC): - if keys[pg.K_f]: - touches.talk(objects) - return - else: - return + return if self.x <= touches.rect.x: self.x -= (self.rect.width - (touches.rect.x - self.x)) elif self.x > touches.rect.x: self.x += (self.rect.width - (self.x - touches.rect.x - touches.rect.width * 0.66)) @@ -493,7 +490,7 @@ class Fireball(Spells): self.die(objects, Mobs) class Windslash(Spells): - def __init__(self, name, ms, x, y, moveto, damage, sprite = 'weapons/windslash.png', life_ticks=700) -> None: + def __init__(self, name, ms, x, y, moveto, damage, sprite = 'weapons/windslash.png', life_ticks=1000) -> None: super().__init__(name, ms, sprite, x, y, moveto, damage, life_ticks) def update(self, objects): From e540693def179de7e081bfa5557b8f95c0179821 Mon Sep 17 00:00:00 2001 From: Lyzzy Date: Sun, 10 Mar 2024 15:06:44 +0100 Subject: [PATCH 4/9] story yea yea --- main.py | 2 +- viecher.py | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 2e4c5ab..c0dfdfa 100644 --- a/main.py +++ b/main.py @@ -42,7 +42,7 @@ def genRooms(WIDTH, HEIGHT, type:str, objects:list): def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): main = [herbert] - mobs = [Skeleton(i, random.randint(40, 60), random.randint(50, WIDTH - 50), random.randint(50, HEIGHT - 50), 5, 1, 1, 1, 200) for i in range(0,random.randint(2, 5))]+[Zombie(i, random.randint(40, 60), random.randint(50, WIDTH-50), random.randint(50, HEIGHT-50), 5, 1, 1, 1, 25) for i in range(0,random.randint(2, 5))] + mobs = [Skeleton('skeleton', random.randint(40, 60), random.randint(50, WIDTH - 50), random.randint(50, HEIGHT - 50), 5, 1, 1, 1, 200) for i in range(0,random.randint(2, 5))]+[Zombie('zombie', random.randint(40, 60), random.randint(50, WIDTH-50), random.randint(50, HEIGHT-50), 5, 1, 1, 1, 25) for i in range(0,random.randint(2, 5))] weapons = [] others = [] npcs = [] diff --git a/viecher.py b/viecher.py index 9aa4fa1..a988bf9 100644 --- a/viecher.py +++ b/viecher.py @@ -74,7 +74,10 @@ class NPC(Objects): if self.talking: self.conversation.draw(screen) - def update(self, keys, objects): + def update(self, keys, objects): + if self.name == 'oldlady': + if self.conversation.convo_scene==0 and 'rat' in objects[0][0].killed and objects[1]==[]: + self.conversation.convo_scene=1 if self.lastUpdate + 200 < pg.time.get_ticks(): if self.talking: self.conversation.update(keys, objects) @@ -116,8 +119,12 @@ class Convo(Label): self.text = convo[2][self.convo_act] self.convo_act += 1 else: - if convo[0] == 'oldlady' and convo[1] == 0: - objects[1].append(Rat('r1', 200, 1000, 350, 1, 1, 1, 100, 25)) + if convo[0] == 'oldlady': + if convo[1] == 0: + objects[1].append(Rat('rat', 200, 1000, 350, 1, 1, 1, 100, 25)) + elif convo[1] == 1: + objects[0][0].level.level = 5 + while 'rat' in objects[0][0].killed: objects[0][0].remove('rat') self.convo_act = 0 self.npc.talking = False objects[0][0].talking = False @@ -168,9 +175,9 @@ class MainCharacter(Fighter): if touches is not None: if touches.name == 'fireplace': self.freezing = False - elif touches.name == 'portal': + elif touches.name == 'portal' and self.level.level != 1: return 'play' - elif touches.name == 'house': + elif touches.name == 'house' and self.level.level != 1: return 'house' elif 'wall' in touches.name: return 'wall' @@ -304,6 +311,9 @@ class Level(Label): def __init__(self, x, y, width, height, level, text, font='simple', font_size=20, font_color='#1e90ff', sprite='label.png') -> None: super().__init__(x, y, width, height, text, font, font_size, font_color, sprite) self.level = level + def draw(self, screen): + self.text = f'will to live: {self.level}%' + super().draw(screen) class Thinks(Label): def __init__(self, x, y, width, height, text, font='simple', font_size=15, font_color='#000000', sprite='thinks.png') -> None: @@ -411,6 +421,7 @@ class Mobs(Fighter): def hurt(self, damage, objects): self.health -= damage if self.health <= 0: + objects[0][0].killed.append(self.name) self.hidden = True objects[1].remove(self) From 4e976c3895eb35b158aba00b79ccc104d4e80199 Mon Sep 17 00:00:00 2001 From: Lyzzy Date: Sun, 10 Mar 2024 15:14:21 +0100 Subject: [PATCH 5/9] wuhu --- viecher.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/viecher.py b/viecher.py index a988bf9..c46e625 100644 --- a/viecher.py +++ b/viecher.py @@ -96,9 +96,9 @@ class Convo(Label): self.npc = npc self.convo_scene = convo_scene self.convos = [ - ['oldlady', 0, ['There are so many rats here.', 'I wish someone would to something against that','An experienced fighter could just kill them.', 'For them it only takes a mouseclick.']], - ['oldlady', 1, ['Oh, did you kill all the rats?', 'You must be the chosen one', 'It would be nice if you would go and talk to the old wise man in the house.']], - ['oldman', 0, ['Please help', 'there are so many bad people']] + ['oldlady', 0, ['There are so many rats here.', 'I wish someone would to something against that.','An experienced fighter could kill them.', 'For them it only takes a mouseclick.']], + ['oldlady', 1, ['Oh, did you kill all the rats?', 'You must be the chosen one!', 'It would be nice if you would go and talk to the old wise man in the house.']], + ['oldman', 0, ['Who are you?', 'You want to help us?', 'We have a serious problem with some monsters.', 'One day they appeared out of nowhere and started attacking.', 'When you jump into the portal outside,', 'You will be send to some monsters.', 'PLEASE help us!']] ] def draw(self, screen): @@ -343,11 +343,12 @@ class Book(): self.sp_list = spells self.current_sp = current_spell self.text_left = ["Dear User, ", "in case you fell on the ground too hard,", "here is a quick reminder:", - "You are a homeless person.","One cold day you went to the library to get warm.", - "There you saw and opened me out of boedom.", "This lead to you being thrown in this world.", + "You are a homeless person. One cold day","you went to the library to warm up yourself.", + "There you got bored and found and opened me.", "This lead to you being thrown into this world.", "But you can find a way out of here again."] - self.text_right = ["This book will help you to survive.", "Click on a picture to choose your spell.", - "Talk to fairies to unlock new spells!"] + self.text_right = ["This book will help you to survive.", "You can open and close me when pressing e.", + "Click on a picture to choose your spell.", + "Talk to fairies to unlock new spells!"] self.buttons=[] self.buttons_y = 400 self.buttons_x = 800 From 93bbb0eb8428a9770b3b46594dd032de5e5c68ed Mon Sep 17 00:00:00 2001 From: Lyzzy Date: Sun, 10 Mar 2024 16:05:09 +0100 Subject: [PATCH 6/9] Stoorryy --- main.py | 3 +-- viecher.py | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index c0dfdfa..637eaf7 100644 --- a/main.py +++ b/main.py @@ -115,7 +115,6 @@ def village(screen, clock, running, background, isblack, WIDTH, HEIGHT): mobs = [] weapons = [] others = [Obstacle('fireplace', 'interactable', 'art/images/background/fireplace.png', False, 200, 500), - Obstacle('portal', 'interactable', 'art/images/background/portal.png', False, 700, 300), 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] @@ -187,7 +186,7 @@ def house(screen, clock, running, background, isblack, WIDTH, HEIGHT): mobs = [] weapons = [] others = [] - npcs = [NPC('oldman', 100, 'people/reddy.png', 0, 200, 200)] + npcs = [NPC('elder', 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) freeze = False #Gameplay is freezed in certain situations diff --git a/viecher.py b/viecher.py index c46e625..eb3b420 100644 --- a/viecher.py +++ b/viecher.py @@ -1,6 +1,7 @@ import pygame as pg from classes import * from main import * +import random vec = pg.math.Vector2 fps = 60 @@ -97,8 +98,9 @@ class Convo(Label): self.convo_scene = convo_scene self.convos = [ ['oldlady', 0, ['There are so many rats here.', 'I wish someone would to something against that.','An experienced fighter could kill them.', 'For them it only takes a mouseclick.']], - ['oldlady', 1, ['Oh, did you kill all the rats?', 'You must be the chosen one!', 'It would be nice if you would go and talk to the old wise man in the house.']], - ['oldman', 0, ['Who are you?', 'You want to help us?', 'We have a serious problem with some monsters.', 'One day they appeared out of nowhere and started attacking.', 'When you jump into the portal outside,', 'You will be send to some monsters.', 'PLEASE help us!']] + ['oldlady', 1, ['Oh, did you kill all the rats?', 'You must be the chosen one!', 'It would be nice if you would go and talk to the village elder.']], + ['elder', 0, ['Who are you?', 'You want to help us?', 'We have a serious problem with some monsters.', 'One day they appeared out of nowhere and started attacking.', 'When you jump into the portal outside,', 'You will be send to some monsters.', 'PLEASE help us!']], + ['elder', 1, ['Who are you?', 'You want to help us?', 'We have a serious problem with some monsters.', 'One day they appeared out of nowhere and started attacking.', 'When you jump into the portal outside,', 'You will be send to some monsters.', 'PLEASE help us!']] ] def draw(self, screen): @@ -121,10 +123,15 @@ class Convo(Label): else: if convo[0] == 'oldlady': if convo[1] == 0: - objects[1].append(Rat('rat', 200, 1000, 350, 1, 1, 1, 100, 25)) + for i in range(0,5): + objects[1].append(Rat('rat', random.randint(150,250), 800, 400+i*20, 1, 1, 1, 100, 25)) elif convo[1] == 1: objects[0][0].level.level = 5 - while 'rat' in objects[0][0].killed: objects[0][0].remove('rat') + while 'rat' in objects[0][0].killed: objects[0][0].killed.remove('rat') + if convo[0] == 'elder': + if convo[1] == 0: + objects[4].append(Obstacle('portal', 'interactable', 'art/images/background/portal.png', False, 700, 300)) + self.convo_scene += 1 self.convo_act = 0 self.npc.talking = False objects[0][0].talking = False @@ -178,6 +185,8 @@ class MainCharacter(Fighter): elif touches.name == 'portal' and self.level.level != 1: return 'play' elif touches.name == 'house' and self.level.level != 1: + self.x = 500 + self.y = 400 return 'house' elif 'wall' in touches.name: return 'wall' From 04547161a3fa7a1873e82d4453ef72c3ca54b20c Mon Sep 17 00:00:00 2001 From: Lyzzy Date: Sun, 10 Mar 2024 16:05:15 +0100 Subject: [PATCH 7/9] picture --- art/images/background/portal.png | Bin 626 -> 1290 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/art/images/background/portal.png b/art/images/background/portal.png index 1bc87b02334d94162debc5ec03bbc74596c4bbaa..7617f537b379468416219c87c10c9553b319a583 100644 GIT binary patch literal 1290 zcmV+l1@-!gP)A}S6&!_DMD z=}efnJXUVH6z_G$0lbMx=nzxx2-|G~hW>HCGtohu-iD01vN z59l5P8AB)v7jpoOa}j?q_uaxb#|C)p0vZ(n+LSZ)BK*+{0O$>lgC#y94CWZUweZ!k z_K#dJH}gR59q!mi*k`~OxrQevu4~`zBbfMG0CS8OGt0j| zL>wLrBi=Z7>E6a&CZ13=qKKIje>`YGTT0cefSl&Gnb0GOY-UqpaQLyuP$%`vIOGwpR8NRa4) zzTCzJ*~mc#_267}gia+v7gGdiwXy+Gda!76{Ax%W((;3`;pag&4J^T_ZKtxOch~E^ zuraC3xz2_$AW&Ig15t7=`Dm=~-&M=!0Rna~?lD;#Igh83X%5huW7lQJGvDm=qvm7= zk#S+#TeC%B(|Y%%>5c#j06^}gwmtx}?dl^J^vrW(B02Y|HbtOVsty1YOl$f_jXip5 zN@weCt_c7|&qg48@4or1uQT^L?;4%V8Rp7SeK1!qeWo!+Zp~m<%gMmU)Wt8MV5C@z z&m*M31SbGn&+!`z2x(i-;TSfy-*m!?$ZhW$0Izg8H#`IY;-+wC&m{0)I04CXFk)Ir zDi@%c9F`;3{QQdTzcc-y;1ODSvKZ1+xO8g`qVulH$jLyqs^@C}u<`>i1i-u&Jd;rX zU~^}O5GhjAh{m+OG13sYdWBjrsaz2N>~Gz;rx4oD+7cV>b$6g}bkeO?B5!@~g#p-G z*KVqI^Y>H%qb{ippXoDzeyO6ddI`eBqDGCW$Xx{~VcB4jxjZq2UQ7)D0E{XHkggo! zyi<26wSd++0DzNQf24yufwh15&mujpWE-8&`f1@@kyU9Qk`&H7<-LP`I3;?RA zcw-9GG{XuAK$uJSObd*BXBP|*NuPnC8dgdaF7a@T6eJbq9zj6|Y_+PL4z|k|r*trV z>*hU`_@$M$oaxw!C^+1Cj?J`5KD_G$M!0Tc7ht%9_X3{vA<}Jav@&X`LY=1Tgd)@x ziYrRCa(8LW%Cnyb0CpaQva8z+WtWZ#Kux8}Dp2P9&1!)gGL&Kq@vp6gdx15Kx=?9my+;I) zn1o9K!1V0h!yhPz5WUSsYXj?e!_lGGzX!}S8`iliX5e8?$mq+sR*u=n3 zfS_TFSvpP)z(Lff`FPSfFkO2G#J?~;K(0rvU|^!Jld0RR9107*qoM6N<$g6afW ARsaA1 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 From fc3773150aad676c7be9f5c652b036f2acae3fb8 Mon Sep 17 00:00:00 2001 From: Lyzzy Date: Sun, 10 Mar 2024 16:19:57 +0100 Subject: [PATCH 8/9] - --- main.py | 1 - viecher.py | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 637eaf7..dda1f6e 100644 --- a/main.py +++ b/main.py @@ -169,7 +169,6 @@ def village(screen, clock, running, background, isblack, WIDTH, HEIGHT): npc.update(pygame.key.get_pressed(), objects) npc.draw(screen) - objects[0][0].book.addspell('windslash') room.update(objects) else: diff --git a/viecher.py b/viecher.py index eb3b420..750263b 100644 --- a/viecher.py +++ b/viecher.py @@ -251,9 +251,9 @@ class MainCharacter(Fighter): if self.book.current_sp == 'fireball': weapon = Fireball('fb1', 100, self.x, self.y, moveto, 5) elif self.book.current_sp == 'windslash': - weapon = Windslash('ws1', 100, self.x, self.y, moveto, 5) + weapon = Windslash('ws1', 100, self.x, self.y, moveto, 10) else: - return + weapon = Punch('punch', 100, self.x, self.y, moveto, 1, Mobs, life_ticks=500) obj[3].append(weapon) self.lastAttack = pg.time.get_ticks() @@ -457,7 +457,7 @@ class Zombie(Mobs): def attack(self, moveto, obj): if self.lastAttack + self.attack_speed * 1000 < pg.time.get_ticks(): - obj[3].append(Punch('punch', 100, self.x, self.y, moveto, self.damage)) + obj[3].append(Punch('punch', 100, self.x, self.y, moveto, self.damage, MainCharacter)) self.lastAttack = pg.time.get_ticks() class Rat(Mobs): @@ -467,7 +467,7 @@ class Rat(Mobs): def attack(self, moveto, obj): if self.lastAttack + self.attack_speed * 1000 < pg.time.get_ticks(): - obj[3].append(Punch('punch', 100, self.x, self.y, moveto, self.damage)) + obj[3].append(Punch('punch', 100, self.x, self.y, moveto, self.damage, MainCharacter)) self.lastAttack = pg.time.get_ticks() class Weapons(Objects): @@ -533,9 +533,10 @@ class Arrow(Weapons): class Punch(Weapons): - def __init__(self, name, ms, x, y, moveto, damage, sprite = 'weapons/empty.png', life_ticks=100) -> None: + 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) + self.kills = kills def update(self, objects): self.move(objects) - self.die(objects, MainCharacter) + self.die(objects, self.kills) From f86f2e5dced02ff22e8862c6e666b084b624b5c9 Mon Sep 17 00:00:00 2001 From: Lyzzy Date: Sun, 10 Mar 2024 18:42:40 +0100 Subject: [PATCH 9/9] added last part of tutorial --- art/images/box/thinks.png | Bin 329 -> 1084 bytes viecher.py | 25 +++++++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/art/images/box/thinks.png b/art/images/box/thinks.png index c0d2d8ea873949a385c877272589bb7774e2d6bd..4273165c3cd8de2c7de3310b44e2b21d972a0436 100644 GIT binary patch literal 1084 zcmV-C1jGA@P)bWcK%Zf&!Lq`LVVBVb(3kOi%ag*ROjB z_D!DfO>o!`kn>9XF!IC5-@5brYow~GWGPvfqQz*&Hw#@Nv1q~Hl>@83#{YsHY_%Q& z@2y!E`NS;ZCvk4QTD_Y1i;e41rSSNUR*xqh*dp(;#Ceo+{|lG^5+LmQ6O%^;LB}5Z zZUs0Dnr2~L=zJT5w%RODVxPQJ)rd2#Lfd#;Tfy$d;0h4R5)`Qr28(3ewS*{?wiXIu zw1O05tM4)-uJW<{_CdRzNrcW>GY1f0iL~ljdIF+S1WwlV)LI-~T@F3V&Ld5=03JX$u2lRVxk(qj}Rf($#X~7@mNXRhg#asne;j!^;cb z?Fiy@3JHvu>VG&U{v1&*OHvJb4RtMn3zY?X$|O*!1u*ve-GeoA0ikrfFJZ;KT$k5r zGM&1^;nhI0luk3Z{1s>+*BkR5M+T@MEJ+ryp-MSc7majV}pe(4rc2ugi576o)A}ny+0xURE79~Js3T3WUo$Hg(S?Vka zc@iA=4uocVc-*lU?7q2!kse5iNbBj?hJ#C`<{7A_0mRO%YOW~SQ6y!9W0x-F=%7Kt zJuPo-uLEnD9qb$H#iVI=RtQ z)suTy>d#)ir=9jfYBa_TIvzl$)8-@$ENLxKsJ4xBexkChJI01wx&8KGt6aQeKZ>FTHs=oiJFI^n!;5 z1oe@?0qL58G!<9S1!}!Ky<3j`oRnq+172)rUJPUhtJT{M&K-XA{dvTb-Bi<6T`3)q zQA3Z@fIi)qn^SRpG~jFJo`8rE(Wpx=H+62ggi`LfEjMrcmiP)#CtV|lnkjjT0whmp zU1OAJ{lfMu033Y$Q|Ipi8p_c~7lvPAkpZbRDn&hEq5@}u7S?AI?=#Nd zb2e0?lAi##3>_{YLqF89JK34%#1N2G5D$3qfbhP&{NOxwe&){l(*PI_3l?F#s-3jwBtR#oB2|bpUBaZKw^O zt3au!c}<)SqLL{DKsk7@SN47u0E?w}L26v{5&YL(0O8yw9zhPYXHD!vN<3a~|? b<+|hxqi3oiBiiDR00000NkvXXu0mjfyOe;E diff --git a/viecher.py b/viecher.py index 750263b..0e2f3c3 100644 --- a/viecher.py +++ b/viecher.py @@ -99,8 +99,8 @@ class Convo(Label): self.convos = [ ['oldlady', 0, ['There are so many rats here.', 'I wish someone would to something against that.','An experienced fighter could kill them.', 'For them it only takes a mouseclick.']], ['oldlady', 1, ['Oh, did you kill all the rats?', 'You must be the chosen one!', 'It would be nice if you would go and talk to the village elder.']], - ['elder', 0, ['Who are you?', 'You want to help us?', 'We have a serious problem with some monsters.', 'One day they appeared out of nowhere and started attacking.', 'When you jump into the portal outside,', 'You will be send to some monsters.', 'PLEASE help us!']], - ['elder', 1, ['Who are you?', 'You want to help us?', 'We have a serious problem with some monsters.', 'One day they appeared out of nowhere and started attacking.', 'When you jump into the portal outside,', 'You will be send to some monsters.', 'PLEASE help us!']] + ['elder', 0, ['Who are you?', 'You want to help us?', 'We have a serious problem with monsters.', 'One day they appeared out of nowhere and started attacking.', 'When you jump into the portal over there,', 'You will be send to a place with monsters.', 'PLEASE help us!']], + ['elder', 1, ['Who are you?', 'You want to help us?', 'We have a serious problem with monsters.', 'One day they appeared out of nowhere and started attacking.', 'When you jump into the portal over there,', 'You will be send to a place with monsters.', 'PLEASE help us!']] ] def draw(self, screen): @@ -157,7 +157,7 @@ class MainCharacter(Fighter): self.talking = False self.level = Level(1000, 38, 150, 40, level, f'will to live: {level}%', 'simple', 20, ) self.health = Hearts(health, sprite=['fullheart.png', 'fullheart.png', 'fullheart.png', 'fullheart.png', 'fullheart.png'], x=900, y= 50, hurtCooldown=self.hurtCooldown) - self.thinks = Thinks(self.x+20, self.y-50, 150, 100, 'brr Im freezing') + self.thinks = Thinks(self.x+20, self.y-50, 150, 100, 'brr I\'m freezing') self.freezing = True self.killed = killed #amount of mobs that were killed @@ -262,7 +262,7 @@ class MainCharacter(Fighter): self.walk(keys, objects) if pg.mouse.get_pressed()[0]: self.attack(objects, vec(mouse)) - self.thinks.update(self) + self.thinks.update(objects, self) if self.health.health <= 0: return 'village' else: @@ -327,6 +327,7 @@ class Level(Label): class Thinks(Label): def __init__(self, x, y, width, height, text, font='simple', font_size=15, font_color='#000000', sprite='thinks.png') -> None: super().__init__(x, y, width, height, text, font, font_size, font_color, sprite) + self.scene = 0 def draw(self, screen, x, y): if self.hidden: @@ -335,10 +336,22 @@ class Thinks(Label): self.y = y super().draw(screen) - def update(self, main): + def update(self, objects, main): if not self.hidden: - if not main.freezing: + if self.scene == 0 and not main.freezing: + self.scene = 1 self.hidden = True + elif self.scene == 1 and main.talking: + self.scene = 2 + self.hidden = True + if self.scene == 1: + touches = pg.sprite.spritecollideany(main, objects[2]) + if touches is not None and isinstance(touches, NPC): + self.text = 'I should press \"f\"' + self.hidden = False + else: + self.hidden = False + self.text = 'the lady over there' class Book(): def __init__(self, x, y, spells, current_spell, current_shield) -> None: