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