diff --git a/Enemies/Snowman Enemy Blue.gd b/Enemies/Snowman Enemy Blue.gd index 4cba42d..e7f37cf 100644 --- a/Enemies/Snowman Enemy Blue.gd +++ b/Enemies/Snowman Enemy Blue.gd @@ -4,7 +4,9 @@ onready var SNOWBALL_BLUE_SCENE = preload("res://Enemies/Snowball Blue.tscn") var player = null var move = Vector2.ZERO -var speed = 1 +var speed = .5 +var health: int = 2 + func _physics_process(delta: float) -> void: move = Vector2.ZERO @@ -50,3 +52,13 @@ func _on_player_detector_area_entered(area: Area2D) -> void: func _on_player_detector_area_exited(_area: Area2D): player = null 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: + call_deferred('queue_free') + return diff --git a/Enemies/Snowman Enemy Blue.tscn b/Enemies/Snowman Enemy Blue.tscn index 4a26770..120a23e 100644 --- a/Enemies/Snowman Enemy Blue.tscn +++ b/Enemies/Snowman Enemy Blue.tscn @@ -40,7 +40,6 @@ autostart = true [node name="hitbox" type="Area2D" parent="." groups=[ "enemy_hitbox_1", ]] -visible = false collision_layer = 4 collision_mask = 2 diff --git a/Enemies/Snowman Enemy.gd b/Enemies/Snowman Enemy.gd index ade9782..b38817a 100644 --- a/Enemies/Snowman Enemy.gd +++ b/Enemies/Snowman Enemy.gd @@ -5,6 +5,8 @@ onready var SNOWBALL_SCENE = preload("res://Enemies/Snowball.tscn") var player = null var move = Vector2.ZERO var speed = .5 +var health: int = 2 + func _physics_process(delta: float) -> void: move = Vector2.ZERO @@ -51,3 +53,14 @@ func _on_player_detector_area_entered(area: Area2D) -> void: func _on_player_detector_area_exited(_area: Area2D): player = null return + +func _on_hitbox_area_entered(area: Area2D) -> void: + print("HIT") + if area.is_in_group('player_weapon_1'): + health -= 1 + elif area.is_in_group('player_weapon_2'): + health -= 2 + + if health <= 0: + call_deferred('queue_free') + return diff --git a/Enemies/Snowman Enemy.tscn b/Enemies/Snowman Enemy.tscn index 99f5485..12414b7 100644 --- a/Enemies/Snowman Enemy.tscn +++ b/Enemies/Snowman Enemy.tscn @@ -28,12 +28,10 @@ rotation = 1.5708 shape = SubResource( 1 ) [node name="detection" type="Area2D" parent="."] -visible = false collision_layer = 0 collision_mask = 2 [node name="detection" type="CollisionShape2D" parent="detection"] -visible = false shape = SubResource( 2 ) [node name="Timer" type="Timer" parent="."] diff --git a/GUI/Countdown Timer.gd b/GUI/Countdown Timer.gd index f3f0857..2d54c74 100644 --- a/GUI/Countdown Timer.gd +++ b/GUI/Countdown Timer.gd @@ -1,7 +1,10 @@ extends Label - +signal timer_end func _process(delta: float) -> void: var time_seconds: int = int($Timer.get_time_left()) set_text('%02d:%02d' % [time_seconds, int(($Timer.get_time_left() - time_seconds) * 100)]) + + if $Timer.get_time_left() == 0: + get_tree().change_scene('res://Levels/Hub World.tscn') return diff --git a/GUI/Countdown Timer.tscn b/GUI/Countdown Timer.tscn index 144dff5..90ccf28 100644 --- a/GUI/Countdown Timer.tscn +++ b/GUI/Countdown Timer.tscn @@ -14,8 +14,8 @@ margin_right = 335.0 margin_bottom = 41.0 rect_min_size = Vector2( 200, 0 ) rect_scale = Vector2( 0.25, 0.25 ) -custom_colors/font_color = Color( 0, 0, 0, 1 ) custom_fonts/font = SubResource( 1 ) +custom_colors/font_color = Color( 0, 0, 0, 1 ) align = 1 script = ExtResource( 1 ) __meta__ = { diff --git a/Levels/Interactables/Silver Barrier.tscn b/Levels/Interactables/Silver Barrier.tscn index 43cb211..39da272 100644 --- a/Levels/Interactables/Silver Barrier.tscn +++ b/Levels/Interactables/Silver Barrier.tscn @@ -38,10 +38,10 @@ shape = SubResource( 2 ) [node name="Unlock" type="Area2D" parent="."] light_mask = 0 -collision_layer = 0 -collision_mask = 2 input_pickable = false monitorable = false +collision_layer = 0 +collision_mask = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="Unlock"] visible = false diff --git a/Levels/Level 3.gd b/Levels/Level 3.gd index 2ceba78..796bd06 100644 --- a/Levels/Level 3.gd +++ b/Levels/Level 3.gd @@ -1,8 +1,8 @@ extends Node2D onready var coin = preload("res://Levels/Interactives/Coin.tscn") -onready var coin_container = get_node("/coin_container") - +onready var coin_container = get_node("coin_container") +onready var score_label = get_node('Level 3 HUD/Label') #have event for timer to run out @@ -12,7 +12,7 @@ var score = 0 func _ready() -> void: $YSort/Player.load_hud($HUD) screensize = get_viewport_rect().size - spawn_coins(5) + spawn_coins(8) return @@ -27,3 +27,26 @@ func spawn_coins(num): func _on_coin_grabbed(): score+=1 print(score) + score_label.set_text(str(score) + "/5") + +func _timer_out(): + get_tree().change_scene('res://Levels/Hub World.tscn') + + +func _on_TreasureChest_ice_key_collected() -> void: + $YSort/Door/doorClosed.visible = false + $YSort/Door/doorOpened.visible = true + $YSort/DoorCollision.layers = 5 + + + +func _on_DoorDetector_body_entered(body: Node) -> void: + if body.get_parent().name == 'Player': + print('WIN WIN WIN') + get_tree().change_scene('res://Levels/Hub World.tscn') + + +func _on_DoorDetector_area_entered(area: Area2D) -> void: + if area.get_parent().name == 'Player': + print('WIN WIN WIN') + get_tree().change_scene('res://Levels/Hub World.tscn') # Replace with function body. diff --git a/Levels/Level 3.tscn b/Levels/Level 3.tscn index c0521e4..e8f834f 100644 --- a/Levels/Level 3.tscn +++ b/Levels/Level 3.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=2] +[gd_scene load_steps=21 format=2] [ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://Levels/Level 3.gd" type="Script" id=2] @@ -7,22 +7,32 @@ [ext_resource path="res://Levels/Objects/Tree.tscn" type="PackedScene" id=5] [ext_resource path="res://Enemies/Snowman Enemy Blue.tscn" type="PackedScene" id=6] [ext_resource path="res://Enemies/Snowman Enemy Blue.gd" type="Script" id=7] +[ext_resource path="res://Levels/Objects/TreasureChest_L3.tscn" type="PackedScene" id=8] [ext_resource path="res://GUI/HUD.tscn" type="PackedScene" id=9] [ext_resource path="res://GUI/Pause Screen.tscn" type="PackedScene" id=10] [ext_resource path="res://Music/Level_3.mp3" type="AudioStream" id=11] [ext_resource path="res://GUI/Countdown Timer.tscn" type="PackedScene" id=12] +[ext_resource path="res://Levels/Objects/TreasureChest_L3.gd" type="Script" id=13] +[ext_resource path="res://Levels/Objects/IceDoor.tscn" type="PackedScene" id=14] +[ext_resource path="res://Levels/Objects/IceDoor.gd" type="Script" id=15] + +[sub_resource type="RectangleShape2D" id=4] +extents = Vector2( 14.2575, 4.53175 ) + +[sub_resource type="RectangleShape2D" id=5] +extents = Vector2( 13.5227, 15.1025 ) [sub_resource type="SegmentShape2D" id=1] a = Vector2( 3.84175, -99.0063 ) -b = Vector2( 3.44492, 75.211 ) +b = Vector2( 4.68997, 139.153 ) [sub_resource type="SegmentShape2D" id=2] a = Vector2( -12.0323, 29.5732 ) -b = Vector2( 309.792, 29.724 ) +b = Vector2( 339.344, 29.8339 ) [sub_resource type="SegmentShape2D" id=3] -a = Vector2( 369.611, 141.974 ) -b = Vector2( 49.76, 142.724 ) +a = Vector2( 400.865, 207.97 ) +b = Vector2( 51.2007, 207.999 ) [node name="Level 3" type="Node2D"] script = ExtResource( 2 ) @@ -33,68 +43,124 @@ cell_size = Vector2( 16, 16 ) cell_custom_transform = Transform2D( 16, 0, 0, 16, 0, 0 ) occluder_light_mask = 0 format = 1 -tile_data = PoolIntArray( 0, 0, 65537, 1, 0, 65538, 2, 0, 65538, 3, 0, 65538, 4, 0, 65538, 5, 0, 65538, 6, 0, 65538, 7, 0, 65538, 8, 0, 65538, 9, 0, 65538, 10, 0, 65538, 11, 0, 65538, 12, 0, 65538, 13, 0, 65538, 14, 0, 65538, 15, 0, 65538, 16, 0, 65538, 17, 0, 65538, 18, 0, 65538, 19, 0, 65539, 65536, 0, 131073, 65537, 0, 131074, 65538, 0, 131074, 65539, 0, 131074, 65540, 0, 131074, 65541, 0, 131074, 65542, 0, 131074, 65543, 0, 131074, 65544, 0, 131074, 65545, 0, 131074, 65546, 0, 131074, 65547, 0, 131074, 65548, 0, 131074, 65549, 0, 131074, 65550, 0, 131074, 65551, 0, 131074, 65552, 0, 131074, 65553, 0, 131074, 65554, 0, 131074, 65555, 0, 131075, 131072, 0, 131073, 131073, 0, 131074, 131074, 0, 131074, 131075, 0, 131074, 131076, 0, 131074, 131077, 0, 131074, 131078, 0, 131074, 131079, 0, 131074, 131080, 0, 131074, 131081, 0, 131074, 131082, 0, 131074, 131083, 0, 131074, 131084, 0, 131074, 131085, 0, 131074, 131086, 0, 131074, 131087, 0, 131074, 131088, 0, 131074, 131089, 0, 131074, 131090, 0, 131074, 131091, 0, 131075, 196608, 0, 131073, 196609, 0, 131074, 196610, 0, 131074, 196611, 0, 131074, 196612, 0, 131074, 196613, 0, 131074, 196614, 0, 131074, 196615, 0, 131074, 196616, 0, 131074, 196617, 0, 131074, 196618, 0, 131074, 196619, 0, 131074, 196620, 0, 131074, 196621, 0, 131074, 196622, 0, 131074, 196623, 0, 131074, 196624, 0, 131074, 196625, 0, 131074, 196626, 0, 131074, 196627, 0, 131075, 262144, 0, 131073, 262145, 0, 131074, 262146, 0, 131074, 262147, 0, 131074, 262148, 0, 131074, 262149, 0, 131074, 262150, 0, 131074, 262151, 0, 131074, 262152, 0, 131074, 262153, 0, 131074, 262154, 0, 131074, 262155, 0, 131074, 262156, 0, 131074, 262157, 0, 131074, 262158, 0, 131074, 262159, 0, 131074, 262160, 0, 131074, 262161, 0, 131074, 262162, 0, 131074, 262163, 0, 131075, 327680, 0, 131073, 327681, 0, 131074, 327682, 0, 131074, 327683, 0, 131074, 327684, 0, 131074, 327685, 0, 131074, 327686, 0, 131074, 327687, 0, 131074, 327688, 0, 131074, 327689, 0, 131074, 327690, 0, 131074, 327691, 0, 131074, 327692, 0, 131074, 327693, 0, 131074, 327694, 0, 131074, 327695, 0, 131074, 327696, 0, 131074, 327697, 0, 131074, 327698, 0, 131074, 327699, 0, 131075, 393216, 0, 131073, 393217, 0, 131074, 393218, 0, 131074, 393219, 0, 131074, 393220, 0, 131074, 393221, 0, 131074, 393222, 0, 131074, 393223, 0, 131074, 393224, 0, 131074, 393225, 0, 131074, 393226, 0, 131074, 393227, 0, 131074, 393228, 0, 131074, 393229, 0, 131074, 393230, 0, 131074, 393231, 0, 131074, 393232, 0, 131074, 393233, 0, 131074, 393234, 0, 131074, 393235, 0, 131075, 458752, 0, 131073, 458753, 0, 131074, 458754, 0, 131074, 458755, 0, 131074, 458756, 0, 131074, 458757, 0, 131074, 458758, 0, 131074, 458759, 0, 131074, 458760, 0, 131074, 458761, 0, 131074, 458762, 0, 131074, 458763, 0, 131074, 458764, 0, 131074, 458765, 0, 131074, 458766, 0, 131074, 458767, 0, 131074, 458768, 0, 131074, 458769, 0, 131074, 458770, 0, 131074, 458771, 0, 131075, 524288, 0, 131073, 524289, 0, 131074, 524290, 0, 131074, 524291, 0, 131074, 524292, 0, 131074, 524293, 0, 131074, 524294, 0, 131074, 524295, 0, 131074, 524296, 0, 131074, 524297, 0, 131074, 524298, 0, 131074, 524299, 0, 131074, 524300, 0, 131074, 524301, 0, 131074, 524302, 0, 131074, 524303, 0, 131074, 524304, 0, 131074, 524305, 0, 131074, 524306, 0, 131074, 524307, 0, 131075, 589824, 0, 131073, 589825, 0, 131074, 589826, 0, 131074, 589827, 0, 131074, 589828, 0, 131074, 589829, 0, 131074, 589830, 0, 131074, 589831, 0, 131074, 589832, 0, 131074, 589833, 0, 131074, 589834, 0, 131074, 589835, 0, 131074, 589836, 0, 131074, 589837, 0, 131074, 589838, 0, 131074, 589839, 0, 131074, 589840, 0, 131074, 589841, 0, 131074, 589842, 0, 131074, 589843, 0, 131075, 655360, 0, 196609, 655361, 0, 196610, 655362, 0, 196610, 655363, 0, 196610, 655364, 0, 196610, 655365, 0, 196610, 655366, 0, 196610, 655367, 0, 196610, 655368, 0, 196610, 655369, 0, 196610, 655370, 0, 196610, 655371, 0, 196610, 655372, 0, 196610, 655373, 0, 196610, 655374, 0, 196610, 655375, 0, 196610, 655376, 0, 196610, 655377, 0, 196610, 655378, 0, 196610, 655379, 0, 196611 ) +tile_data = PoolIntArray( 0, 0, 65537, 1, 0, 65538, 2, 0, 65538, 3, 0, 65538, 4, 0, 65538, 5, 0, 65538, 6, 0, 65538, 7, 0, 65538, 8, 0, 65538, 9, 0, 65538, 10, 0, 65538, 11, 0, 65538, 12, 0, 65538, 13, 0, 65538, 14, 0, 65538, 15, 0, 65538, 16, 0, 65538, 17, 0, 65538, 18, 0, 65538, 19, 0, 65538, 20, 0, 65538, 21, 0, 65539, 65536, 0, 131073, 65537, 0, 131074, 65538, 0, 131074, 65539, 0, 131074, 65540, 0, 131074, 65541, 0, 131074, 65542, 0, 131074, 65543, 0, 131074, 65544, 0, 131074, 65545, 0, 131074, 65546, 0, 131074, 65547, 0, 131074, 65548, 0, 131074, 65549, 0, 131074, 65550, 0, 131074, 65551, 0, 131074, 65552, 0, 131074, 65553, 0, 131074, 65554, 0, 131074, 65555, 0, 131074, 65556, 0, 131074, 65557, 0, 131075, 131072, 0, 131073, 131073, 0, 131074, 131074, 0, 131074, 131075, 0, 131074, 131076, 0, 131074, 131077, 0, 131074, 131078, 0, 131074, 131079, 0, 131074, 131080, 0, 131074, 131081, 0, 131074, 131082, 0, 131074, 131083, 0, 131074, 131084, 0, 131074, 131085, 0, 131074, 131086, 0, 131074, 131087, 0, 131074, 131088, 0, 131074, 131089, 0, 131074, 131090, 0, 131074, 131091, 0, 131074, 131092, 0, 131074, 131093, 0, 131075, 196608, 0, 131073, 196609, 0, 131074, 196610, 0, 131074, 196611, 0, 131074, 196612, 0, 131074, 196613, 0, 131074, 196614, 0, 131074, 196615, 0, 131074, 196616, 0, 131074, 196617, 0, 131074, 196618, 0, 131074, 196619, 0, 131074, 196620, 0, 131074, 196621, 0, 131074, 196622, 0, 131074, 196623, 0, 131074, 196624, 0, 131074, 196625, 0, 131074, 196626, 0, 131074, 196627, 0, 131074, 196628, 0, 131074, 196629, 0, 131075, 262144, 0, 131073, 262145, 0, 131074, 262146, 0, 131074, 262147, 0, 131074, 262148, 0, 131074, 262149, 0, 131074, 262150, 0, 131074, 262151, 0, 131074, 262152, 0, 131074, 262153, 0, 131074, 262154, 0, 131074, 262155, 0, 131074, 262156, 0, 131074, 262157, 0, 131074, 262158, 0, 131074, 262159, 0, 131074, 262160, 0, 131074, 262161, 0, 131074, 262162, 0, 131074, 262163, 0, 131074, 262164, 0, 131074, 262165, 0, 131075, 327680, 0, 131073, 327681, 0, 131074, 327682, 0, 131074, 327683, 0, 131074, 327684, 0, 131074, 327685, 0, 131074, 327686, 0, 131074, 327687, 0, 131074, 327688, 0, 131074, 327689, 0, 131074, 327690, 0, 131074, 327691, 0, 131074, 327692, 0, 131074, 327693, 0, 131074, 327694, 0, 131074, 327695, 0, 131074, 327696, 0, 131074, 327697, 0, 131074, 327698, 0, 131074, 327699, 0, 131074, 327700, 0, 131074, 327701, 0, 131075, 393216, 0, 131073, 393217, 0, 131074, 393218, 0, 131074, 393219, 0, 131074, 393220, 0, 131074, 393221, 0, 131074, 393222, 0, 131074, 393223, 0, 131074, 393224, 0, 131074, 393225, 0, 131074, 393226, 0, 131074, 393227, 0, 131074, 393228, 0, 131074, 393229, 0, 131074, 393230, 0, 131074, 393231, 0, 131074, 393232, 0, 131074, 393233, 0, 131074, 393234, 0, 131074, 393235, 0, 131074, 393236, 0, 131074, 393237, 0, 131075, 458752, 0, 131073, 458753, 0, 131074, 458754, 0, 131074, 458755, 0, 131074, 458756, 0, 131074, 458757, 0, 131074, 458758, 0, 131074, 458759, 0, 131074, 458760, 0, 131074, 458761, 0, 131074, 458762, 0, 131074, 458763, 0, 131074, 458764, 0, 131074, 458765, 0, 131074, 458766, 0, 131074, 458767, 0, 131074, 458768, 0, 131074, 458769, 0, 131074, 458770, 0, 131074, 458771, 0, 131074, 458772, 0, 131074, 458773, 0, 131075, 524288, 0, 131073, 524289, 0, 131074, 524290, 0, 131074, 524291, 0, 131074, 524292, 0, 131074, 524293, 0, 131074, 524294, 0, 131074, 524295, 0, 131074, 524296, 0, 131074, 524297, 0, 131074, 524298, 0, 131074, 524299, 0, 131074, 524300, 0, 131074, 524301, 0, 131074, 524302, 0, 131074, 524303, 0, 131074, 524304, 0, 131074, 524305, 0, 131074, 524306, 0, 131074, 524307, 0, 131074, 524308, 0, 131074, 524309, 0, 131075, 589824, 0, 131073, 589825, 0, 131074, 589826, 0, 131074, 589827, 0, 131074, 589828, 0, 131074, 589829, 0, 131074, 589830, 0, 131074, 589831, 0, 131074, 589832, 0, 131074, 589833, 0, 131074, 589834, 0, 131074, 589835, 0, 131074, 589836, 0, 131074, 589837, 0, 131074, 589838, 0, 131074, 589839, 0, 131074, 589840, 0, 131074, 589841, 0, 131074, 589842, 0, 131074, 589843, 0, 131074, 589844, 0, 131074, 589845, 0, 131075, 655360, 0, 131073, 655361, 0, 131074, 655362, 0, 131074, 655363, 0, 131074, 655364, 0, 131074, 655365, 0, 131074, 655366, 0, 131074, 655367, 0, 131074, 655368, 0, 131074, 655369, 0, 131074, 655370, 0, 131074, 655371, 0, 131074, 655372, 0, 131074, 655373, 0, 131074, 655374, 0, 131074, 655375, 0, 131074, 655376, 0, 131074, 655377, 0, 131074, 655378, 0, 131074, 655379, 0, 131074, 655380, 0, 131074, 655381, 0, 131075, 720896, 0, 131073, 720897, 0, 131074, 720898, 0, 131074, 720899, 0, 131074, 720900, 0, 131074, 720901, 0, 131074, 720902, 0, 131074, 720903, 0, 131074, 720904, 0, 131074, 720905, 0, 131074, 720906, 0, 131074, 720907, 0, 131074, 720908, 0, 131074, 720909, 0, 131074, 720910, 0, 131074, 720911, 0, 131074, 720912, 0, 131074, 720913, 0, 131074, 720914, 0, 131074, 720915, 0, 131074, 720916, 0, 131074, 720917, 0, 131075, 786432, 0, 131073, 786433, 0, 131074, 786434, 0, 131074, 786435, 0, 131074, 786436, 0, 131074, 786437, 0, 131074, 786438, 0, 131074, 786439, 0, 131074, 786440, 0, 131074, 786441, 0, 131074, 786442, 0, 131074, 786443, 0, 131074, 786444, 0, 131074, 786445, 0, 131074, 786446, 0, 131074, 786447, 0, 131074, 786448, 0, 131074, 786449, 0, 131074, 786450, 0, 131074, 786451, 0, 131074, 786452, 0, 131074, 786453, 0, 131075, 851968, 0, 131073, 851969, 0, 131074, 851970, 0, 131074, 851971, 0, 131074, 851972, 0, 131074, 851973, 0, 131074, 851974, 0, 131074, 851975, 0, 131074, 851976, 0, 131074, 851977, 0, 131074, 851978, 0, 131074, 851979, 0, 131074, 851980, 0, 131074, 851981, 0, 131074, 851982, 0, 131074, 851983, 0, 131074, 851984, 0, 131074, 851985, 0, 131074, 851986, 0, 131074, 851987, 0, 131074, 851988, 0, 131074, 851989, 0, 131075, 917504, 0, 196609, 917505, 0, 196610, 917506, 0, 196610, 917507, 0, 196610, 917508, 0, 196610, 917509, 0, 196610, 917510, 0, 196610, 917511, 0, 196610, 917512, 0, 196610, 917513, 0, 196610, 917514, 0, 196610, 917515, 0, 196610, 917516, 0, 196610, 917517, 0, 196610, 917518, 0, 196610, 917519, 0, 196610, 917520, 0, 196610, 917521, 0, 196610, 917522, 0, 196610, 917523, 0, 196610, 917524, 0, 196610, 917525, 0, 196611 ) [node name="YSort" type="YSort" parent="."] +[node name="Door" parent="YSort" instance=ExtResource( 14 )] +modulate = Color( 0.00392157, 0.905882, 1, 1 ) +self_modulate = Color( 0.0352941, 0.705882, 1, 1 ) +position = Vector2( 331.313, 27.3291 ) +script = ExtResource( 15 ) + +[node name="DoorCollision" type="StaticBody2D" parent="YSort"] +position = Vector2( 200, 200 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="YSort/DoorCollision"] +position = Vector2( 132.887, -159.68 ) +shape = SubResource( 4 ) + +[node name="DoorDetector" type="Area2D" parent="YSort"] +collision_layer = 0 +collision_mask = 2 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="YSort/DoorDetector"] +light_mask = 0 +position = Vector2( 332.149, 29.4297 ) +shape = SubResource( 5 ) + +[node name="TreasureChest" parent="YSort" instance=ExtResource( 8 )] +position = Vector2( 185, 215 ) +script = ExtResource( 13 ) + [node name="Player" parent="YSort" instance=ExtResource( 1 )] position = Vector2( 120, 60 ) ACCELERATION = 500 FRICTION = 100 +[node name="Camera2D" type="Camera2D" parent="YSort/Player"] +current = true +limit_left = 0 +limit_top = 0 +limit_right = 352 +limit_bottom = 240 + [node name="Tree 1" parent="YSort" instance=ExtResource( 5 )] -position = Vector2( 35.7089, 147.785 ) +position = Vector2( 48.8191, 197.978 ) [node name="Tree 2" parent="YSort" instance=ExtResource( 5 )] -position = Vector2( 59.3969, 96.8735 ) +position = Vector2( 60.5206, 107.362 ) [node name="Tree 3" parent="YSort" instance=ExtResource( 5 )] -position = Vector2( 74.5997, 42.7799 ) +position = Vector2( 71.9777, 44.6528 ) [node name="Tree 4" parent="YSort" instance=ExtResource( 5 )] -position = Vector2( 153.442, 160.867 ) +position = Vector2( 183.044, 156.837 ) [node name="Tree 5" parent="YSort" instance=ExtResource( 5 )] -position = Vector2( 155.563, 93.6916 ) +position = Vector2( 185.033, 54.2387 ) + +[node name="Tree 9" parent="YSort" instance=ExtResource( 5 )] +position = Vector2( 225.097, 212.48 ) + +[node name="Tree 10" parent="YSort" instance=ExtResource( 5 )] +position = Vector2( 100, 160.355 ) [node name="Tree 6" parent="YSort" instance=ExtResource( 5 )] -position = Vector2( 211.071, 43.1335 ) +position = Vector2( 203.053, 104.605 ) [node name="Tree 7" parent="YSort" instance=ExtResource( 5 )] -position = Vector2( 262.336, 86.2669 ) +position = Vector2( 306.87, 104.733 ) [node name="Tree 8" parent="YSort" instance=ExtResource( 5 )] -position = Vector2( 231.224, 137.179 ) +position = Vector2( 275.667, 170.487 ) + +[node name="Tree 12" parent="YSort" instance=ExtResource( 5 )] +position = Vector2( 133.359, 100.445 ) + +[node name="Tree 13" parent="YSort" instance=ExtResource( 5 )] +position = Vector2( 146.457, 200 ) + +[node name="Tree 11" parent="YSort" instance=ExtResource( 5 )] +position = Vector2( 250.562, 86.6365 ) [node name="Enemies" type="YSort" parent="YSort"] [node name="Snowman 1" parent="YSort/Enemies" groups=[ "enemies", ] instance=ExtResource( 4 )] -position = Vector2( 190.316, 146.569 ) +position = Vector2( 268.977, 221.859 ) +collision_layer = 4 +collision_mask = 5 [node name="Snowman 2" parent="YSort/Enemies" groups=[ "enemies", ] instance=ExtResource( 4 )] -position = Vector2( 67.4812, 153.194 ) +position = Vector2( 124.417, 123.977 ) +collision_layer = 4 +collision_mask = 5 [node name="Blue Snowman 1" parent="YSort/Enemies" groups=[ "enemies", ] instance=ExtResource( 6 )] -position = Vector2( 259.084, 49.7897 ) +position = Vector2( 252.747, 40.9419 ) +collision_layer = 4 +collision_mask = 5 script = ExtResource( 7 ) [node name="Blue Snowman 2" parent="YSort/Enemies" groups=[ "enemies", ] instance=ExtResource( 6 )] -position = Vector2( 261.1, 142.19 ) +position = Vector2( 105.053, 195.4 ) +collision_layer = 4 +collision_mask = 5 script = ExtResource( 7 ) [node name="wall" type="StaticBody2D" parent="."] position = Vector2( -17.4614, 141.279 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="wall"] -position = Vector2( 329.803, -41.5425 ) +position = Vector2( 363.748, -41.1679 ) shape = SubResource( 1 ) [node name="wall1" type="StaticBody2D" parent="."] @@ -136,3 +202,26 @@ pause_mode = 2 stream = ExtResource( 11 ) volume_db = -12.0 autoplay = true + +[node name="Level 3 HUD" type="Control" parent="."] +margin_left = 0.28064 +margin_top = -12.9083 +margin_right = 352.281 +margin_bottom = 227.092 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="Level 3 HUD"] +margin_left = 174.441 +margin_top = 199.997 +margin_right = 196.441 +margin_bottom = 213.997 +custom_colors/font_color = Color( 0, 0, 0, 1 ) +text = "0/5" +__meta__ = { +"_edit_use_anchors_": false +} + +[connection signal="area_entered" from="YSort/DoorDetector" to="." method="_on_DoorDetector_area_entered"] +[connection signal="ice_key_collected" from="YSort/TreasureChest" to="." method="_on_TreasureChest_ice_key_collected"] diff --git a/Levels/Objects/IceDoor.gd b/Levels/Objects/IceDoor.gd new file mode 100644 index 0000000..1408d51 --- /dev/null +++ b/Levels/Objects/IceDoor.gd @@ -0,0 +1,16 @@ +extends Sprite + + +# 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 diff --git a/Levels/Objects/IceDoor.tscn b/Levels/Objects/IceDoor.tscn new file mode 100644 index 0000000..a2d3981 --- /dev/null +++ b/Levels/Objects/IceDoor.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Sprites/Levels/Objects/DoorOpen.png" type="Texture" id=1] +[ext_resource path="res://Sprites/Levels/Objects/DoorClosed.png" type="Texture" id=2] + +[node name="IceDoor" type="Sprite"] + +[node name="doorClosed" type="Sprite" parent="."] +modulate = Color( 0.00392157, 0.905882, 1, 1 ) +self_modulate = Color( 0.0352941, 0.705882, 1, 1 ) +position = Vector2( 0.530327, 0.0883861 ) +scale = Vector2( 0.742002, 0.706551 ) +texture = ExtResource( 2 ) + +[node name="doorOpened" type="Sprite" parent="."] +visible = false +modulate = Color( 0.00392157, 0.905882, 1, 1 ) +self_modulate = Color( 0.0352941, 0.705882, 1, 1 ) +position = Vector2( 0.353549, 0.97227 ) +scale = Vector2( 0.732446, 0.669794 ) +texture = ExtResource( 1 ) diff --git a/Levels/Objects/Key.gd b/Levels/Objects/Key.gd new file mode 100644 index 0000000..a7a583c --- /dev/null +++ b/Levels/Objects/Key.gd @@ -0,0 +1,24 @@ +extends Node2D + + +# 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_AnimationPlayer_animation_finished(anim_name: String) -> void: + $IceKeySprite.visible = false + + +func _on_AnimationPlayer_animation_started(anim_name: String) -> void: + $IceKeySprite.visible = true diff --git a/Levels/Objects/Key.tscn b/Levels/Objects/Key.tscn new file mode 100644 index 0000000..0993e92 --- /dev/null +++ b/Levels/Objects/Key.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://Levels/Objects/icekey.png" type="Texture" id=1] +[ext_resource path="res://Levels/Objects/Gem.gd" type="Script" id=2] + +[sub_resource type="Animation" id=1] +resource_name = "rise" +length = 1.2 + +[node name="Key" type="Node2D"] +script = ExtResource( 2 ) + +[node name="IceKeySprite" type="Sprite" parent="."] +position = Vector2( -0.0417144, 0.145997 ) +scale = Vector2( 0.760146, 0.732771 ) +texture = ExtResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +anims/rise = SubResource( 1 ) + +[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"] diff --git a/Levels/Objects/TreasureChest_L3.gd b/Levels/Objects/TreasureChest_L3.gd new file mode 100644 index 0000000..b5d34e8 --- /dev/null +++ b/Levels/Objects/TreasureChest_L3.gd @@ -0,0 +1,34 @@ +extends Sprite + +var is_player_inside: bool = false +var is_opened: bool = false +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: + print(get_parent().get_parent().score) + if area.get_parent().name == 'Player' and get_parent().get_parent().score >= 5: + if is_opened == false: + $chestClosed.visible = false + $chestOpened.visible = true + $Key.visible = true + $Key/AnimationPlayer.play("rise") + is_opened = true + has_key = false + emit_signal("ice_key_collected") diff --git a/Levels/Objects/TreasureChest_L3.tscn b/Levels/Objects/TreasureChest_L3.tscn new file mode 100644 index 0000000..3067964 --- /dev/null +++ b/Levels/Objects/TreasureChest_L3.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://Levels/Objects/TreasureChest.gd" type="Script" id=1] +[ext_resource path="res://Levels/Objects/Key.tscn" type="PackedScene" id=2] +[ext_resource path="res://Sprites/Levels/Interactables/treasureChest.png" type="Texture" id=3] +[ext_resource path="res://Sprites/Levels/Interactables/treasureChestOpen.png" type="Texture" id=4] +[ext_resource path="res://Levels/Objects/Key.gd" type="Script" id=5] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 21.3333, 17.3333 ) + +[node name="TreasureChest" type="Sprite" groups=[ +"enemies", +]] +script = ExtResource( 1 ) + +[node name="chestOpened" type="Sprite" parent="."] +visible = false +texture = ExtResource( 4 ) + +[node name="chestClosed" type="Sprite" parent="."] +texture = ExtResource( 3 ) + +[node name="Key" parent="." instance=ExtResource( 2 )] +visible = false +script = ExtResource( 5 ) + +[node name="Player Detector" type="Area2D" parent="."] +input_pickable = false +monitorable = false +collision_layer = 0 +collision_mask = 2 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector"] +visible = false +position = Vector2( 1, -1 ) +scale = Vector2( 1.5, 1.5 ) +shape = SubResource( 1 ) + +[connection signal="area_entered" from="Player Detector" to="." method="_on_Player_Detector_area_entered"] diff --git a/Levels/Objects/icekey.png b/Levels/Objects/icekey.png new file mode 100644 index 0000000..34a9ce8 Binary files /dev/null and b/Levels/Objects/icekey.png differ diff --git a/Levels/Objects/icekey.png.import b/Levels/Objects/icekey.png.import new file mode 100644 index 0000000..9cd8757 --- /dev/null +++ b/Levels/Objects/icekey.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icekey.png-527d7dd5cd660f0970e78efce0eda1a1.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Levels/Objects/icekey.png" +dest_files=[ "res://.import/icekey.png-527d7dd5cd660f0970e78efce0eda1a1.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/Sprites/Levels/Interactables/icekey.png b/Sprites/Levels/Interactables/icekey.png new file mode 100644 index 0000000..34a9ce8 Binary files /dev/null and b/Sprites/Levels/Interactables/icekey.png differ diff --git a/Sprites/Levels/Interactables/icekey.png.import b/Sprites/Levels/Interactables/icekey.png.import new file mode 100644 index 0000000..6354a99 --- /dev/null +++ b/Sprites/Levels/Interactables/icekey.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icekey.png-df1cf56280665fb9b333567113ef5539.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/Levels/Interactables/icekey.png" +dest_files=[ "res://.import/icekey.png-df1cf56280665fb9b333567113ef5539.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0