forked from InfoProjekt/game
fixed Convo
This commit is contained in:
parent
614654692f
commit
2970e5cecd
1 changed files with 5 additions and 8 deletions
13
viecher.py
13
viecher.py
|
|
@ -68,7 +68,6 @@ class NPC(Objects):
|
|||
def talk(self, objects):
|
||||
self.talking = True
|
||||
objects[0][0].talking = True
|
||||
self.conversation.hidden = False
|
||||
|
||||
def draw(self, screen):
|
||||
super().draw(screen)
|
||||
|
|
@ -78,26 +77,24 @@ class NPC(Objects):
|
|||
def update(self, keys, objects):
|
||||
if self.lastUpdate + 200 < pg.time.get_ticks():
|
||||
if self.talking:
|
||||
self.conversation.update(keys, objects)
|
||||
self.conversation.update(keys, objects, self)
|
||||
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):
|
||||
self.talk(objects)
|
||||
self.lastUpdate = pg.time.get_ticks()
|
||||
self.lastUpdate = pg.time.get_ticks()
|
||||
|
||||
|
||||
class Convo(Label):
|
||||
def __init__(self, text, convo_act, person, x = 140, y = 600, width = 1000, height = 100, font='simple', font_size = 20) -> None:
|
||||
super().__init__(x, y, width, height, text, font, font_size)
|
||||
|
||||
def update(self, keys, objects):
|
||||
def update(self, keys, objects, npc):
|
||||
if keys[pg.K_SPACE]:
|
||||
objects[0][0].book.addspell('fireball')
|
||||
self.talking = False
|
||||
npc.talking = False
|
||||
objects[0][0].talking = False
|
||||
self.hidden = True
|
||||
|
||||
|
||||
|
||||
|
||||
class Fighter(Objects):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue