Added Map; Added Spawners; Changed Decorations; Cleaned up Code and some Settings; Added Enemy
This commit is contained in:
parent
e82438139f
commit
e18beb6c4c
160 changed files with 4674 additions and 182 deletions
55
scenes/game/Door/door.gd
Normal file
55
scenes/game/Door/door.gd
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
extends StaticBody2D
|
||||
|
||||
var isOpen = false
|
||||
|
||||
@onready var collision = $CollisionShape
|
||||
@onready var lightOccluder = $LightOccluder
|
||||
@onready var animatedSprite = $AnimatedSprite
|
||||
@onready var interactIcon = $InteractIcon
|
||||
@onready var interactionRadius = $InteractionRadius
|
||||
|
||||
func _ready() -> void:
|
||||
interactIcon.hide()
|
||||
interactIcon.rotation_degrees -= rotation_degrees
|
||||
collision.disabled = false
|
||||
|
||||
func toggle():
|
||||
if isOpen:
|
||||
close()
|
||||
else:
|
||||
open()
|
||||
|
||||
func open():
|
||||
await get_tree().physics_frame
|
||||
isOpen = true
|
||||
collision.disabled = true
|
||||
lightOccluder.visible = false
|
||||
animatedSprite.play("open")
|
||||
|
||||
func close():
|
||||
await get_tree().physics_frame
|
||||
isOpen = false
|
||||
collision.disabled = false
|
||||
lightOccluder.visible = true
|
||||
animatedSprite.play_backwards("open")
|
||||
|
||||
|
||||
func _on_interaction_radius_area_entered(area: Area2D) -> void:
|
||||
if area.is_in_group("Player"):
|
||||
interactIcon.show()
|
||||
|
||||
|
||||
func _on_interaction_radius_area_exited(area: Area2D) -> void:
|
||||
if area.is_in_group("Player") :
|
||||
interactIcon.hide()
|
||||
|
||||
|
||||
func _on_interaction_radius_body_entered(body: Node2D) -> void:
|
||||
if body.is_in_group("Entity"):
|
||||
if not isOpen:
|
||||
open()
|
||||
|
||||
func _on_interaction_radius_body_exited(body: Node2D) -> void:
|
||||
if body.is_in_group("Entity") and interactionRadius.get_overlapping_bodies() == []:
|
||||
if isOpen:
|
||||
close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue