diff --git a/WikiJam/Player/Player.gd b/WikiJam/Player/Player.gd index e43cbe9..6fc2bf2 100644 --- a/WikiJam/Player/Player.gd +++ b/WikiJam/Player/Player.gd @@ -89,20 +89,23 @@ func _process_input(): if Input.is_action_pressed("move_right"): input_movement_vector.x += 1 + # look around with controller + var look = Vector2() + look.x = -Input.get_action_strength("cam_move_left") + Input.get_action_strength("cam_move_right") + look.y = +Input.get_action_strength("cam_move_down") - Input.get_action_strength("cam_move_up") + #Logger.info("look at: " + String(look)) + _camera.rotate_x(deg2rad(look.y * -1)) + self.rotate_y(deg2rad(look.x * -1)) + + # Prevent player from doing a purzelbaum + _camera.rotation_degrees.x = clamp(_camera.rotation_degrees.x, -70, 70) + # look around with mouse _dir = Vector3() var camera_transform = _camera.get_global_transform() _dir += -camera_transform.basis.z * input_movement_vector.y _dir += camera_transform.basis.x * input_movement_vector.x - # look around with controller - #var look = Vector2() - #look.x = -Input.get_action_strength("cam_move_left") + Input.get_action_strength("cam_move_right") - #look.y = +Input.get_action_strength("cam_move_down") - Input.get_action_strength("cam_move_up") - ##Logger.info("look at: " + String(look)) - ##Input.warp_mouse_position(look) - #look_at(Vector3(look.x, look.y, 1), Vector3.UP) - # jumping if Input.is_action_just_pressed("move_jump") and is_on_floor(): _vel.y = JUMP_SPEED diff --git a/WikiJam/Player/Player.tscn b/WikiJam/Player/Player.tscn index 6ccaa3d..a2a5e24 100644 --- a/WikiJam/Player/Player.tscn +++ b/WikiJam/Player/Player.tscn @@ -80,6 +80,7 @@ unit_db = -10.0 pitch_scale = 1.5 [node name="HUD" parent="." instance=ExtResource( 4 )] +gameover_sound_path = NodePath("../GameOverSound") collect_sound_path = NodePath("../CollectSound") [node name="GameOverSound" type="AudioStreamPlayer" parent="."] diff --git a/WikiJam/Player/UI/HUD.gd b/WikiJam/Player/UI/HUD.gd index 2a089ca..3656070 100644 --- a/WikiJam/Player/UI/HUD.gd +++ b/WikiJam/Player/UI/HUD.gd @@ -84,8 +84,8 @@ func _endGame (value): Collector.Clear() - _popup.get_node("LabelWon").visible = value - _popup.get_node("LabelFail").visible = !value + _popup.get_node("CenterContainer/Container/LabelWon").visible = value + _popup.get_node("CenterContainer/Container/LabelFail").visible = !value _popup.get_node("PanelWon").visible = value _popup.get_node("PanelFail").visible = !value diff --git a/WikiJam/Player/UI/HUD.tscn b/WikiJam/Player/UI/HUD.tscn index a7b2f6e..6eb0fba 100644 --- a/WikiJam/Player/UI/HUD.tscn +++ b/WikiJam/Player/UI/HUD.tscn @@ -6,66 +6,72 @@ margin_right = 40.0 margin_bottom = 40.0 script = ExtResource( 1 ) -popup_nodepath = NodePath("../HUD/Popup") -gameover_sound_path = NodePath("../GameOverSound") +popup_nodepath = NodePath("Popup") container_path = NodePath("GridContainer") [node name="Popup" type="Popup" parent="."] -editor/display_folded = true visible = true -margin_left = 383.0 -margin_top = 187.0 -margin_right = 530.0 -margin_bottom = 289.0 +anchor_right = 1.0 +anchor_bottom = 1.0 [node name="PanelFail" type="Panel" parent="Popup"] modulate = Color( 0.996078, 0, 0, 1 ) -margin_left = -383.0 -margin_top = -187.36 -margin_right = 641.0 -margin_bottom = 412.64 +anchor_right = 1.0 +anchor_bottom = 1.0 [node name="PanelWon" type="Panel" parent="Popup"] modulate = Color( 0.0313726, 0, 0.996078, 1 ) -margin_left = -383.0 -margin_top = -187.36 -margin_right = 641.0 -margin_bottom = 412.64 +anchor_right = 1.0 +anchor_bottom = 1.0 -[node name="LabelWon" type="Label" parent="Popup"] -margin_left = 87.064 -margin_top = 24.4867 -margin_right = 169.064 -margin_bottom = 72.4867 -text = "Gratulations! +[node name="CenterContainer" type="CenterContainer" parent="Popup"] +anchor_right = 1.0 +anchor_bottom = 1.0 - You Won!" +[node name="Container" type="Control" parent="Popup/CenterContainer"] +margin_left = 20.0 +margin_top = 20.0 +margin_right = 20.0 +margin_bottom = 20.0 -[node name="LabelFail" type="Label" parent="Popup"] -margin_left = 88.9828 -margin_top = 28.0094 -margin_right = 168.983 -margin_bottom = 76.0094 +[node name="LabelFail" type="Label" parent="Popup/CenterContainer/Container"] +margin_left = 10.0 +margin_top = -24.0 +margin_right = 80.0 +margin_bottom = 24.0 text = " You died! Game over" -[node name="Button" type="Button" parent="Popup"] -margin_left = 86.5054 -margin_top = 144.902 -margin_right = 179.505 -margin_bottom = 181.902 -text = "play again" +[node name="LabelWon" type="Label" parent="Popup/CenterContainer/Container"] +margin_left = 10.0 +margin_top = -24.0 +margin_right = 92.0 +margin_bottom = 24.0 +text = "Gratulations! -[node name="ProgressBar" type="ProgressBar" parent="."] -margin_left = 410.651 -margin_top = 560.551 -margin_right = 614.651 -margin_bottom = 582.551 -step = 1.0 -value = 100.0 + You Won!" + +[node name="Button" type="Button" parent="Popup/CenterContainer/Container"] +margin_left = -33.0 +margin_top = 49.0 +margin_right = 120.0 +margin_bottom = 126.0 +text = "play again" [node name="GridContainer" type="GridContainer" parent="."] margin_right = 250.0 margin_bottom = 150.0 -[connection signal="pressed" from="Popup/Button" to="." method="_on_Button_pressed"] + +[node name="ProgressBar" type="ProgressBar" parent="."] +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +margin_left = 405.248 +margin_top = 613.044 +margin_right = 615.248 +margin_bottom = 658.044 +rect_min_size = Vector2( 250, 45 ) +step = 1.0 +value = 100.0 +[connection signal="pressed" from="Popup/CenterContainer/Container/Button" to="." method="_on_Button_pressed"]