correction du zoom camera.

This commit is contained in:
osquallo 2018-07-25 12:11:56 +02:00
parent e8d4f86f46
commit 179b23ca61
3 changed files with 10 additions and 6 deletions

View file

@ -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

View file

@ -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
if Input.is_action_pressed( "hide_char" ):
$MeshInstance.visible = not $MeshInstance.visible

View file

@ -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 )]