Improved tutorial camera movement check

This commit is contained in:
Paul Black 2023-03-19 13:11:15 -06:00
parent 344cf5649f
commit 53a76142e8
2 changed files with 22 additions and 7 deletions

View file

@ -244,6 +244,7 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_ir016")
[node name="A" type="Panel" parent="TutorialPanel"] [node name="A" type="Panel" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 119.0 offset_left = 119.0
offset_top = 120.0 offset_top = 120.0
offset_right = 149.0 offset_right = 149.0
@ -252,6 +253,7 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_ir016")
[node name="S" type="Panel" parent="TutorialPanel"] [node name="S" type="Panel" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 159.0 offset_left = 159.0
offset_top = 120.0 offset_top = 120.0
offset_right = 189.0 offset_right = 189.0
@ -260,6 +262,7 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_ir016")
[node name="D" type="Panel" parent="TutorialPanel"] [node name="D" type="Panel" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 199.0 offset_left = 199.0
offset_top = 120.0 offset_top = 120.0
offset_right = 229.0 offset_right = 229.0
@ -278,6 +281,7 @@ horizontal_alignment = 1
[node name="move" type="Label" parent="TutorialPanel"] [node name="move" type="Label" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 4.0 offset_left = 4.0
offset_top = 49.0 offset_top = 49.0
offset_right = 346.0 offset_right = 346.0
@ -293,6 +297,7 @@ texture = ExtResource("4_wdsme")
[node name="camera" type="Label" parent="TutorialPanel"] [node name="camera" type="Label" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 4.0 offset_left = 4.0
offset_top = 12.0 offset_top = 12.0
offset_right = 346.0 offset_right = 346.0
@ -362,6 +367,7 @@ texture = ExtResource("7_klqcg")
[node name="start" type="Label" parent="TutorialPanel"] [node name="start" type="Label" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 4.0 offset_left = 4.0
offset_top = 12.0 offset_top = 12.0
offset_right = 346.0 offset_right = 346.0
@ -371,6 +377,7 @@ horizontal_alignment = 1
[node name="enter" type="Label" parent="TutorialPanel"] [node name="enter" type="Label" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 4.0 offset_left = 4.0
offset_top = 37.0 offset_top = 37.0
offset_right = 346.0 offset_right = 346.0
@ -386,6 +393,7 @@ texture = ExtResource("9_j1om3")
[node name="shoot" type="Label" parent="TutorialPanel"] [node name="shoot" type="Label" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 4.0 offset_left = 4.0
offset_top = 12.0 offset_top = 12.0
offset_right = 346.0 offset_right = 346.0
@ -401,6 +409,7 @@ texture = ExtResource("8_i5jmt")
[node name="learning" type="Label" parent="TutorialPanel"] [node name="learning" type="Label" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 4.0 offset_left = 4.0
offset_top = 12.0 offset_top = 12.0
offset_right = 346.0 offset_right = 346.0
@ -410,6 +419,7 @@ horizontal_alignment = 1
[node name="aim" type="Label" parent="TutorialPanel"] [node name="aim" type="Label" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 4.0 offset_left = 4.0
offset_top = 39.0 offset_top = 39.0
offset_right = 346.0 offset_right = 346.0
@ -419,6 +429,7 @@ horizontal_alignment = 1
[node name="timer" type="Label" parent="TutorialPanel"] [node name="timer" type="Label" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 4.0 offset_left = 4.0
offset_top = 68.0 offset_top = 68.0
offset_right = 346.0 offset_right = 346.0
@ -428,6 +439,7 @@ horizontal_alignment = 1
[node name="zero" type="Label" parent="TutorialPanel"] [node name="zero" type="Label" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 4.0 offset_left = 4.0
offset_top = 97.0 offset_top = 97.0
offset_right = 346.0 offset_right = 346.0
@ -437,6 +449,7 @@ horizontal_alignment = 1
[node name="done" type="Label" parent="TutorialPanel"] [node name="done" type="Label" parent="TutorialPanel"]
visible = false visible = false
layout_mode = 0
offset_left = 4.0 offset_left = 4.0
offset_top = 129.0 offset_top = 129.0
offset_right = 346.0 offset_right = 346.0

View file

@ -194,7 +194,7 @@ var up = false
var left = false var left = false
var down = false var down = false
var right = false var right = false
var prev_mouse_pos = get_global_mouse_position() @onready var prev_cam_rot = get_node(str(Global.selfTeddy) + '/CollisionShape3D/Neck/Camera3D').global_rotation
var ran_timer2 = false var ran_timer2 = false
var ran_timer3 = false var ran_timer3 = false
var stage2 = false var stage2 = false
@ -220,24 +220,26 @@ func tutorial_2():
await get_tree().create_timer(0.5).timeout await get_tree().create_timer(0.5).timeout
ran_timer2 = true ran_timer2 = true
else: else:
var mouse_pos = get_global_mouse_position() var cam_rot = get_node(str(Global.selfTeddy) + '/CollisionShape3D/Neck/Camera3D').global_rotation
print("prev_cam_rot: ", prev_cam_rot)
print("cam_rot: ", cam_rot)
if not up: if not up:
if mouse_pos.y < prev_mouse_pos.y: if cam_rot.x > prev_cam_rot.x:
up = true up = true
$TutorialPanel/ArrowFilled_up.visible = true $TutorialPanel/ArrowFilled_up.visible = true
if not down: if not down:
if mouse_pos.y > prev_mouse_pos.y: if cam_rot.x < prev_cam_rot.x:
down = true down = true
$TutorialPanel/ArrowFilled_down.visible = true $TutorialPanel/ArrowFilled_down.visible = true
if not left: if not left:
if mouse_pos.x > prev_mouse_pos.x: if cam_rot.y > prev_cam_rot.y:
left = true left = true
$TutorialPanel/ArrowFilled_left.visible = true $TutorialPanel/ArrowFilled_left.visible = true
if not right: if not right:
if mouse_pos.x < prev_mouse_pos.x: if cam_rot.y < prev_cam_rot.y:
right = true right = true
$TutorialPanel/ArrowFilled_right.visible = true $TutorialPanel/ArrowFilled_right.visible = true
prev_mouse_pos = mouse_pos prev_cam_rot = cam_rot
if up and left and right and down: if up and left and right and down:
if not ran_timer3: if not ran_timer3:
await get_tree().create_timer(0.5).timeout await get_tree().create_timer(0.5).timeout