Kaynağa Gözat

Fix starting visor

DricomDragon 3 yıl önce
ebeveyn
işleme
eecc77ba38
2 değiştirilmiş dosya ile 7 ekleme ve 1 silme
  1. 3 1
      godot/scripts/Launcher.gd
  2. 4 0
      godot/scripts/TargetLine.gd

+ 3 - 1
godot/scripts/Launcher.gd

@@ -18,6 +18,8 @@ enum State {
 
 export var BULLET_SPEED = 500.0
 
+const visor_start_shift = Vector2(0, -20)
+
 var _ballScene = preload("res://scenes/Ball.tscn")
 
 var nbAmmo = 0
@@ -84,7 +86,7 @@ func end_of_round():
 
 func get_ready():
 	current_state = State.READY
-	visor.position = source.position
+	target.set_visor_pos(source.position + visor_start_shift)
 	nbAmmo = nbStorage
 	nbStorage = 0
 

+ 4 - 0
godot/scripts/TargetLine.gd

@@ -8,6 +8,10 @@ func get_visor_pos():
 	return visor.position + position
 
 
+func set_visor_pos(new_pos):
+	visor.position = new_pos - position
+
+
 func focus_visor():
 	cast_to = visor.position
 	force_raycast_update()