attack now with left mouse click #73

Merged
Spafi merged 1 commit from Spafi/game:main into Development 2024-03-07 21:05:46 +01:00

View file

@ -162,7 +162,7 @@ class MainCharacter(Fighter):
self.y -= (2 + self.rect.height - (touches.rect.y - self.y))
return
elif isinstance(touches, NPC):
if keys[pg.K_SPACE]:
if keys[pg.K_f]:
touches.talk(objects)
return
else:
@ -188,7 +188,7 @@ class MainCharacter(Fighter):
def attack(self, obj, mouse):
if self.lastAttack + self.attack_speed * 1000 < pg.time.get_ticks():
moveto = mouse- vec(self.x, self.y)
moveto = mouse - vec(self.x, self.y)
if self.book.current_sp == 'fireball':
weapon = Fireball('fb1', 100, self.x, self.y, moveto, 5)
elif self.book.current_sp == 'windslash':
@ -201,7 +201,7 @@ class MainCharacter(Fighter):
def update(self, keys, mouse, objects):
if not self.talking:
self.walk(keys, objects)
if keys[pg.K_f]:
if pg.mouse.get_pressed()[0]:
self.attack(objects, vec(mouse))
self.speech.update(self)
if self.health.health <= 0: