Trying to add new enemy
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
extends Area2D
|
||||
|
||||
|
||||
onready var portal = get_node("../PortalDarkForest")
|
||||
onready var shape = portal.get_child(0)
|
||||
# Declare member variables here. Examples:
|
||||
# var a: int = 2
|
||||
# var b: String = "text"
|
||||
@@ -8,7 +9,7 @@ extends Area2D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
self.visible = false
|
||||
shape.set_deferred("disabled",true)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
@@ -16,5 +17,5 @@ func _ready() -> void:
|
||||
# pass
|
||||
|
||||
|
||||
func _on_Area2D_body_entered(body: Node) -> void:
|
||||
self.visible = true
|
||||
func _on_ChestDetection_body_entered(body: Node) -> void:
|
||||
shape.set_deferred("disabled",false)
|
||||
|
@@ -16,11 +16,10 @@ func _ready() -> void:
|
||||
# pass
|
||||
|
||||
|
||||
func _on_Area2D_body_entered(body: Node) -> void:
|
||||
self.limit_bottom = -223
|
||||
self.limit_top = -737
|
||||
func _on_PortalDarkForest_body_entered(body: Node) -> void:
|
||||
self.limit_bottom = -224
|
||||
self.limit_top = -736
|
||||
self.limit_left = -32
|
||||
self.limit_right = 448
|
||||
var player = get_parent()
|
||||
player.position = Vector2(-216,256)
|
||||
|
||||
#$YSort/Player/Camera2D.limit_bottom = -223
|
||||
#$YSort/Player/Camera2D.limit_top = -737
|
||||
player.position = Vector2(256,-232)
|
||||
|
File diff suppressed because one or more lines are too long
@@ -32,9 +32,7 @@ func _drop_object() -> void:
|
||||
|
||||
func _on_Area2D_player_entered(_player: KinematicBody2D) -> void:
|
||||
is_player_inside = true
|
||||
|
||||
|
||||
func _on_Area2D_player_exited(_player: KinematicBody2D) -> void:
|
||||
is_player_inside = false
|
||||
|
||||
|
||||
|
||||
|
@@ -127,7 +127,7 @@ tracks/3/keys = {
|
||||
"values": [ 0 ]
|
||||
}
|
||||
|
||||
[sub_resource type="SpriteFrames" id=6]
|
||||
[sub_resource type="SpriteFrames" id=5]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 6 ) ],
|
||||
"loop": true,
|
||||
@@ -140,12 +140,13 @@ animations = [ {
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="Animation" id=8]
|
||||
[sub_resource type="Animation" id=6]
|
||||
resource_name = "closed"
|
||||
|
||||
[node name="TreasureChest" type="AnimatedSprite"]
|
||||
position = Vector2( 1, 0 )
|
||||
frames = SubResource( 1 )
|
||||
animation = "open"
|
||||
animation = "closed"
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Area" type="Area2D" parent="."]
|
||||
@@ -166,12 +167,12 @@ texture = ExtResource( 4 )
|
||||
[node name="Tween" type="Tween" parent="Key"]
|
||||
|
||||
[node name="Entrance" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( 494, -675 )
|
||||
frames = SubResource( 6 )
|
||||
animation = "open"
|
||||
position = Vector2( 403, -715 )
|
||||
frames = SubResource( 5 )
|
||||
animation = "closed"
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Entrance"]
|
||||
anims/closed = SubResource( 8 )
|
||||
anims/closed = SubResource( 6 )
|
||||
|
||||
[connection signal="body_entered" from="Area" to="." method="_on_Area2D_player_entered"]
|
||||
[connection signal="body_exited" from="Area" to="." method="_on_Area2D_player_exited"]
|
||||
|
17
Levels/PortalDarkForest.gd
Normal file
17
Levels/PortalDarkForest.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
extends Area2D
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a: int = 2
|
||||
# var b: String = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
self.visible = false
|
||||
$CollisionShape2D.visible = false
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta: float) -> void:
|
||||
# pass
|
Reference in New Issue
Block a user