Merge pull request 'attack now with left mouse click' (#73) from Spafi/game:main into Development
Reviewed-on: #73
This commit is contained in:
		
						commit
						091726b8ca
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		|  | @ -162,7 +162,7 @@ class MainCharacter(Fighter): | ||||||
|                         self.y -= (2 + self.rect.height - (touches.rect.y - self.y)) |                         self.y -= (2 + self.rect.height - (touches.rect.y - self.y)) | ||||||
|                     return |                     return | ||||||
|             elif isinstance(touches, NPC): |             elif isinstance(touches, NPC): | ||||||
|                 if keys[pg.K_SPACE]: |                 if keys[pg.K_f]: | ||||||
|                     touches.talk(objects) |                     touches.talk(objects) | ||||||
|                     return |                     return | ||||||
|                 else: |                 else: | ||||||
|  | @ -188,7 +188,7 @@ class MainCharacter(Fighter): | ||||||
|      |      | ||||||
|     def attack(self, obj, mouse): |     def attack(self, obj, mouse): | ||||||
|         if self.lastAttack + self.attack_speed * 1000 < pg.time.get_ticks(): |         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': |             if self.book.current_sp == 'fireball': | ||||||
|                 weapon = Fireball('fb1', 100, self.x, self.y, moveto, 5) |                 weapon = Fireball('fb1', 100, self.x, self.y, moveto, 5) | ||||||
|             elif self.book.current_sp == 'windslash': |             elif self.book.current_sp == 'windslash': | ||||||
|  | @ -201,7 +201,7 @@ class MainCharacter(Fighter): | ||||||
|     def update(self, keys, mouse, objects): |     def update(self, keys, mouse, objects): | ||||||
|         if not self.talking: |         if not self.talking: | ||||||
|             self.walk(keys, objects) |             self.walk(keys, objects) | ||||||
|             if keys[pg.K_f]: |             if pg.mouse.get_pressed()[0]: | ||||||
|                 self.attack(objects, vec(mouse)) |                 self.attack(objects, vec(mouse)) | ||||||
|             self.speech.update(self) |             self.speech.update(self) | ||||||
|         if self.health.health <= 0: |         if self.health.health <= 0: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue