forked from godotengine/tps-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit ee8e13b925b62e5658ee7718142a9717e7d28bf0 Author: Aaron Franke <[email protected]> Date: Thu Oct 3 14:21:28 2024 -0700 Fix GDScript style commit 27a75ce42c018cef4d499da587f6d0416981ad0b Author: Aaron Franke <[email protected]> Date: Tue Sep 17 10:35:58 2024 -0500 Update for Godot 4.3 and fix robot walk sound (godotengine#188) commit 08c7ea8 Author: Emre <[email protected]> Date: Thu Sep 12 19:55:13 2024 +0300 basic fix commit 31c36be Author: Emre <[email protected]> Date: Wed Sep 4 00:03:16 2024 +0300 Added opening and closing feature to doors Added opening and closing feature to doors. When the character comes to the door, it opens automatically. Also, the desired doors are locked and cannot be opened. commit 8395037 Author: Emre <[email protected]> Date: Thu Aug 29 15:16:28 2024 +0300 Added functional doors to the game map with animations and collisions Integrated fully functional doors into the game map, utilizing existing animations and collision objects. This update ensures that all doors within the game are now interactive and operate correctly, providing a more immersive experience. Each door has been configured to open and close as intended when interacted with by the player.
- Loading branch information
Showing
10 changed files
with
126 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,49 @@ | ||
extends Area3D | ||
|
||
var open = false | ||
|
||
@onready var animation_player = $DoorModel/AnimationPlayer | ||
@export var open: bool = false | ||
@export var is_locked: bool = false | ||
|
||
@onready var animation_player: AnimationPlayer= $DoorModel2/AnimationPlayer | ||
|
||
@onready var _door_skeleton: Skeleton3D = $"DoorModel2/armature-doorsimple/Skeleton3D" | ||
@onready var left_collision: CollisionShape3D = _door_skeleton.get_node(^"doorleft/CollisionShape3D") | ||
@onready var right_collision: CollisionShape3D = _door_skeleton.get_node(^"doorright/CollisionShape3D") | ||
@onready var upper_collision: CollisionShape3D = _door_skeleton.get_node(^"doorupper/CollisionShape3D") | ||
@onready var lower_collision: CollisionShape3D = _door_skeleton.get_node(^"doorlower/CollisionShape3D") | ||
@onready var lock_indicator_mesh: MeshInstance3D = _door_skeleton.get_node(^"doorsimple") | ||
|
||
var override_material := StandardMaterial3D.new() | ||
|
||
|
||
func _ready(): | ||
lock_indicator_mesh.set_surface_override_material(1, override_material) | ||
if is_locked: | ||
override_material.albedo_color = Color.RED | ||
elif not is_locked: | ||
override_material.albedo_color = Color.GREEN | ||
|
||
|
||
func _process(_delta): | ||
if float(animation_player.current_animation_position) < 1.9: | ||
left_collision.disabled = false | ||
right_collision.disabled = false | ||
upper_collision.disabled = false | ||
lower_collision.disabled = false | ||
else: | ||
left_collision.disabled = true | ||
right_collision.disabled = true | ||
upper_collision.disabled = true | ||
lower_collision.disabled = true | ||
|
||
|
||
func _on_door_body_entered(body): | ||
if not open and body is Player: | ||
if not open and body is Player and not is_locked: | ||
animation_player.play("doorsimple_opening") | ||
open = true | ||
|
||
|
||
func _on_body_exited(body): | ||
if open and body is Player and not is_locked: | ||
animation_player.play_backwards("doorsimple_opening") | ||
open = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters