diff --git a/game/background.gd b/game/background.gd new file mode 100644 index 0000000..4b9aca5 --- /dev/null +++ b/game/background.gd @@ -0,0 +1,13 @@ +class_name Background +extends Node2D + + +@onready var paralax_1 : Parallax2D = $Parallax1 +@onready var paralax_2 : Parallax2D = $Parallax2 +@onready var paralax_3 : Parallax2D = $Parallax3 + + +func _ready() -> void: + paralax_1.scroll_offset.x = randf_range(1, paralax_1.repeat_size.x) + paralax_2.scroll_offset.x = randf_range(1, paralax_2.repeat_size.x) + paralax_3.scroll_offset.x = randf_range(1, paralax_3.repeat_size.x) diff --git a/game/background.gd.uid b/game/background.gd.uid new file mode 100644 index 0000000..658b626 --- /dev/null +++ b/game/background.gd.uid @@ -0,0 +1 @@ +uid://ddp4unooscflj diff --git a/game/background.tscn b/game/background.tscn new file mode 100644 index 0000000..2e6a64d --- /dev/null +++ b/game/background.tscn @@ -0,0 +1,50 @@ +[gd_scene load_steps=6 format=3 uid="uid://chdrjc7c6bdpb"] + +[ext_resource type="Script" uid="uid://ddp4unooscflj" path="res://game/background.gd" id="1_fypbl"] +[ext_resource type="Texture2D" uid="uid://mvcnpsfsyiq6" path="res://images/passage/background.png" id="1_hvye4"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_yetnv"] +atlas = ExtResource("1_hvye4") +region = Rect2(0, 0, 3200, 360) + +[sub_resource type="AtlasTexture" id="AtlasTexture_cuj01"] +atlas = ExtResource("1_hvye4") +region = Rect2(0, 360, 3200, 360) + +[sub_resource type="AtlasTexture" id="AtlasTexture_u0ams"] +atlas = ExtResource("1_hvye4") +region = Rect2(0, 720, 3200, 360) + +[node name="Background" type="Node2D"] +z_index = -100 +script = ExtResource("1_fypbl") + +[node name="Parallax1" type="Parallax2D" parent="."] +scroll_offset = Vector2(0, 180) +repeat_size = Vector2(3200, 0) +autoscroll = Vector2(-1, 0) +follow_viewport = false +ignore_camera_scroll = true + +[node name="Sprite2D" type="Sprite2D" parent="Parallax1"] +texture = SubResource("AtlasTexture_yetnv") + +[node name="Parallax2" type="Parallax2D" parent="."] +scroll_offset = Vector2(0, 180) +repeat_size = Vector2(3200, 0) +autoscroll = Vector2(-5, 0) +follow_viewport = false +ignore_camera_scroll = true + +[node name="Sprite2D" type="Sprite2D" parent="Parallax2"] +texture = SubResource("AtlasTexture_cuj01") + +[node name="Parallax3" type="Parallax2D" parent="."] +scroll_offset = Vector2(0, 180) +repeat_size = Vector2(3200, 0) +autoscroll = Vector2(-10, 0) +follow_viewport = false +ignore_camera_scroll = true + +[node name="Sprite2D" type="Sprite2D" parent="Parallax3"] +texture = SubResource("AtlasTexture_u0ams") diff --git a/game/entities/ships/enemies/abstract_enemy_ship.tscn b/game/entities/ships/enemies/abstract_enemy_ship.tscn index c155567..cb0a1e4 100644 --- a/game/entities/ships/enemies/abstract_enemy_ship.tscn +++ b/game/entities/ships/enemies/abstract_enemy_ship.tscn @@ -6,7 +6,7 @@ [node name="AbstractEnemyShip" groups=["enemies"] instance=ExtResource("1_28j6l")] collision_layer = 4 -collision_mask = 2 +collision_mask = 6 script = ExtResource("2_fwvrd") weapon_rotation = 180 diff --git a/game/entities/ships/player/player_ship.gd b/game/entities/ships/player/player_ship.gd index 8e1d377..d4d6660 100644 --- a/game/entities/ships/player/player_ship.gd +++ b/game/entities/ships/player/player_ship.gd @@ -5,6 +5,9 @@ extends AbstractShip @export_range(0, 200) var blink_range := 0 +const ENEMY_LAYER = 4 + + @onready var blink_timer : Timer = $BlinkTimer @onready var blink_shadow : GPUParticles2D = $BlinkShadow @@ -36,4 +39,6 @@ func _blink(direction: Vector2) -> void: get_tree().current_scene.add_child(shadow) shadow.finished.connect(shadow.queue_free) + collision_mask &= ~ENEMY_LAYER move_and_collide(direction * blink_range) + collision_mask |= ENEMY_LAYER diff --git a/game/passage.gd b/game/passage.gd index 6234612..a9f621f 100644 --- a/game/passage.gd +++ b/game/passage.gd @@ -7,15 +7,6 @@ signal player_died @onready var enemy_swamp_controller : EnemySwampController = $EnemySwampController @onready var enemy_timer : Timer = $EnemyTimer -@onready var paralax_1 : Parallax2D = $Background/Parallax1 -@onready var paralax_2 : Parallax2D = $Background/Parallax2 -@onready var paralax_3 : Parallax2D = $Background/Parallax3 - - -func _ready() -> void: - paralax_1.scroll_offset.x = randf_range(1, paralax_1.repeat_size.x) - paralax_2.scroll_offset.x = randf_range(1, paralax_2.repeat_size.x) - paralax_3.scroll_offset.x = randf_range(1, paralax_3.repeat_size.x) func _on_enemy_timer_timeout() -> void: diff --git a/game/passage.tscn b/game/passage.tscn index d5a68a9..a2f409f 100644 --- a/game/passage.tscn +++ b/game/passage.tscn @@ -1,24 +1,12 @@ -[gd_scene load_steps=9 format=3 uid="uid://dgc0087kvarx6"] +[gd_scene load_steps=6 format=3 uid="uid://dgc0087kvarx6"] [ext_resource type="Script" uid="uid://c6gpm3edyr4nu" path="res://game/passage.gd" id="1_ltkyg"] [ext_resource type="PackedScene" uid="uid://cpn5x0ijgl7ei" path="res://game/controllers/enemy_swamp_controller.tscn" id="2_72vqi"] [ext_resource type="PackedScene" uid="uid://br074cqcnul3d" path="res://game/entities/ships/player/player_ship.tscn" id="3_r3x05"] -[ext_resource type="Texture2D" uid="uid://mvcnpsfsyiq6" path="res://images/passage/background.png" id="4_cuj01"] +[ext_resource type="PackedScene" uid="uid://chdrjc7c6bdpb" path="res://game/background.tscn" id="4_cuj01"] [sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_ltkyg"] -[sub_resource type="AtlasTexture" id="AtlasTexture_yetnv"] -atlas = ExtResource("4_cuj01") -region = Rect2(0, 0, 3200, 360) - -[sub_resource type="AtlasTexture" id="AtlasTexture_cuj01"] -atlas = ExtResource("4_cuj01") -region = Rect2(0, 360, 3200, 360) - -[sub_resource type="AtlasTexture" id="AtlasTexture_u0ams"] -atlas = ExtResource("4_cuj01") -region = Rect2(0, 720, 3200, 360) - [node name="Passage" type="Node2D"] script = ExtResource("1_ltkyg") @@ -59,38 +47,7 @@ wait_time = 3.0 one_shot = true autostart = true -[node name="Background" type="Node2D" parent="."] -z_index = -100 - -[node name="Parallax1" type="Parallax2D" parent="Background"] -scroll_offset = Vector2(0, 180) -repeat_size = Vector2(3200, 0) -autoscroll = Vector2(-1, 0) -follow_viewport = false -ignore_camera_scroll = true - -[node name="Sprite2D" type="Sprite2D" parent="Background/Parallax1"] -texture = SubResource("AtlasTexture_yetnv") - -[node name="Parallax2" type="Parallax2D" parent="Background"] -scroll_offset = Vector2(0, 180) -repeat_size = Vector2(3200, 0) -autoscroll = Vector2(-5, 0) -follow_viewport = false -ignore_camera_scroll = true - -[node name="Sprite2D" type="Sprite2D" parent="Background/Parallax2"] -texture = SubResource("AtlasTexture_cuj01") - -[node name="Parallax3" type="Parallax2D" parent="Background"] -scroll_offset = Vector2(0, 180) -repeat_size = Vector2(3200, 0) -autoscroll = Vector2(-10, 0) -follow_viewport = false -ignore_camera_scroll = true - -[node name="Sprite2D" type="Sprite2D" parent="Background/Parallax3"] -texture = SubResource("AtlasTexture_u0ams") +[node name="Background" parent="." instance=ExtResource("4_cuj01")] [connection signal="destroyed" from="PlayerShip" to="." method="_on_player_ship_destroyed"] [connection signal="timeout" from="EnemyTimer" to="." method="_on_enemy_timer_timeout"] diff --git a/images/debris.png.import b/images/debris.png.import new file mode 100644 index 0000000..4cbdd9f --- /dev/null +++ b/images/debris.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://jnynidhnycpq" +path="res://.godot/imported/debris.png-af1566d09503649c4b5c51e25eb08d64.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://images/debris.png" +dest_files=["res://.godot/imported/debris.png-af1566d09503649c4b5c51e25eb08d64.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/images/label.tres b/images/label.tres new file mode 100644 index 0000000..6836b1e --- /dev/null +++ b/images/label.tres @@ -0,0 +1,6 @@ +[gd_resource type="Theme" load_steps=2 format=3 uid="uid://cigren10ijb75"] + +[ext_resource type="FontFile" uid="uid://b3xawfjtsnm5b" path="res://images/main_font.png" id="1_h3mgl"] + +[resource] +default_font = ExtResource("1_h3mgl") diff --git a/images/main_font.png b/images/main_font.png new file mode 100644 index 0000000..35edea4 --- /dev/null +++ b/images/main_font.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6651583fee6a54ed9b339fd3c6f2e7cc6e09a5f6f55b726c8bc12ad67b413322 +size 837 diff --git a/images/main_font.png.import b/images/main_font.png.import new file mode 100644 index 0000000..5a8e918 --- /dev/null +++ b/images/main_font.png.import @@ -0,0 +1,25 @@ +[remap] + +importer="font_data_image" +type="FontFile" +uid="uid://b3xawfjtsnm5b" +path="res://.godot/imported/main_font.png-43554ca2c4afb77b19a07c443766a2bf.fontdata" + +[deps] + +source_file="res://images/main_font.png" +dest_files=["res://.godot/imported/main_font.png-43554ca2c4afb77b19a07c443766a2bf.fontdata"] + +[params] + +character_ranges=PackedStringArray("\' \'-\'~\'") +kerning_pairs=PackedStringArray() +columns=94 +rows=1 +image_margin=Rect2i(0, 0, 0, 0) +character_margin=Rect2i(0, 0, 0, 0) +ascent=0 +descent=0 +fallbacks=[] +compress=true +scaling_mode=2 diff --git a/images/menu_font.png b/images/menu_font.png index 552d23b..9508866 100644 --- a/images/menu_font.png +++ b/images/menu_font.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5079898632890050214302ee628ae69f160ae5244bd8b4e89f44f12eefa25c42 -size 2917 +oid sha256:79f7749017d17e274aa41617ba746e742c1ea3feac328a9b99389c062768e42a +size 2919 diff --git a/menu/credits.gd b/menu/credits.gd index 67b4086..4a38a94 100644 --- a/menu/credits.gd +++ b/menu/credits.gd @@ -4,7 +4,12 @@ extends Control signal back -@onready var main_menu_button := $%BackButton +@export var scroll_speed: float = 25.0 + + +@onready var main_menu_button := $BackButton +@onready var text := $Text +@onready var tween: Tween func _ready() -> void: @@ -16,6 +21,28 @@ func _on_visibility_changed() -> void: if not visible: return main_menu_button.grab_focus() + + _start_scrolling() + + +func _start_scrolling() -> void: + var start_pos := Vector2(0, get_viewport_rect().size.y) + var end_pos := Vector2(0, -text.size.y) + var duration := (start_pos.y - end_pos.y) / scroll_speed + + text.position = start_pos + + tween = create_tween() + tween.tween_property(text, "position:y", end_pos.y, duration) + tween.finished.connect(_on_scroll_finished) + func _on_back_button_pressed() -> void: + if tween: + tween.kill() + + back.emit() + + +func _on_scroll_finished() -> void: back.emit() diff --git a/menu/credits.tscn b/menu/credits.tscn index 658642c..c6961f4 100644 --- a/menu/credits.tscn +++ b/menu/credits.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=5 format=3 uid="uid://c3q3g2647qc27"] +[gd_scene load_steps=6 format=3 uid="uid://c3q3g2647qc27"] [ext_resource type="Script" uid="uid://dclkpithyykju" path="res://menu/credits.gd" id="1_wp78b"] [ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://images/menu_button.tres" id="2_nidem"] +[ext_resource type="Theme" uid="uid://cigren10ijb75" path="res://images/label.tres" id="3_x2hwc"] [sub_resource type="InputEventAction" id="InputEventAction_wp78b"] action = &"ui_cancel" @@ -14,41 +15,50 @@ layout_mode = 3 anchors_preset = 0 script = ExtResource("1_wp78b") -[node name="VBoxContainer" type="VBoxContainer" parent="."] -top_level = true -layout_mode = 0 -offset_left = 100.0 -offset_top = 100.0 -offset_right = 330.0 -offset_bottom = 158.0 - -[node name="GridContainer" type="GridContainer" parent="VBoxContainer"] -layout_mode = 2 -columns = 2 - -[node name="ProgrammingLabel" type="Label" parent="VBoxContainer/GridContainer"] +[node name="BackButton" type="Button" parent="."] z_index = 100 -layout_mode = 2 -text = "Programming:" -horizontal_alignment = 2 - -[node name="ProgrammersLabel" type="Label" parent="VBoxContainer/GridContainer"] -z_index = 100 -layout_mode = 2 -text = "Ruslan Ignatov" - -[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] -layout_mode = 2 -alignment = 2 - -[node name="BackButton" type="Button" parent="VBoxContainer/HBoxContainer"] -unique_name_in_owner = true -z_index = 100 -layout_mode = 2 +layout_mode = 1 +offset_left = 531.0 +offset_top = 299.0 +offset_right = 615.0 +offset_bottom = 335.0 mouse_filter = 2 theme = ExtResource("2_nidem") shortcut = SubResource("Shortcut_nidem") text = "Back" +[node name="Text" type="Label" parent="."] +layout_mode = 1 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_top = 360.0 +offset_right = 640.0 +offset_bottom = 760.0 +grow_horizontal = 2 +theme = ExtResource("3_x2hwc") +text = "PROGRAMMING + + +Ruslan Ignatov + + + +DEGIGN AND GRAPHICS + + +Ruslan Ignatov + + + +PLAY TESTING + + +Daniil Ivaschenko + +Fedor Daragan +" +horizontal_alignment = 1 + [connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"] -[connection signal="pressed" from="VBoxContainer/HBoxContainer/BackButton" to="." method="_on_back_button_pressed"] +[connection signal="pressed" from="BackButton" to="." method="_on_back_button_pressed"] diff --git a/menu/title_screen.tscn b/menu/title_screen.tscn index 79a0351..ca51298 100644 --- a/menu/title_screen.tscn +++ b/menu/title_screen.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=5 format=3 uid="uid://2oavbr7oaihg"] +[gd_scene load_steps=6 format=3 uid="uid://2oavbr7oaihg"] [ext_resource type="Script" uid="uid://bqnepsuk13qo8" path="res://menu/title_screen.gd" id="1_lxdol"] [ext_resource type="PackedScene" uid="uid://bxlccevt52y70" path="res://menu/main_menu.tscn" id="2_o0rbc"] [ext_resource type="PackedScene" uid="uid://btr60idiit4y7" path="res://menu/options.tscn" id="3_88gnj"] [ext_resource type="PackedScene" uid="uid://c3q3g2647qc27" path="res://menu/credits.tscn" id="4_w1y3c"] +[ext_resource type="PackedScene" uid="uid://chdrjc7c6bdpb" path="res://game/background.tscn" id="5_88gnj"] [node name="TitleScreen" type="Control"] layout_mode = 3 @@ -19,6 +20,8 @@ layout_mode = 0 [node name="Credits" parent="." instance=ExtResource("4_w1y3c")] layout_mode = 0 +[node name="Background" parent="." instance=ExtResource("5_88gnj")] + [connection signal="continue_game" from="MainMenu" to="." method="_on_main_menu_continue_game"] [connection signal="new_game" from="MainMenu" to="." method="_on_main_menu_new_game"] [connection signal="quit_game" from="MainMenu" to="." method="_on_main_menu_quit_game"]