diff --git a/src/Menus/SelectUpgradeUI/SelectUpgradeUI.gd b/src/Menus/SelectUpgradeUI/SelectUpgradeUI.gd new file mode 100644 index 0000000..e7493d3 --- /dev/null +++ b/src/Menus/SelectUpgradeUI/SelectUpgradeUI.gd @@ -0,0 +1,8 @@ +extends Control + + + +func _on_Button_pressed(): + Engine.time_scale=1 + self.hide() + pass # Replace with function body. diff --git a/src/Menus/SelectUpgradeUI/SelectUpgradeUI.tscn b/src/Menus/SelectUpgradeUI/SelectUpgradeUI.tscn new file mode 100644 index 0000000..23b4616 --- /dev/null +++ b/src/Menus/SelectUpgradeUI/SelectUpgradeUI.tscn @@ -0,0 +1,28 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Menus/SelectUpgradeUI/SelectUpgradeUI.gd" type="Script" id=1] + +[node name="SelectUpgradeUI" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = -480.0 +margin_bottom = -270.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Button" type="Button" parent="."] +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 349.105 +margin_top = 249.473 +margin_right = 482.105 +margin_bottom = 269.473 +text = "Continue" +__meta__ = { +"_edit_use_anchors_": false +} +[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"] diff --git a/src/Player/Player.gd b/src/Player/Player.gd index f875ef0..4da0636 100644 --- a/src/Player/Player.gd +++ b/src/Player/Player.gd @@ -198,7 +198,8 @@ func _on_Hurtbox_area_exited(area): func _on_Stats_no_health(): queue_free() - get_tree().change_scene("res://Menus/TitleScreen/TitleScreen.tscn") + get_tree().get_root().get_node("World").hero_has_died() + #get_tree().change_scene("res://Menus/TitleScreen/TitleScreen.tscn") func _on_Hitbox_area_entered(area): diff --git a/src/Player/Player.tscn b/src/Player/Player.tscn index a032e86..d5c119f 100644 --- a/src/Player/Player.tscn +++ b/src/Player/Player.tscn @@ -629,6 +629,7 @@ font_data = ExtResource( 6 ) [node name="Player" type="KinematicBody2D" groups=[ "hero", ]] +scale = Vector2( 2, 2 ) collision_mask = 14 script = ExtResource( 1 ) ROLL_SPEED = 120 diff --git a/src/World.gd b/src/World.gd index 19efda6..c34e5a2 100644 --- a/src/World.gd +++ b/src/World.gd @@ -1,6 +1,49 @@ extends Node2D +export(int) var WinRounds= 10 +export(PackedScene) var HeroTemplate +export(Vector2) var InitialSpawnPoint=Vector2(344,125) +export(Rect2) var SpawnBoxRange=Rect2(20,20,450,180) +export(float) var MinDistanceToBoss=100.0 + + +var round_counter=0 +var passed_final_Round=false func _ready(): randomize() + var point = determine_spawnpoint() + spawn_new_hero(point.x,point.y) + #spawn_new_hero(InitialSpawnPoint.x,InitialSpawnPoint.y) + + +func determine_spawnpoint(): + var point = Vector2(rand_range(SpawnBoxRange.position.x,SpawnBoxRange.position.x+SpawnBoxRange.size.x),rand_range(SpawnBoxRange.position.y,SpawnBoxRange.position.y+SpawnBoxRange.size.y)) + while(point.distance_to($YSort/SlimeBoss.position)=WinRounds and passed_final_Round ==false): + passed_final_Round=true + $CanvasLayer/Win.show() + + Engine.time_scale=0 + var point = determine_spawnpoint() + spawn_new_hero(point.x,point.y) + $CanvasLayer/SelectUpgradeUI.show() + + +func spawn_new_hero(x:float,y:float): + var hero = HeroTemplate.instance() + hero.position=Vector2(x,y) + $YSort.add_child(hero) + + +func _on_Win_pressed(): + if passed_final_Round: + #TODO CHANGE SCENE TO WINSCREEN + pass pass # Replace with function body. diff --git a/src/World.tscn b/src/World.tscn index 29802bf..bffec95 100644 --- a/src/World.tscn +++ b/src/World.tscn @@ -1,22 +1,39 @@ -[gd_scene load_steps=10 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://World.gd" type="Script" id=2] [ext_resource path="res://Maps/Tilesets/Room/tileset_room.tres" type="TileSet" id=3] -[ext_resource path="res://Objects/Bonfire/Bonfire.tscn" type="PackedScene" id=4] [ext_resource path="res://Menus/DragNDrop/DragNDropUI.tscn" type="PackedScene" id=5] [ext_resource path="res://Menus/DialogueBox/DialogueBox.tscn" type="PackedScene" id=6] [ext_resource path="res://Maps/Background/Background.tscn" type="PackedScene" id=7] -[ext_resource path="res://Boss/Boss_template.tscn" type="PackedScene" id=8] +[ext_resource path="res://Boss/SlimeBoss/SlimeBoss.tscn" type="PackedScene" id=8] +[ext_resource path="res://Menus/SelectUpgradeUI/SelectUpgradeUI.tscn" type="PackedScene" id=9] +[ext_resource path="res://Objects/Bonfire/Bonfire.tscn" type="PackedScene" id=10] [ext_resource path="res://Maps/Grid.tscn" type="PackedScene" id=18] [node name="World" type="Node2D"] +pause_mode = 2 script = ExtResource( 2 ) +__meta__ = { +"_edit_horizontal_guides_": [ ], +"_edit_vertical_guides_": [ ] +} +WinRounds = 5 +HeroTemplate = ExtResource( 1 ) + +[node name="WallSprite" type="Sprite" parent="."] +pause_mode = 1 +position = Vector2( 360, 176 ) +region_enabled = true +region_rect = Rect2( 0, 0, 1280, 720 ) [node name="Background" parent="." instance=ExtResource( 7 )] -frame = 11 +pause_mode = 1 +frame = 47 [node name="FloorTileMap" type="TileMap" parent="."] +pause_mode = 1 +visible = false position = Vector2( 16, 16 ) tile_set = ExtResource( 3 ) cell_size = Vector2( 32, 32 ) @@ -26,23 +43,19 @@ format = 1 tile_data = PoolIntArray( -131074, 47, 0, -131073, 47, 1, -196608, 47, 1, -196607, 47, 1, -196606, 47, 1, -196605, 47, 1, -196604, 47, 1, -196603, 47, 1, -196602, 47, 1, -196601, 47, 1, -196600, 47, 1, -196599, 47, 1, -196598, 47, 1, -196597, 47, 1, -196596, 47, 1, -196595, 47, 1, -196594, 47, 1, -196593, 47, 1, -196592, 47, 2, -65538, 47, 65536, -65537, 47, 65537, -131072, 47, 65537, -131071, 47, 65537, -131070, 47, 65537, -131069, 47, 65537, -131068, 47, 65537, -131067, 47, 65537, -131066, 47, 65537, -131065, 47, 65537, -131064, 47, 65537, -131063, 47, 65537, -131062, 47, 65537, -131061, 47, 65537, -131060, 47, 65537, -131059, 47, 65537, -131058, 47, 65537, -131057, 47, 65537, -131056, 47, 65538, -2, 47, 65536, -1, 47, 65541, -65536, 47, 131073, -65535, 47, 131073, -65534, 47, 131073, -65533, 47, 131073, -65532, 47, 131073, -65531, 47, 131073, -65530, 47, 131073, -65529, 47, 65544, -65528, 47, 131073, -65527, 47, 131073, -65526, 47, 131073, -65525, 47, 65542, -65524, 47, 65541, -65523, 47, 131073, -65522, 47, 65542, -65521, 47, 65537, -65520, 47, 65538, 65534, 47, 65536, 65535, 47, 65538, 7, 47, 65539, 11, 47, 131072, 12, 47, 65543, 14, 47, 65536, 15, 47, 65537, 16, 47, 65538, 131070, 47, 65536, 131071, 47, 65538, 65543, 47, 65539, 65548, 47, 65539, 65550, 47, 65536, 65551, 47, 65537, 65552, 47, 65538, 196606, 47, 65536, 196607, 47, 65538, 131079, 47, 196612, 131080, 47, 196609, 131081, 47, 196610, 131084, 47, 131075, 131086, 47, 65536, 131087, 47, 65537, 131088, 47, 65538, 262142, 47, 65536, 262143, 47, 65538, 196622, 47, 65536, 196623, 47, 65537, 196624, 47, 65538, 327678, 47, 65536, 327679, 47, 65538, 262153, 47, 196608, 262154, 47, 7, 262156, 47, 3, 262158, 47, 65536, 262159, 47, 65537, 262160, 47, 65538, 393214, 47, 65536, 393215, 47, 65538, 327690, 47, 131076, 327691, 47, 1, 327692, 47, 131079, 327694, 47, 65536, 327695, 47, 65537, 327696, 47, 65538, 458750, 47, 65536, 458751, 47, 131077, 393216, 47, 1, 393217, 47, 1, 393218, 47, 1, 393219, 47, 1, 393220, 47, 1, 393221, 47, 1, 393222, 47, 1, 393223, 47, 1, 393224, 47, 1, 393225, 47, 1, 393226, 47, 131078, 393227, 47, 65537, 393228, 47, 131077, 393229, 47, 1, 393230, 47, 131078, 393231, 47, 65537, 393232, 47, 65538, 524286, 47, 65536, 524287, 47, 65537, 458752, 47, 65537, 458753, 47, 65537, 458754, 47, 65537, 458755, 47, 65537, 458756, 47, 65537, 458757, 47, 65537, 458758, 47, 65537, 458759, 47, 65537, 458760, 47, 65537, 458761, 47, 65537, 458762, 47, 65537, 458763, 47, 65537, 458764, 47, 65537, 458765, 47, 65537, 458766, 47, 65537, 458767, 47, 65537, 458768, 47, 65538, 589822, 47, 65536, 589823, 47, 65537, 524288, 47, 65537, 524289, 47, 65537, 524290, 47, 65537, 524291, 47, 65537, 524292, 47, 65537, 524293, 47, 65537, 524294, 47, 65537, 524295, 47, 65537, 524296, 47, 65537, 524297, 47, 65537, 524298, 47, 65537, 524299, 47, 65537, 524300, 47, 65537, 524301, 47, 65537, 524302, 47, 65537, 524303, 47, 65537, 524304, 47, 65538, 655358, 47, 131072, 655359, 47, 131073, 589824, 47, 131073, 589825, 47, 131073, 589826, 47, 131073, 589827, 47, 131073, 589828, 47, 131073, 589829, 47, 131073, 589830, 47, 131073, 589831, 47, 131073, 589832, 47, 131073, 589833, 47, 131073, 589834, 47, 131073, 589835, 47, 131073, 589836, 47, 131073, 589837, 47, 131073, 589838, 47, 131073, 589839, 47, 131073, 589840, 47, 131074 ) [node name="YSort" type="YSort" parent="."] +pause_mode = 1 -[node name="Player" parent="YSort" instance=ExtResource( 1 )] -position = Vector2( 376, 136 ) -scale = Vector2( 2, 2 ) -ROLL_SPEED = 140 -FRICTION = 200 +[node name="Bonfire" parent="YSort" instance=ExtResource( 10 )] +position = Vector2( 379.618, 131.478 ) -[node name="Bonfire" parent="YSort" instance=ExtResource( 4 )] -position = Vector2( 304, 56 ) - -[node name="Boss_template" parent="YSort" instance=ExtResource( 8 )] -position = Vector2( 96, 128 ) -scale = Vector2( 2, 2 ) +[node name="SlimeBoss" parent="YSort" instance=ExtResource( 8 )] +position = Vector2( 104, 80 ) [node name="Grid" parent="." instance=ExtResource( 18 )] +pause_mode = 1 [node name="CanvasLayer" type="CanvasLayer" parent="."] +pause_mode = 2 [node name="DialogueBox" parent="CanvasLayer" instance=ExtResource( 6 )] visible = false @@ -50,3 +63,15 @@ visible = false [node name="DragNDropUI" parent="CanvasLayer" instance=ExtResource( 5 )] anchor_top = -0.00171594 anchor_bottom = 0.998284 + +[node name="SelectUpgradeUI" parent="CanvasLayer" instance=ExtResource( 9 )] +visible = false + +[node name="Win" type="Button" parent="CanvasLayer"] +visible = false +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -42.0 +margin_bottom = 24.0 +text = "Win" +[connection signal="pressed" from="CanvasLayer/Win" to="." method="_on_Win_pressed"]