finishe pressurePlate
This commit is contained in:
parent
9432084b53
commit
6913816861
6 changed files with 52 additions and 43 deletions
|
@ -1,6 +1,6 @@
|
|||
extends StaticBody2D
|
||||
|
||||
@export var laser_path: NodePath # TODO
|
||||
@export var laser_path: NodePath = "../StaticBody2D"
|
||||
@export var required_scale: Vector2 = Vector2(1.0, 1.0)
|
||||
@export var player_required_scale: Vector2 = Vector2(2.0, 2.0)
|
||||
|
||||
|
@ -14,12 +14,14 @@ func _ready():
|
|||
|
||||
func _on_body_entered(body: Node):
|
||||
print("Wird erkannt")
|
||||
if (body is StaticBody2D and body.scale >= required_scale) or (body is CharacterBody2D and body.scale >= player_required_scale):
|
||||
print(body)
|
||||
print(body.scale)
|
||||
if (body is AnimatableBody2D and body.scale >= required_scale) or (body is CharacterBody2D and body.scale >= player_required_scale):
|
||||
animation.play("Disable")
|
||||
activate_plate()
|
||||
|
||||
func _on_body_exited(body: Node):
|
||||
if (body is StaticBody2D and body.scale >= required_scale) or (body is CharacterBody2D and body.scale >= player_required_scale):
|
||||
if (body is AnimatableBody2D and body.scale >= required_scale) or (body is CharacterBody2D and body.scale >= player_required_scale):
|
||||
animation.play("Enable")
|
||||
deactivate_plate()
|
||||
|
||||
|
@ -28,7 +30,8 @@ func activate_plate():
|
|||
if not is_activated:
|
||||
is_activated = true
|
||||
if laser:
|
||||
laser.queue_free()
|
||||
laser.queue_free()
|
||||
# TODO: fix error when called again
|
||||
|
||||
func deactivate_plate():
|
||||
if is_activated:
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
extends StaticBody2D
|
||||
extends AnimatableBody2D
|
||||
|
||||
@export var scale_up_target: Vector2 = Vector2(1.0, 1.0)
|
||||
@export var scale_down_target: Vector2 = Vector2(0.5, 0.5)
|
||||
@export var scale_duration: float = 0.5
|
||||
@export var ui_actions: Node
|
||||
@export var small_sprite = preload("res://textures/antivirus-block-small.png")
|
||||
@export var large_sprite = preload("res://textures/antivirus-block-big.png")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue