Fixed debugger errors in many files and optimized some scenes/code
This commit is contained in:
61
Enemies/Ghost Enemy.gd
Normal file
61
Enemies/Ghost Enemy.gd
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
extends KinematicBody2D
|
||||||
|
|
||||||
|
export var fireball: PackedScene
|
||||||
|
|
||||||
|
var player: KinematicBody2D = null
|
||||||
|
var move: Vector2 = Vector2.ZERO
|
||||||
|
const SPEED: int = 50
|
||||||
|
var counter: int = 0
|
||||||
|
var velocity: Vector2 = Vector2.ZERO
|
||||||
|
var health: int = 4
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
visible = false
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(_delta: float) -> void:
|
||||||
|
velocity = Vector2.ZERO
|
||||||
|
|
||||||
|
if player and position.distance_to(player.position) > 1:
|
||||||
|
velocity = position.direction_to(player.position).normalized() * SPEED
|
||||||
|
|
||||||
|
velocity = move_and_slide(velocity)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Area2D_body_entered(body: Node) -> void:
|
||||||
|
if body.is_in_group('player'):
|
||||||
|
player = body
|
||||||
|
if counter == 0:
|
||||||
|
self.visible = true
|
||||||
|
$AnimatedSprite.play('appear')
|
||||||
|
counter = 1
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
func _on_AnimatedSprite_animation_finished() -> void:
|
||||||
|
$AnimatedSprite.play('idle')
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Hitbox_area_entered(area: Area2D) -> void:
|
||||||
|
if area.is_in_group('player_weapon_1'):
|
||||||
|
health -= 1
|
||||||
|
elif area.is_in_group('player_weapon_2'):
|
||||||
|
health -= 2
|
||||||
|
if health <= 0:
|
||||||
|
$AnimatedSprite.play('vanish')
|
||||||
|
yield($AnimatedSprite, 'animation_finished')
|
||||||
|
call_deferred('queue_free')
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Projectile_Timer_timeout() -> void:
|
||||||
|
if player:
|
||||||
|
var projectile: Node = fireball.instance()
|
||||||
|
projectile.init($AnimatedSprite.global_position, player.position)
|
||||||
|
get_tree().get_current_scene().get_node('Projectiles').add_child(projectile)
|
||||||
|
$AnimatedSprite.play('shriek')
|
||||||
|
return
|
@@ -4,7 +4,7 @@
|
|||||||
[ext_resource path="res://Sprites/Assets/ghost-idle.png" type="Texture" id=2]
|
[ext_resource path="res://Sprites/Assets/ghost-idle.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://Sprites/Assets/ghost-shriek.png" type="Texture" id=3]
|
[ext_resource path="res://Sprites/Assets/ghost-shriek.png" type="Texture" id=3]
|
||||||
[ext_resource path="res://Sprites/Assets/ghost-vanish.png" type="Texture" id=4]
|
[ext_resource path="res://Sprites/Assets/ghost-vanish.png" type="Texture" id=4]
|
||||||
[ext_resource path="res://Enemies/Ghost_Enemy.gd" type="Script" id=5]
|
[ext_resource path="res://Enemies/Ghost Enemy.gd" type="Script" id=5]
|
||||||
[ext_resource path="res://Enemies/Projectiles/Fireball.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://Enemies/Projectiles/Fireball.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://Sprites/Levels/Environment/Fire_Column_Medium_14.png" type="Texture" id=7]
|
[ext_resource path="res://Sprites/Levels/Environment/Fire_Column_Medium_14.png" type="Texture" id=7]
|
||||||
|
|
||||||
@@ -36,29 +36,21 @@ region = Rect2( 320, 0, 64, 80 )
|
|||||||
atlas = ExtResource( 2 )
|
atlas = ExtResource( 2 )
|
||||||
region = Rect2( 384, 0, 64, 80 )
|
region = Rect2( 384, 0, 64, 80 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=8]
|
[sub_resource type="AtlasTexture" id=23]
|
||||||
atlas = ExtResource( 1 )
|
atlas = ExtResource( 3 )
|
||||||
region = Rect2( 0, 0, 64, 48 )
|
region = Rect2( 128, 0, 64, 80 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=9]
|
[sub_resource type="AtlasTexture" id=24]
|
||||||
atlas = ExtResource( 1 )
|
atlas = ExtResource( 3 )
|
||||||
region = Rect2( 64, 0, 64, 48 )
|
region = Rect2( 192, 0, 64, 80 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=10]
|
[sub_resource type="AtlasTexture" id=22]
|
||||||
atlas = ExtResource( 1 )
|
atlas = ExtResource( 3 )
|
||||||
region = Rect2( 128, 0, 64, 48 )
|
region = Rect2( 64, 0, 64, 80 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=11]
|
[sub_resource type="AtlasTexture" id=21]
|
||||||
atlas = ExtResource( 1 )
|
atlas = ExtResource( 3 )
|
||||||
region = Rect2( 192, 0, 64, 48 )
|
region = Rect2( 0, 0, 64, 80 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=12]
|
|
||||||
atlas = ExtResource( 1 )
|
|
||||||
region = Rect2( 256, 0, 64, 48 )
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=13]
|
|
||||||
atlas = ExtResource( 1 )
|
|
||||||
region = Rect2( 320, 0, 64, 48 )
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=14]
|
[sub_resource type="AtlasTexture" id=14]
|
||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 4 )
|
||||||
@@ -88,21 +80,29 @@ region = Rect2( 320, 0, 64, 64 )
|
|||||||
atlas = ExtResource( 4 )
|
atlas = ExtResource( 4 )
|
||||||
region = Rect2( 384, 0, 64, 64 )
|
region = Rect2( 384, 0, 64, 64 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=23]
|
[sub_resource type="AtlasTexture" id=8]
|
||||||
atlas = ExtResource( 3 )
|
atlas = ExtResource( 1 )
|
||||||
region = Rect2( 128, 0, 64, 80 )
|
region = Rect2( 0, 0, 64, 48 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=24]
|
[sub_resource type="AtlasTexture" id=9]
|
||||||
atlas = ExtResource( 3 )
|
atlas = ExtResource( 1 )
|
||||||
region = Rect2( 192, 0, 64, 80 )
|
region = Rect2( 64, 0, 64, 48 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=22]
|
[sub_resource type="AtlasTexture" id=10]
|
||||||
atlas = ExtResource( 3 )
|
atlas = ExtResource( 1 )
|
||||||
region = Rect2( 64, 0, 64, 80 )
|
region = Rect2( 128, 0, 64, 48 )
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id=21]
|
[sub_resource type="AtlasTexture" id=11]
|
||||||
atlas = ExtResource( 3 )
|
atlas = ExtResource( 1 )
|
||||||
region = Rect2( 0, 0, 64, 80 )
|
region = Rect2( 192, 0, 64, 48 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=12]
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 256, 0, 64, 48 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=13]
|
||||||
|
atlas = ExtResource( 1 )
|
||||||
|
region = Rect2( 320, 0, 64, 48 )
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id=25]
|
[sub_resource type="SpriteFrames" id=25]
|
||||||
animations = [ {
|
animations = [ {
|
||||||
@@ -111,9 +111,9 @@ animations = [ {
|
|||||||
"name": "idle",
|
"name": "idle",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ) ],
|
"frames": [ SubResource( 23 ), SubResource( 24 ), SubResource( 22 ), SubResource( 21 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "appear",
|
"name": "shriek",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ) ],
|
"frames": [ SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ) ],
|
||||||
@@ -121,9 +121,9 @@ animations = [ {
|
|||||||
"name": "vanish",
|
"name": "vanish",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ SubResource( 23 ), SubResource( 24 ), SubResource( 22 ), SubResource( 21 ) ],
|
"frames": [ SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "shriek",
|
"name": "appear",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
} ]
|
} ]
|
||||||
|
|
||||||
@@ -144,10 +144,10 @@ orbit_velocity_random = 0.0
|
|||||||
color = Color( 0.729412, 0, 0, 1 )
|
color = Color( 0.729412, 0, 0, 1 )
|
||||||
hue_variation = 1.0
|
hue_variation = 1.0
|
||||||
|
|
||||||
[node name="KinematicBody2D" type="KinematicBody2D"]
|
[node name="Ghost Enemy" type="KinematicBody2D"]
|
||||||
z_index = 2
|
z_index = 2
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
Fireball = ExtResource( 6 )
|
fireball = ExtResource( 6 )
|
||||||
|
|
||||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||||
frames = SubResource( 25 )
|
frames = SubResource( 25 )
|
||||||
@@ -165,9 +165,7 @@ shape = SubResource( 26 )
|
|||||||
position = Vector2( 0.530334, 11.3032 )
|
position = Vector2( 0.530334, 11.3032 )
|
||||||
shape = SubResource( 27 )
|
shape = SubResource( 27 )
|
||||||
|
|
||||||
[node name="Hitbox" type="Area2D" parent="." groups=[
|
[node name="Hitbox" type="Area2D" parent="." groups=["enemy_hitbox_1"]]
|
||||||
"enemy_hitbox_1",
|
|
||||||
]]
|
|
||||||
light_mask = 0
|
light_mask = 0
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 2
|
collision_mask = 2
|
@@ -1,61 +0,0 @@
|
|||||||
extends KinematicBody2D
|
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
|
||||||
# var a: int = 2
|
|
||||||
# var b: String = "text"
|
|
||||||
export var Fireball: PackedScene
|
|
||||||
onready var player = null
|
|
||||||
var move = Vector2.ZERO
|
|
||||||
var SPEED = 50
|
|
||||||
var counter = 0
|
|
||||||
var velocity: Vector2 = Vector2.ZERO
|
|
||||||
var health: int = 4
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
self.visible = false
|
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
|
||||||
velocity = Vector2.ZERO
|
|
||||||
|
|
||||||
if player and position.distance_to(player.position) > 1:
|
|
||||||
velocity = position.direction_to(player.position).normalized() * SPEED
|
|
||||||
velocity = move_and_slide(velocity)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _on_Area2D_body_entered(body):
|
|
||||||
if body.is_in_group('player'):
|
|
||||||
player = body
|
|
||||||
if counter == 0:
|
|
||||||
self.visible = true
|
|
||||||
$AnimatedSprite.play("appear")
|
|
||||||
counter = 1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _on_AnimatedSprite_animation_finished():
|
|
||||||
$AnimatedSprite.play("idle")
|
|
||||||
|
|
||||||
|
|
||||||
func _on_Hitbox_area_entered(area):
|
|
||||||
if area.is_in_group('player_weapon_1'):
|
|
||||||
health -= 1
|
|
||||||
elif area.is_in_group('player_weapon_2'):
|
|
||||||
health -= 2
|
|
||||||
if health <= 0:
|
|
||||||
$AnimatedSprite.play("vanish")
|
|
||||||
yield($AnimatedSprite, "animation_finished")
|
|
||||||
call_deferred('queue_free')
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
func _on_Projectile_Timer_timeout():
|
|
||||||
if player:
|
|
||||||
var projectile: Node = Fireball.instance()
|
|
||||||
projectile.init($AnimatedSprite.global_position, player.position)
|
|
||||||
get_tree().get_current_scene().get_node('Projectiles').add_child(projectile)
|
|
||||||
$AnimatedSprite.play("shriek")
|
|
@@ -1,47 +1,49 @@
|
|||||||
extends KinematicBody2D
|
extends KinematicBody2D
|
||||||
|
|
||||||
onready var SNOWBALL_BLUE_SCENE = preload("res://Enemies/Snowball Blue.tscn")
|
onready var SNOWBALL_BLUE_SCENE: Resource = preload('res://Enemies/Snowball Blue.tscn')
|
||||||
|
|
||||||
var player = null
|
var player: KinematicBody2D = null
|
||||||
var move = Vector2.ZERO
|
var velocity: Vector2 = Vector2.ZERO
|
||||||
var speed = .5
|
const SPEED: int = 50
|
||||||
var health: int = 2
|
var health: int = 2
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(_delta: float) -> void:
|
||||||
move = Vector2.ZERO
|
velocity = Vector2.ZERO
|
||||||
|
|
||||||
if player != null:
|
if player and position.distance_to(player.position) > 1:
|
||||||
move = position.direction_to(player.position) * speed
|
velocity = position.direction_to(player.position).normalized() * SPEED
|
||||||
else:
|
|
||||||
move = Vector2.ZERO
|
|
||||||
|
|
||||||
move = move.normalized()
|
|
||||||
move = move_and_collide(move)
|
|
||||||
|
|
||||||
|
velocity = move_and_slide(velocity)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_Area2D_body_entered(body: Node) -> void:
|
func _on_Area2D_body_entered(body: Node) -> void:
|
||||||
if body != self && !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
|
if body != self && !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
|
||||||
player = body
|
player = body
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_Area2D_body_exited(body: Node) -> void:
|
func _on_Area2D_body_exited(body: Node) -> void:
|
||||||
if !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
|
if !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
|
||||||
player = null
|
player = null
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func fire():
|
func fire() -> void:
|
||||||
var snowball = SNOWBALL_BLUE_SCENE.instance()
|
var snowball = SNOWBALL_BLUE_SCENE.instance()
|
||||||
snowball.position = get_global_position()
|
snowball.position = get_global_position()
|
||||||
snowball.player = player
|
snowball.player = player
|
||||||
get_parent().add_child(snowball)
|
get_parent().add_child(snowball)
|
||||||
$Timer.set_wait_time(1)
|
$Timer.set_wait_time(1)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_Timer_timeout() -> void:
|
func _on_Timer_timeout() -> void:
|
||||||
if player != null:
|
if player != null:
|
||||||
fire()
|
fire()
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_player_detector_area_entered(area: Area2D) -> void:
|
func _on_player_detector_area_entered(area: Area2D) -> void:
|
||||||
if area.get_parent().name == 'Player':
|
if area.get_parent().name == 'Player':
|
||||||
@@ -49,10 +51,11 @@ func _on_player_detector_area_entered(area: Area2D) -> void:
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_player_detector_area_exited(_area: Area2D):
|
func _on_player_detector_area_exited(_area: Area2D) -> void:
|
||||||
player = null
|
player = null
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_hitbox_area_entered(area: Area2D) -> void:
|
func _on_hitbox_area_entered(area: Area2D) -> void:
|
||||||
if area.is_in_group('player_weapon_1'):
|
if area.is_in_group('player_weapon_1'):
|
||||||
health -= 1
|
health -= 1
|
||||||
|
@@ -1,47 +1,48 @@
|
|||||||
extends KinematicBody2D
|
extends KinematicBody2D
|
||||||
|
|
||||||
onready var SNOWBALL_SCENE = preload("res://Enemies/Snowball.tscn")
|
onready var SNOWBALL_SCENE: Resource = preload('res://Enemies/Snowball.tscn')
|
||||||
|
|
||||||
var player = null
|
var player: KinematicBody2D = null
|
||||||
var move = Vector2.ZERO
|
var velocity: Vector2 = Vector2.ZERO
|
||||||
var speed = .5
|
const SPEED: int = 50
|
||||||
var health: int = 2
|
var health: int = 2
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(_delta: float) -> void:
|
||||||
move = Vector2.ZERO
|
velocity = Vector2.ZERO
|
||||||
|
|
||||||
if player != null:
|
if player and position.distance_to(player.position) > 1:
|
||||||
move = position.direction_to(player.position) * speed
|
velocity = position.direction_to(player.position).normalized() * SPEED
|
||||||
else:
|
|
||||||
move = Vector2.ZERO
|
|
||||||
|
|
||||||
move = move.normalized()
|
|
||||||
move = move_and_collide(move)
|
|
||||||
|
|
||||||
|
velocity = move_and_slide(velocity)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_Area2D_body_entered(body: Node) -> void:
|
func _on_Area2D_body_entered(body: Node) -> void:
|
||||||
if body != self && !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
|
if body != self && !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
|
||||||
player = body
|
player = body
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_Area2D_body_exited(body: Node) -> void:
|
func _on_Area2D_body_exited(body: Node) -> void:
|
||||||
if !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
|
if !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
|
||||||
player = null
|
player = null
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func fire():
|
func fire() -> void:
|
||||||
var snowball = SNOWBALL_SCENE.instance()
|
var snowball = SNOWBALL_SCENE.instance()
|
||||||
snowball.position = get_global_position()
|
snowball.position = get_global_position()
|
||||||
snowball.player = player
|
snowball.player = player
|
||||||
get_parent().add_child(snowball)
|
get_parent().add_child(snowball)
|
||||||
$Timer.set_wait_time(1)
|
$Timer.set_wait_time(1)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_Timer_timeout() -> void:
|
func _on_Timer_timeout() -> void:
|
||||||
if player != null:
|
if player != null:
|
||||||
fire()
|
fire()
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_player_detector_area_entered(area: Area2D) -> void:
|
func _on_player_detector_area_entered(area: Area2D) -> void:
|
||||||
@@ -50,12 +51,12 @@ func _on_player_detector_area_entered(area: Area2D) -> void:
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_player_detector_area_exited(_area: Area2D):
|
func _on_player_detector_area_exited(_area: Area2D) -> void:
|
||||||
player = null
|
player = null
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_hitbox_area_entered(area: Area2D) -> void:
|
func _on_hitbox_area_entered(area: Area2D) -> void:
|
||||||
print("HIT")
|
|
||||||
if area.is_in_group('player_weapon_1'):
|
if area.is_in_group('player_weapon_1'):
|
||||||
health -= 1
|
health -= 1
|
||||||
elif area.is_in_group('player_weapon_2'):
|
elif area.is_in_group('player_weapon_2'):
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
extends Label
|
extends Label
|
||||||
|
|
||||||
signal timer_end
|
signal timer_out
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
@@ -8,5 +8,5 @@ func _process(_delta: float) -> void:
|
|||||||
set_text('%02d:%02d' % [time_seconds, int(($Timer.get_time_left() - time_seconds) * 100)])
|
set_text('%02d:%02d' % [time_seconds, int(($Timer.get_time_left() - time_seconds) * 100)])
|
||||||
|
|
||||||
if $Timer.get_time_left() == 0:
|
if $Timer.get_time_left() == 0:
|
||||||
get_tree().change_scene('res://Levels/Hub World.tscn')
|
emit_signal('timer_out')
|
||||||
return
|
return
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
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"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
shape.set_deferred("disabled",true)
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta: float) -> void:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
func _on_ChestDetection_body_entered(body: Node) -> void:
|
|
||||||
shape.set_deferred("disabled",false)
|
|
@@ -1,29 +1,13 @@
|
|||||||
extends Camera2D
|
extends Camera2D
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
|
||||||
# var a: int = 2
|
|
||||||
# var b: String = "text"
|
|
||||||
|
|
||||||
signal enter_portal
|
signal enter_portal
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
func _on_PortalDarkForest_body_entered(_body: Node) -> void:
|
||||||
func _ready() -> void:
|
limit_bottom = -224
|
||||||
pass # Replace with function body.
|
limit_top = -736
|
||||||
|
limit_left = -32
|
||||||
|
limit_right = 448
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
get_parent().position = Vector2(256, -232)
|
||||||
#func _process(delta: float) -> void:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
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(256,-232)
|
|
||||||
emit_signal('enter_portal')
|
emit_signal('enter_portal')
|
||||||
|
return
|
||||||
|
15
Levels/Chest Detection.gd
Normal file
15
Levels/Chest Detection.gd
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
extends Area2D
|
||||||
|
|
||||||
|
onready var portal = get_node('../PortalDarkForest')
|
||||||
|
onready var shape = portal.get_child(0)
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
shape.set_deferred('disabled', true)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
func _on_chest_detection_body_entered(body: Node) -> void:
|
||||||
|
if body.is_in_group('player'):
|
||||||
|
shape.set_deferred('disabled', false)
|
||||||
|
return
|
@@ -3,8 +3,8 @@ extends Area2D
|
|||||||
signal coin_grabbed
|
signal coin_grabbed
|
||||||
|
|
||||||
|
|
||||||
func _on_Node2D_body_entered(body: Node) -> void:
|
func _on_coin_body_entered(body: Node) -> void:
|
||||||
if body.get_name() == 'Player':
|
if body.is_in_group('player'):
|
||||||
emit_signal("coin_grabbed")
|
emit_signal('coin_grabbed')
|
||||||
print("coin!")
|
call_deferred('queue_free')
|
||||||
queue_free()
|
return
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
radius = 6.38067
|
radius = 6.38067
|
||||||
|
|
||||||
[node name="coin" type="Area2D"]
|
[node name="Coin" type="Area2D"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
[node name="Sprite" type="Sprite" parent="."]
|
||||||
@@ -16,4 +16,4 @@ texture = ExtResource( 2 )
|
|||||||
[node name="coin" type="CollisionShape2D" parent="."]
|
[node name="coin" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
[connection signal="body_entered" from="." to="." method="_on_Node2D_body_entered"]
|
[connection signal="body_entered" from="." to="." method="_on_coin_body_entered"]
|
||||||
|
@@ -1,24 +1,11 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
func _on_AnimationPlayer_animation_finished(_anim_name: String) -> void:
|
||||||
# var a: int = 2
|
|
||||||
# var b: String = "text"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta: float) -> void:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
func _on_AnimationPlayer_animation_finished(anim_name: String) -> void:
|
|
||||||
$GemSprite.visible = false
|
$GemSprite.visible = false
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_AnimationPlayer_animation_started(anim_name: String) -> void:
|
func _on_AnimationPlayer_animation_started(_anim_name: String) -> void:
|
||||||
$GemSprite.visible = true
|
$GemSprite.visible = true
|
||||||
|
return
|
||||||
|
@@ -1,18 +1,18 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
#$YSort/Player.position = get_viewport_rect().size / 2
|
|
||||||
$YSort/Player.position = Vector2(0,0)
|
|
||||||
$YSort/Player.load_hud($HUD)
|
$YSort/Player.load_hud($HUD)
|
||||||
$HUD/Control.visible = false
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_Area2D_body_entered(body):
|
func _on_journal_page_body_entered(body: Node) -> void:
|
||||||
$HUD/Control.visible = true
|
if body.is_in_group('player'):
|
||||||
#print("j")
|
$'HUD/Journal Page Dialogue'.visible = true
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_Camera2D_enter_portal() -> void:
|
func _on_Camera2D_enter_portal() -> void:
|
||||||
$BGM1.stop()
|
$BGM1.stop()
|
||||||
$BGM2.play()
|
$BGM2.play()
|
||||||
|
return
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=90 format=2]
|
[gd_scene load_steps=91 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://Levels/Level 2.gd" type="Script" id=2]
|
[ext_resource path="res://Levels/Level 2.gd" type="Script" id=2]
|
||||||
@@ -8,10 +8,10 @@
|
|||||||
[ext_resource path="res://Levels/Objects/Chest.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://Levels/Objects/Chest.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://Sprites/Assets/cliffTileset.png" type="Texture" id=7]
|
[ext_resource path="res://Sprites/Assets/cliffTileset.png" type="Texture" id=7]
|
||||||
[ext_resource path="res://GUI/HUD.tscn" type="PackedScene" id=8]
|
[ext_resource path="res://GUI/HUD.tscn" type="PackedScene" id=8]
|
||||||
[ext_resource path="res://Enemies/Ghost_Enemy.tscn" type="PackedScene" id=9]
|
[ext_resource path="res://Enemies/Ghost Enemy.tscn" type="PackedScene" id=9]
|
||||||
[ext_resource path="res://Sprites/Assets/DeadTree.png" type="Texture" id=10]
|
[ext_resource path="res://Sprites/Assets/DeadTree.png" type="Texture" id=10]
|
||||||
[ext_resource path="res://Sprites/Assets/darkForestTileset.png" type="Texture" id=11]
|
[ext_resource path="res://Sprites/Assets/darkForestTileset.png" type="Texture" id=11]
|
||||||
[ext_resource path="res://Levels/Area2D.gd" type="Script" id=12]
|
[ext_resource path="res://Levels/Chest Detection.gd" type="Script" id=12]
|
||||||
[ext_resource path="res://Levels/Camera2D.gd" type="Script" id=13]
|
[ext_resource path="res://Levels/Camera2D.gd" type="Script" id=13]
|
||||||
[ext_resource path="res://Sprites/Assets/Shadow.png" type="Texture" id=14]
|
[ext_resource path="res://Sprites/Assets/Shadow.png" type="Texture" id=14]
|
||||||
[ext_resource path="res://Levels/Traps/Spawn Trap.tscn" type="PackedScene" id=15]
|
[ext_resource path="res://Levels/Traps/Spawn Trap.tscn" type="PackedScene" id=15]
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
[ext_resource path="res://Levels/Objects/Dialogue.tscn" type="PackedScene" id=19]
|
[ext_resource path="res://Levels/Objects/Dialogue.tscn" type="PackedScene" id=19]
|
||||||
[ext_resource path="res://Music/Level_2_2.mp3" type="AudioStream" id=20]
|
[ext_resource path="res://Music/Level_2_2.mp3" type="AudioStream" id=20]
|
||||||
[ext_resource path="res://Music/Level_2_1.mp3" type="AudioStream" id=21]
|
[ext_resource path="res://Music/Level_2_1.mp3" type="AudioStream" id=21]
|
||||||
|
[ext_resource path="res://Levels/Portal Dark Forest.gd" type="Script" id=22]
|
||||||
|
|
||||||
[sub_resource type="TileSet" id=1]
|
[sub_resource type="TileSet" id=1]
|
||||||
0/name = "darkForestTileset.png 0"
|
0/name = "darkForestTileset.png 0"
|
||||||
@@ -797,11 +798,6 @@ radius = 22.8792
|
|||||||
[node name="World" type="Node2D"]
|
[node name="World" type="Node2D"]
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="HUD" parent="." instance=ExtResource( 8 )]
|
|
||||||
|
|
||||||
[node name="Control" parent="HUD" instance=ExtResource( 19 )]
|
|
||||||
visible = false
|
|
||||||
|
|
||||||
[node name="YSort" type="YSort" parent="."]
|
[node name="YSort" type="YSort" parent="."]
|
||||||
|
|
||||||
[node name="Player" parent="YSort" instance=ExtResource( 1 )]
|
[node name="Player" parent="YSort" instance=ExtResource( 1 )]
|
||||||
@@ -897,32 +893,31 @@ position = Vector2( 350, 0 )
|
|||||||
scale = Vector2( 0.5, 0.5 )
|
scale = Vector2( 0.5, 0.5 )
|
||||||
z_index = 4
|
z_index = 4
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="Collectible"]
|
[node name="Journal Page" type="Area2D" parent="Collectible"]
|
||||||
collision_layer = 3
|
collision_layer = 3
|
||||||
collision_mask = 3
|
collision_mask = 3
|
||||||
|
|
||||||
[node name="Sprite2" type="Sprite" parent="Collectible/Area2D"]
|
[node name="Sprite" type="Sprite" parent="Collectible/Journal Page"]
|
||||||
texture = ExtResource( 18 )
|
texture = ExtResource( 18 )
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Collectible/Area2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Collectible/Journal Page"]
|
||||||
shape = SubResource( 68 )
|
shape = SubResource( 68 )
|
||||||
|
|
||||||
[node name="Pause Screen" parent="." instance=ExtResource( 5 )]
|
|
||||||
|
|
||||||
[node name="TreasureChest" parent="." instance=ExtResource( 6 )]
|
[node name="TreasureChest" parent="." instance=ExtResource( 6 )]
|
||||||
position = Vector2( 54, 170 )
|
position = Vector2( 54, 170 )
|
||||||
scale = Vector2( 0.5, 0.5 )
|
scale = Vector2( 0.5, 0.5 )
|
||||||
object_scene = ExtResource( 6 )
|
object_scene = ExtResource( 6 )
|
||||||
|
|
||||||
[node name="ChestDetection" type="Area2D" parent="TreasureChest"]
|
[node name="Chest Detection" type="Area2D" parent="TreasureChest"]
|
||||||
script = ExtResource( 12 )
|
script = ExtResource( 12 )
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="TreasureChest/ChestDetection"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="TreasureChest/Chest Detection"]
|
||||||
position = Vector2( -1.78381, -1.75043 )
|
position = Vector2( -1.78381, -1.75043 )
|
||||||
scale = Vector2( 3.08, 1.96 )
|
scale = Vector2( 3.08, 1.96 )
|
||||||
shape = SubResource( 65 )
|
shape = SubResource( 65 )
|
||||||
|
|
||||||
[node name="PortalDarkForest" type="Area2D" parent="TreasureChest"]
|
[node name="PortalDarkForest" type="Area2D" parent="TreasureChest"]
|
||||||
|
script = ExtResource( 22 )
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="TreasureChest/PortalDarkForest"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="TreasureChest/PortalDarkForest"]
|
||||||
position = Vector2( 402.642, -712.75 )
|
position = Vector2( 402.642, -712.75 )
|
||||||
@@ -934,6 +929,7 @@ shape = SubResource( 66 )
|
|||||||
|
|
||||||
[node name="Spawn Trap" parent="Traps" instance=ExtResource( 15 )]
|
[node name="Spawn Trap" parent="Traps" instance=ExtResource( 15 )]
|
||||||
position = Vector2( 296.416, -364.541 )
|
position = Vector2( 296.416, -364.541 )
|
||||||
|
enemy_path = "res://Enemies/Ghost Enemy.tscn"
|
||||||
|
|
||||||
[node name="Skull" type="TileMap" parent="."]
|
[node name="Skull" type="TileMap" parent="."]
|
||||||
modulate = Color( 0.658824, 0.658824, 0.658824, 1 )
|
modulate = Color( 0.658824, 0.658824, 0.658824, 1 )
|
||||||
@@ -942,6 +938,13 @@ tile_set = SubResource( 67 )
|
|||||||
format = 1
|
format = 1
|
||||||
tile_data = PoolIntArray( -589828, 0, 0, -458754, 0, 0, -393220, 0, 0 )
|
tile_data = PoolIntArray( -589828, 0, 0, -458754, 0, 0, -393220, 0, 0 )
|
||||||
|
|
||||||
|
[node name="HUD" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
||||||
|
[node name="Journal Page Dialogue" parent="HUD" instance=ExtResource( 19 )]
|
||||||
|
visible = false
|
||||||
|
|
||||||
|
[node name="Pause Screen" parent="." instance=ExtResource( 5 )]
|
||||||
|
|
||||||
[node name="BGM1" type="AudioStreamPlayer" parent="."]
|
[node name="BGM1" type="AudioStreamPlayer" parent="."]
|
||||||
stream = ExtResource( 21 )
|
stream = ExtResource( 21 )
|
||||||
volume_db = -10.0
|
volume_db = -10.0
|
||||||
@@ -952,6 +955,6 @@ stream = ExtResource( 20 )
|
|||||||
volume_db = -10.0
|
volume_db = -10.0
|
||||||
|
|
||||||
[connection signal="enter_portal" from="YSort/Player/Camera2D" to="." method="_on_Camera2D_enter_portal"]
|
[connection signal="enter_portal" from="YSort/Player/Camera2D" to="." method="_on_Camera2D_enter_portal"]
|
||||||
[connection signal="body_entered" from="Collectible/Area2D" to="." method="_on_Area2D_body_entered"]
|
[connection signal="body_entered" from="Collectible/Journal Page" to="." method="_on_journal_page_body_entered"]
|
||||||
[connection signal="body_entered" from="TreasureChest/ChestDetection" to="TreasureChest/ChestDetection" method="_on_ChestDetection_body_entered"]
|
[connection signal="body_entered" from="TreasureChest/Chest Detection" to="TreasureChest/Chest Detection" method="_on_chest_detection_body_entered"]
|
||||||
[connection signal="body_entered" from="TreasureChest/PortalDarkForest" to="YSort/Player/Camera2D" method="_on_PortalDarkForest_body_entered"]
|
[connection signal="body_entered" from="TreasureChest/PortalDarkForest" to="YSort/Player/Camera2D" method="_on_PortalDarkForest_body_entered"]
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
onready var coin = preload('res://Levels/Interactables/Coin.tscn')
|
onready var coin: Resource = preload('res://Levels/Interactables/Coin.tscn')
|
||||||
|
|
||||||
var screensize
|
var screensize: Vector2
|
||||||
var score = 0
|
var score: int = 0
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -17,7 +17,8 @@ func spawn_coins(num: int) -> void:
|
|||||||
for _i in range(num):
|
for _i in range(num):
|
||||||
var g: Node = coin.instance()
|
var g: Node = coin.instance()
|
||||||
$'coin_container'.add_child(g)
|
$'coin_container'.add_child(g)
|
||||||
g.connect('coin_grabbed', self, '_on_coin_grabbed')
|
if g.connect('coin_grabbed', self, '_on_coin_grabbed') != OK:
|
||||||
|
print('ERROR: Coin "coin_grabbed" signal already connected.')
|
||||||
#g.set_pos(Vector2(rand_range(0, screensize.x - 40), rand_range(0, screensize.y - 40)))
|
#g.set_pos(Vector2(rand_range(0, screensize.x - 40), rand_range(0, screensize.y - 40)))
|
||||||
g.position = Vector2(rand_range(0, screensize.x - 40), rand_range(0, screensize.y - 40))
|
g.position = Vector2(rand_range(0, screensize.x - 40), rand_range(0, screensize.y - 40))
|
||||||
return
|
return
|
||||||
@@ -25,13 +26,13 @@ func spawn_coins(num: int) -> void:
|
|||||||
|
|
||||||
func _on_coin_grabbed() -> void:
|
func _on_coin_grabbed() -> void:
|
||||||
score += 1
|
score += 1
|
||||||
print(score)
|
|
||||||
$'Level 3 HUD/Label'.set_text(str(score) + '/5')
|
$'Level 3 HUD/Label'.set_text(str(score) + '/5')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
func _timer_out() -> void:
|
func _timer_out() -> void:
|
||||||
get_tree().change_scene('res://Levels/Hub World.tscn')
|
if get_tree().change_scene('res://GUI/Level Failed.tscn') != OK:
|
||||||
|
print('ERROR: Level 3 failed to change scene to Level Failed.')
|
||||||
queue_free()
|
queue_free()
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -43,15 +44,9 @@ func _on_TreasureChest_ice_key_collected() -> void:
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_DoorDetector_body_entered(body: Node) -> void:
|
|
||||||
if body.is_in_group('player'):
|
|
||||||
print('WIN WIN WIN')
|
|
||||||
get_tree().change_scene('res://Levels/Hub World.tscn')
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
func _on_DoorDetector_area_entered(area: Area2D) -> void:
|
func _on_DoorDetector_area_entered(area: Area2D) -> void:
|
||||||
if area.get_parent().name == 'Player':
|
if area.get_parent().name == 'Player':
|
||||||
get_tree().change_scene('res://GUI/Level Complete.tscn')
|
if get_tree().change_scene('res://GUI/Level Complete.tscn') != OK:
|
||||||
|
print('ERROR: Level 3 failed to change scene to Level Complete.')
|
||||||
queue_free()
|
queue_free()
|
||||||
return
|
return
|
||||||
|
@@ -127,31 +127,23 @@ position = Vector2( 250.562, 86.6365 )
|
|||||||
|
|
||||||
[node name="Enemies" type="YSort" parent="YSort"]
|
[node name="Enemies" type="YSort" parent="YSort"]
|
||||||
|
|
||||||
[node name="Snowman 1" parent="YSort/Enemies" groups=[
|
[node name="Snowman 1" parent="YSort/Enemies" groups=["enemies"] instance=ExtResource( 4 )]
|
||||||
"enemies",
|
|
||||||
] instance=ExtResource( 4 )]
|
|
||||||
position = Vector2( 268.977, 221.859 )
|
position = Vector2( 268.977, 221.859 )
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 5
|
collision_mask = 5
|
||||||
|
|
||||||
[node name="Snowman 2" parent="YSort/Enemies" groups=[
|
[node name="Snowman 2" parent="YSort/Enemies" groups=["enemies"] instance=ExtResource( 4 )]
|
||||||
"enemies",
|
|
||||||
] instance=ExtResource( 4 )]
|
|
||||||
position = Vector2( 124.417, 123.977 )
|
position = Vector2( 124.417, 123.977 )
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 5
|
collision_mask = 5
|
||||||
|
|
||||||
[node name="Blue Snowman 1" parent="YSort/Enemies" groups=[
|
[node name="Blue Snowman 1" parent="YSort/Enemies" groups=["enemies"] instance=ExtResource( 6 )]
|
||||||
"enemies",
|
|
||||||
] instance=ExtResource( 6 )]
|
|
||||||
position = Vector2( 252.747, 40.9419 )
|
position = Vector2( 252.747, 40.9419 )
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 5
|
collision_mask = 5
|
||||||
script = ExtResource( 7 )
|
script = ExtResource( 7 )
|
||||||
|
|
||||||
[node name="Blue Snowman 2" parent="YSort/Enemies" groups=[
|
[node name="Blue Snowman 2" parent="YSort/Enemies" groups=["enemies"] instance=ExtResource( 6 )]
|
||||||
"enemies",
|
|
||||||
] instance=ExtResource( 6 )]
|
|
||||||
position = Vector2( 105.053, 195.4 )
|
position = Vector2( 105.053, 195.4 )
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 5
|
collision_mask = 5
|
||||||
@@ -233,3 +225,4 @@ autoplay = true
|
|||||||
[connection signal="ice_key_collected" from="YSort/TreasureChest" to="." method="_on_TreasureChest_ice_key_collected"]
|
[connection signal="ice_key_collected" from="YSort/TreasureChest" to="." method="_on_TreasureChest_ice_key_collected"]
|
||||||
[connection signal="frozen" from="YSort/Player" to="Effects/SlowTime" method="start"]
|
[connection signal="frozen" from="YSort/Player" to="Effects/SlowTime" method="start"]
|
||||||
[connection signal="unfreeze" from="Effects/SlowTime" to="YSort/Player" method="_on_SlowTime_unfreeze"]
|
[connection signal="unfreeze" from="Effects/SlowTime" to="YSort/Player" method="_on_SlowTime_unfreeze"]
|
||||||
|
[connection signal="timer_out" from="HUD/Countdown Timer" to="." method="_timer_out"]
|
||||||
|
@@ -27,8 +27,11 @@ func _on_NextArea_area_entered(area: Area2D) -> void:
|
|||||||
|
|
||||||
func _on_Demon_Boss_demon_boss_death() -> void:
|
func _on_Demon_Boss_demon_boss_death() -> void:
|
||||||
$Timer.start()
|
$Timer.start()
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_Timer_timeout() -> void:
|
func _on_Timer_timeout() -> void:
|
||||||
get_tree().change_scene('res://GUI/Level Complete.tscn')
|
if get_tree().change_scene('res://GUI/Level Complete.tscn') != OK:
|
||||||
|
print('ERROR: Level 4 failed to change scene to Level Complete.')
|
||||||
queue_free()
|
queue_free()
|
||||||
|
return
|
||||||
|
@@ -1,38 +1,33 @@
|
|||||||
extends AnimatedSprite
|
extends AnimatedSprite
|
||||||
|
|
||||||
export(PackedScene) var object_scene: PackedScene = null
|
export var object_scene: PackedScene = null
|
||||||
|
|
||||||
var is_player_inside: bool = false
|
|
||||||
var is_opened: bool = false
|
|
||||||
var has_key: bool = false
|
var has_key: bool = false
|
||||||
|
|
||||||
onready var animation_player: AnimationPlayer = get_node("AnimationPlayer")
|
|
||||||
onready var tween: Tween = get_node("Key/Tween")
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
assert(object_scene!=null)
|
assert(object_scene != null)
|
||||||
animation_player.play("closed")
|
$AnimationPlayer.play('closed')
|
||||||
$Key/KeySprite.visible = false
|
$Key/KeySprite.visible = false
|
||||||
|
return
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
|
||||||
if is_player_inside and not is_opened:
|
func _on_area_body_entered(body: Node) -> void:
|
||||||
is_opened = true
|
if body.is_in_group('player'):
|
||||||
animation_player.play("open")
|
$Area/CollisionShape2D.set_deferred('disabled', true)
|
||||||
|
$AnimationPlayer.play('open')
|
||||||
_drop_object()
|
_drop_object()
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _drop_object() -> void:
|
func _drop_object() -> void:
|
||||||
#print($Key.position)
|
|
||||||
$Key/KeySprite.visible = true
|
$Key/KeySprite.visible = true
|
||||||
tween.interpolate_property($Key, "position", Vector2(0,0), Vector2(0, -10), 1.0, Tween.TRANS_QUAD,
|
if not $Key/Tween.interpolate_property($Key, 'position', Vector2(0,0), Vector2(0, -10), 1.0,
|
||||||
Tween.EASE_OUT)
|
Tween.TRANS_QUAD, Tween.EASE_OUT):
|
||||||
tween.start()
|
print('ERROR: Chest key animation has errors.')
|
||||||
yield(tween, "tween_completed")
|
if not $Key/Tween.start():
|
||||||
|
print('ERROR: Chest key animation failed to start.')
|
||||||
|
|
||||||
|
yield($Key/Tween, 'tween_completed')
|
||||||
$Key/KeySprite.visible = false
|
$Key/KeySprite.visible = false
|
||||||
|
return
|
||||||
|
|
||||||
func _on_Area2D_player_entered(_player: KinematicBody2D) -> void:
|
|
||||||
is_player_inside = true
|
|
||||||
|
|
||||||
|
|
||||||
func _on_Area2D_player_exited(_player: KinematicBody2D) -> void:
|
|
||||||
is_player_inside = false
|
|
||||||
|
@@ -174,5 +174,4 @@ animation = "closed"
|
|||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Entrance"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="Entrance"]
|
||||||
anims/closed = SubResource( 6 )
|
anims/closed = SubResource( 6 )
|
||||||
|
|
||||||
[connection signal="body_entered" from="Area" to="." method="_on_Area2D_player_entered"]
|
[connection signal="body_entered" from="Area" to="." method="_on_area_body_entered"]
|
||||||
[connection signal="body_exited" from="Area" to="." method="_on_Area2D_player_exited"]
|
|
||||||
|
@@ -1,32 +1,36 @@
|
|||||||
extends ColorRect
|
extends ColorRect
|
||||||
|
|
||||||
export var dialogPath = ""
|
export var dialog_path: String = ''
|
||||||
export(float) var textSpeed = 0.05
|
export var text_speed: float = 0.05
|
||||||
|
|
||||||
var dialog
|
var dialog: Array
|
||||||
var phraseNum = 0
|
var phrase_num: int = 0
|
||||||
var finished = false
|
var finished = false
|
||||||
|
|
||||||
func _ready():
|
|
||||||
# self.visible = false
|
func _ready() -> void:
|
||||||
$Timer.wait_time = textSpeed
|
$Timer.wait_time = text_speed
|
||||||
dialog = getDialog()
|
dialog = get_dialog()
|
||||||
assert(dialog, "Dialong not found")
|
assert(dialog, 'Dialog not found')
|
||||||
nextPhrase()
|
next_phrase()
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
func _input(event: InputEvent) -> void:
|
||||||
$Indicator.visible = finished
|
$Indicator.visible = finished
|
||||||
if Input.is_action_just_pressed("ui_accept"):
|
if event.is_action_pressed('ui_accept'):
|
||||||
if finished:
|
if finished:
|
||||||
nextPhrase()
|
next_phrase()
|
||||||
else:
|
else:
|
||||||
$Text.visible_characters = len($Text.text)
|
$Text.visible_characters = len($Text.text)
|
||||||
func getDialog() -> Array:
|
return
|
||||||
var f = File.new()
|
|
||||||
assert(f.file_exists(dialogPath), "File path does not exist")
|
|
||||||
|
|
||||||
f.open(dialogPath, File.READ)
|
|
||||||
|
func get_dialog() -> Array:
|
||||||
|
var f = File.new()
|
||||||
|
assert(f.file_exists(dialog_path), 'File path does not exist')
|
||||||
|
|
||||||
|
f.open(dialog_path, File.READ)
|
||||||
var json = f.get_as_text()
|
var json = f.get_as_text()
|
||||||
|
|
||||||
var output = parse_json(json)
|
var output = parse_json(json)
|
||||||
@@ -36,15 +40,15 @@ func getDialog() -> Array:
|
|||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
func nextPhrase() -> void:
|
func next_phrase() -> void:
|
||||||
if phraseNum >= len(dialog):
|
if phrase_num >= len(dialog):
|
||||||
queue_free()
|
queue_free()
|
||||||
return
|
return
|
||||||
|
|
||||||
finished = false
|
finished = false
|
||||||
|
|
||||||
$Name.bbcode_text = dialog[phraseNum]["Name"]
|
$Name.bbcode_text = dialog[phrase_num]['Name']
|
||||||
$Text.bbcode_text = dialog[phraseNum]["Text"]
|
$Text.bbcode_text = dialog[phrase_num]['Text']
|
||||||
|
|
||||||
$Text.visible_characters = 0
|
$Text.visible_characters = 0
|
||||||
|
|
||||||
@@ -52,12 +56,8 @@ func nextPhrase() -> void:
|
|||||||
$Text.visible_characters += 1
|
$Text.visible_characters += 1
|
||||||
|
|
||||||
$Timer.start()
|
$Timer.start()
|
||||||
yield($Timer, "timeout")
|
yield($Timer, 'timeout')
|
||||||
|
|
||||||
finished = true
|
finished = true
|
||||||
phraseNum += 1
|
phrase_num += 1
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ tracks/0/keys = {
|
|||||||
"values": [ NodePath("..") ]
|
"values": [ NodePath("..") ]
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Control" type="Control"]
|
[node name="Dialogue" type="Control"]
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ script = ExtResource( 1 )
|
|||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
dialogPath = "res://Levels/Objects/journalScrapDialog.json"
|
dialog_path = "res://Levels/Objects/journalScrapDialog.json"
|
||||||
|
|
||||||
[node name="Name" type="RichTextLabel" parent="DialogBox"]
|
[node name="Name" type="RichTextLabel" parent="DialogBox"]
|
||||||
anchor_bottom = 2.0
|
anchor_bottom = 2.0
|
||||||
|
@@ -1,24 +1,11 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
func _on_AnimationPlayer_animation_finished(_anim_name: String) -> void:
|
||||||
# var a: int = 2
|
|
||||||
# var b: String = "text"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta: float) -> void:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
func _on_AnimationPlayer_animation_finished(anim_name: String) -> void:
|
|
||||||
$IceKeySprite.visible = false
|
$IceKeySprite.visible = false
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
func _on_AnimationPlayer_animation_started(anim_name: String) -> void:
|
func _on_AnimationPlayer_animation_started(_anim_name: String) -> void:
|
||||||
$IceKeySprite.visible = true
|
$IceKeySprite.visible = true
|
||||||
|
return
|
||||||
|
@@ -1,34 +1,20 @@
|
|||||||
extends Sprite
|
extends Sprite
|
||||||
|
|
||||||
|
signal ice_key_collected
|
||||||
|
|
||||||
var is_player_inside: bool = false
|
var is_player_inside: bool = false
|
||||||
var is_opened: bool = false
|
var is_opened: bool = false
|
||||||
var has_key: bool = true
|
var has_key: bool = true
|
||||||
|
|
||||||
signal ice_key_collected
|
|
||||||
|
|
||||||
# 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:
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta: float) -> void:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
func _on_Player_Detector_area_entered(area: Area2D) -> void:
|
func _on_Player_Detector_area_entered(area: Area2D) -> void:
|
||||||
print(get_parent().get_parent().score)
|
|
||||||
if area.get_parent().name == 'Player' and get_parent().get_parent().score >= 5:
|
if area.get_parent().name == 'Player' and get_parent().get_parent().score >= 5:
|
||||||
if is_opened == false:
|
if is_opened == false:
|
||||||
$chestClosed.visible = false
|
$chestClosed.visible = false
|
||||||
$chestOpened.visible = true
|
$chestOpened.visible = true
|
||||||
$Key.visible = true
|
$Key.visible = true
|
||||||
$Key/AnimationPlayer.play("rise")
|
$Key/AnimationPlayer.play('rise')
|
||||||
is_opened = true
|
is_opened = true
|
||||||
has_key = false
|
has_key = false
|
||||||
emit_signal("ice_key_collected")
|
emit_signal('ice_key_collected')
|
||||||
|
return
|
||||||
|
7
Levels/Portal Dark Forest.gd
Normal file
7
Levels/Portal Dark Forest.gd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
extends Area2D
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
visible = false
|
||||||
|
$CollisionShape2D.visible = false
|
||||||
|
return
|
@@ -1,17 +0,0 @@
|
|||||||
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
|
|
@@ -1,6 +1,6 @@
|
|||||||
extends Area2D
|
extends Area2D
|
||||||
|
|
||||||
export var enemy_path: String = 'res://Enemies/Ghost_Enemy.tscn'
|
export var enemy_path: String = 'res://Enemies/ENEMY.tscn'
|
||||||
export var relative_x_tiles: int
|
export var relative_x_tiles: int
|
||||||
export var relative_y_tiles: int
|
export var relative_y_tiles: int
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user