From 179b23ca6166d2fd8f978385e364ecd447954b7f Mon Sep 17 00:00:00 2001 From: osquallo Date: Wed, 25 Jul 2018 12:11:56 +0200 Subject: [PATCH] correction du zoom camera. --- scenes/GUI/Help/Help.tscn | 2 +- scenes/Game/Character/Character.gd | 12 ++++++++---- scenes/Game/Game.tscn | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scenes/GUI/Help/Help.tscn b/scenes/GUI/Help/Help.tscn index ee3b147..69425cf 100644 --- a/scenes/GUI/Help/Help.tscn +++ b/scenes/GUI/Help/Help.tscn @@ -14,7 +14,7 @@ flags = 4 gradient = SubResource( 1 ) width = 2048 -[node name="Help" type="MarginContainer" index="0"] +[node name="Help" type="MarginContainer"] anchor_left = 0.0 anchor_top = 0.0 diff --git a/scenes/Game/Character/Character.gd b/scenes/Game/Character/Character.gd index d742030..66c0475 100644 --- a/scenes/Game/Character/Character.gd +++ b/scenes/Game/Character/Character.gd @@ -55,8 +55,6 @@ func process_input(delta): else: vel.y = 0 - if Input.is_action_pressed( "hide_char" ): - $MeshInstance.visible = not $MeshInstance.visible func process_movement(delta): @@ -97,6 +95,7 @@ func _input(event): # to prevent the cam sliding effect when clamp limit reached. var old_x_translation = camera.translation.x + var old_y_translation = camera.translation.y var cam_scroll = Vector3( 0.0, 0.0, 0.0 ) if event.button_index == BUTTON_WHEEL_UP: @@ -107,7 +106,12 @@ func _input(event): camera.translate( cam_scroll ) camera.translation.x = old_x_translation - camera.translation.z = clamp(camera.translation.z, -5, 0) + camera.translation.y = old_y_translation + camera.translation.z = clamp(camera.translation.z, 0, 5) if event.is_action_pressed( "game_flashlight" ) and not event.is_echo(): - camera.get_node( "Flashlight" ).visible = not camera.get_node( "Flashlight" ).visible \ No newline at end of file + camera.get_node( "Flashlight" ).visible = not camera.get_node( "Flashlight" ).visible + + if Input.is_action_pressed( "hide_char" ): + $MeshInstance.visible = not $MeshInstance.visible + \ No newline at end of file diff --git a/scenes/Game/Game.tscn b/scenes/Game/Game.tscn index 303620e..52193af 100644 --- a/scenes/Game/Game.tscn +++ b/scenes/Game/Game.tscn @@ -297,7 +297,7 @@ material = SubResource( 9 ) custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) size = Vector2( 0.4, 0.4 ) -[node name="Game" type="Spatial"] +[node name="Game" type="Spatial" index="0"] [node name="Character" parent="." index="0" instance=ExtResource( 1 )]