Browse Source

Rotate gunner

Bastien Sevajol 6 years ago
parent
commit
678896401f
1 changed files with 7 additions and 0 deletions
  1. 7 0
      opencombat/gui/base.py

+ 7 - 0
opencombat/gui/base.py View File

350
         firing_event = GuiFiringEvent(shooter_actor, event.weapon_type)
350
         firing_event = GuiFiringEvent(shooter_actor, event.weapon_type)
351
         original_actor_image = shooter_actor.image
351
         original_actor_image = shooter_actor.image
352
 
352
 
353
+        def actor_rotate():
354
+            shooter_actor.rotation = get_angle(
355
+                shooter_actor.position,
356
+                event.target_position,
357
+            )
358
+
353
         def actor_firing():
359
         def actor_firing():
354
             shooter_actor.firing(firing_event)
360
             shooter_actor.firing(firing_event)
355
 
361
 
376
             duration=0.2,  # TODO BS 2018-01-25: Wil depend of weapon type
382
             duration=0.2,  # TODO BS 2018-01-25: Wil depend of weapon type
377
             delay=delay,
383
             delay=delay,
378
             end_callback=actor_end_firing,
384
             end_callback=actor_end_firing,
385
+            start_callback=actor_rotate,
379
         )
386
         )
380
 
387
 
381
     def subject_die(self, event: DieEvent) -> None:
388
     def subject_die(self, event: DieEvent) -> None: