diff --git a/Characters/Player/Player.gd b/Characters/Player/Player.gd index 77b2650..d94ca77 100644 --- a/Characters/Player/Player.gd +++ b/Characters/Player/Player.gd @@ -6,6 +6,7 @@ export(NodePath) var lookingAt_nodepath export(NodePath) var animationWalk_nodepath export(NodePath) var animationFadeOut_nodepath export(NodePath) var ui_interact_nodepath +export(NodePath) var ui_message_nodepath export(NodePath) var camera_nodepath export(int) var keycard_lvl export(Array) var key_chain @@ -27,6 +28,7 @@ var _lookCast: RayCast var _animationWalk: AnimationPlayer var _animationFadeOut: AnimationPlayer var _labelInteract: Label +var _labelMessage: Label var _dir = Vector3() var _vel = Vector3() var _is_sprinting : bool @@ -72,6 +74,9 @@ func _ready(): _labelInteract = get_node(ui_interact_nodepath) as Label assert(null != _labelInteract) + _labelMessage = get_node(ui_message_nodepath) as Label + assert(null != _labelMessage) + # Setup mouse look Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) _lookCast = get_node(lookingAt_nodepath) as RayCast @@ -98,6 +103,16 @@ func _ready(): player.stream = load("res://Resources/Audio/cock.wav") player.play() +func showMessage (text, duration): + _labelMessage.text = text + # animation + var timer = _inventory.get_node("Timer") as Timer + timer.wait_time = duration + timer.start() + _labelMessage.show() + yield(timer, "timeout") + _labelMessage.hide() + func _physics_process(delta): process_input() @@ -244,7 +259,7 @@ func _on_area_exited (area: Area): func _on_respawn (): - Logger.info("respawning") + #Logger.info("respawning") # fade to black and restart scene _inventory.hide() # disable hud for the time of respawn animation diff --git a/Characters/Player/Player.tscn b/Characters/Player/Player.tscn index 170d2e7..5bfb129 100644 --- a/Characters/Player/Player.tscn +++ b/Characters/Player/Player.tscn @@ -158,6 +158,7 @@ random_pitch = 1.3 [node name="Player" type="KinematicBody" groups=[ "Player", ]] +editor/display_folded = true collision_layer = 5 collision_mask = 5 script = ExtResource( 1 ) @@ -166,6 +167,7 @@ lookingAt_nodepath = NodePath("Body/PillCameras/LookingAt") animationWalk_nodepath = NodePath("WalkAnimationPlayer") animationFadeOut_nodepath = NodePath("FadeOutAnimationPlayer") ui_interact_nodepath = NodePath("HUD/PressInteract") +ui_message_nodepath = NodePath("HUD/Info") camera_nodepath = NodePath("Body/PillCameras") [node name="Body" type="Spatial" parent="."] diff --git a/Characters/Player/UI/UI.tscn b/Characters/Player/UI/UI.tscn index bb19791..02ea1b1 100644 --- a/Characters/Player/UI/UI.tscn +++ b/Characters/Player/UI/UI.tscn @@ -13,6 +13,9 @@ margin_left = 10.2837 margin_right = 10.2837 script = ExtResource( 1 ) +[node name="Timer" type="Timer" parent="."] +one_shot = true + [node name="PressInteract" type="Label" parent="."] visible = false modulate = Color( 0, 0, 0, 1 ) @@ -28,27 +31,49 @@ margin_bottom = -34.8594 custom_fonts/font = ExtResource( 2 ) text = "Press 'E' to interact" +[node name="Info" type="Label" parent="."] +visible = false +modulate = Color( 0, 0, 0, 1 ) +self_modulate = Color( 0, 0, 0, 1 ) +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +margin_left = -153.0 +margin_top = -106.0 +margin_right = 153.0 +margin_bottom = -82.0 +custom_fonts/font = ExtResource( 2 ) +text = "you don't havve the right key" +align = 1 + [node name="InventoryContainer" type="GridContainer" parent="."] -margin_left = 868.0 -margin_top = 48.0 -margin_right = 1007.0 -margin_bottom = 565.0 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +margin_left = -151.0 +margin_top = -258.5 +margin_right = -12.0 +margin_bottom = 258.5 [node name="PillLevel" type="Label" parent="."] +visible = false margin_right = 40.0 margin_bottom = 14.0 [node name="PillProgress" type="TextureProgress" parent="."] margin_left = -0.571533 -margin_top = 24.7845 +margin_top = 9.7845 margin_right = 247.428 -margin_bottom = 64.7845 +margin_bottom = 49.7845 max_value = 7.0 step = 0.1 value = 6.0 texture_progress = ExtResource( 3 ) [node name="DayTime" type="Label" parent="."] +visible = false anchor_left = 1.0 anchor_right = 1.0 margin_left = -170.14 @@ -57,6 +82,7 @@ margin_right = -130.14 margin_bottom = 21.3664 [node name="DayTimeProgress" type="ProgressBar" parent="."] +visible = false margin_left = 850.901 margin_top = 30.7722 margin_right = 988.901 @@ -64,11 +90,11 @@ margin_bottom = 44.7722 rect_pivot_offset = Vector2( 67.8153, 7.2278 ) [node name="DayTimeVisual" type="TextureRect" parent="."] -anchor_left = 0.5 -anchor_right = 0.5 -margin_left = -90.0 +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -245.0 margin_top = -90.0 -margin_right = 90.0 +margin_right = -65.0 margin_bottom = 90.0 rect_rotation = 180.0 rect_pivot_offset = Vector2( 90, 90 ) diff --git a/Level/Interactables/Door/Door.gd b/Level/Interactables/Door/Door.gd index dd2c815..e54580e 100644 --- a/Level/Interactables/Door/Door.gd +++ b/Level/Interactables/Door/Door.gd @@ -39,11 +39,13 @@ func do_interact(var player): _isOpening = !_isOpening else: print("keycard level too low") + player.showMessage("keycard level too low", 3) elif player.key_chain.has(door_lvl) or door_lvl == 0: _isMoving = true _isOpening = !_isOpening else: print("you don't have the right key") + player.showMessage("you don't have the right key", 3) # opens or closes the door