소스 검색

Rotate gunner

Bastien Sevajol 6 년 전
부모
커밋
678896401f
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      opencombat/gui/base.py

+ 7 - 0
opencombat/gui/base.py 파일 보기

@@ -350,6 +350,12 @@ class Game(TMXGui):
350 350
         firing_event = GuiFiringEvent(shooter_actor, event.weapon_type)
351 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 359
         def actor_firing():
354 360
             shooter_actor.firing(firing_event)
355 361
 
@@ -376,6 +382,7 @@ class Game(TMXGui):
376 382
             duration=0.2,  # TODO BS 2018-01-25: Wil depend of weapon type
377 383
             delay=delay,
378 384
             end_callback=actor_end_firing,
385
+            start_callback=actor_rotate,
379 386
         )
380 387
 
381 388
     def subject_die(self, event: DieEvent) -> None: