diff --git a/game.tscn b/game.tscn index 7194ee5b79cdef4c065611956eef81feaae5ece0..0010fbd275974a5a4111afeeb8a2da9d5db1e2e3 100644 --- a/game.tscn +++ b/game.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=9 format=3 uid="uid://d0lrpf3mmjdsx"] +[gd_scene load_steps=10 format=3 uid="uid://d0lrpf3mmjdsx"] [ext_resource type="PackedScene" uid="uid://dohp772jyjxb7" path="res://stage/stage.tscn" id="1_ybvw5"] [ext_resource type="PackedScene" uid="uid://dfxo2jwbj4aeh" path="res://coin/coin.tscn" id="2_chew2"] [ext_resource type="PackedScene" uid="uid://o5q0hy6cg6nt" path="res://enemy/enemy.tscn" id="3_nhwvs"] [ext_resource type="PackedScene" uid="uid://cc4idhykjp5f5" path="res://player/player.tscn" id="4_ray4s"] +[ext_resource type="PackedScene" uid="uid://b03of5mof3l74" path="res://win_flag/win_flag.tscn" id="5_o4njd"] [sub_resource type="PhysicsMaterial" id="1"] friction = 0.0 @@ -264,3 +265,6 @@ physics_material_override = SubResource("4") [node name="Player" parent="." instance=ExtResource("4_ray4s")] transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -9.49833, -3.84189, 3.9334) + +[node name="WinFlag" parent="." instance=ExtResource("5_o4njd")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -19) diff --git a/levelfinishscreen/levelfinishscreen.gd b/levelfinishscreen/levelfinishscreen.gd new file mode 100644 index 0000000000000000000000000000000000000000..69c6f7444eecc56bb4ccb03fb600d9548bab5ffa --- /dev/null +++ b/levelfinishscreen/levelfinishscreen.gd @@ -0,0 +1,15 @@ +extends Node2D + + +# 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_end_button_pressed() -> void: + get_tree().change_scene_to_file("res://mainmenu/mainmenu.tscn") diff --git a/levelfinishscreen/levelfinishscreen.tscn b/levelfinishscreen/levelfinishscreen.tscn new file mode 100644 index 0000000000000000000000000000000000000000..871860880761ff4a9b97fc3b71883f0497224069 --- /dev/null +++ b/levelfinishscreen/levelfinishscreen.tscn @@ -0,0 +1,44 @@ +[gd_scene load_steps=2 format=3 uid="uid://ddvbo00k5tgcr"] + +[ext_resource type="Script" path="res://levelfinishscreen/levelfinishscreen.gd" id="1_arnqg"] + +[node name="Levelfinishscreen" type="Node2D"] +script = ExtResource("1_arnqg") + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="Control" type="Control" parent="CanvasLayer"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Label" type="Label" parent="CanvasLayer/Control"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -112.5 +offset_top = -11.5 +offset_right = 112.5 +offset_bottom = 11.5 +grow_horizontal = 2 +grow_vertical = 2 +text = "you have finished!!! good job!" + +[node name="EndButton" type="Button" parent="CanvasLayer/Control"] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.3 +anchor_top = 0.7 +anchor_right = 0.7 +anchor_bottom = 0.7 +offset_right = 8.0 +offset_bottom = 8.0 +text = "go back to menu" + +[connection signal="pressed" from="CanvasLayer/Control/EndButton" to="." method="_on_end_button_pressed"] diff --git a/mainmenu/mainmenu.gd b/mainmenu/mainmenu.gd new file mode 100644 index 0000000000000000000000000000000000000000..fa5533e73b5d1210670f87d61151ad18ec85aad1 --- /dev/null +++ b/mainmenu/mainmenu.gd @@ -0,0 +1,19 @@ +extends Node2D + + +# 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_play_button_pressed() -> void: + get_tree().change_scene_to_file("res://game.tscn") + + +func _on_quit_button_pressed() -> void: + get_tree().quit() diff --git a/mainmenu/mainmenu.tscn b/mainmenu/mainmenu.tscn new file mode 100644 index 0000000000000000000000000000000000000000..c0ab9b45bc77f30e2c137efaf22f172b1b478c04 --- /dev/null +++ b/mainmenu/mainmenu.tscn @@ -0,0 +1,64 @@ +[gd_scene load_steps=2 format=3 uid="uid://b0truefijink7"] + +[ext_resource type="Script" path="res://mainmenu/mainmenu.gd" id="1_ffu7g"] + +[node name="MainMenu" type="Node2D"] +script = ExtResource("1_ffu7g") + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="Control" type="Control" parent="CanvasLayer"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="TitleText" type="Label" parent="CanvasLayer/Control"] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.5 +anchor_top = 0.2 +anchor_right = 0.5 +anchor_bottom = 0.2 +offset_left = -36.0 +offset_right = 36.0 +offset_bottom = 23.0 +grow_horizontal = 2 +text = "Title Text" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="PlayButton" type="Button" parent="CanvasLayer/Control"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -31.5 +offset_top = -15.5 +offset_right = 31.5 +offset_bottom = 15.5 +grow_horizontal = 2 +grow_vertical = 2 +text = "Play!!!!!" + +[node name="QuitButton" type="Button" parent="CanvasLayer/Control"] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.5 +anchor_top = 0.6 +anchor_right = 0.5 +anchor_bottom = 0.6 +offset_left = -19.5 +offset_top = -15.5 +offset_right = 19.5 +offset_bottom = 15.5 +grow_horizontal = 2 +grow_vertical = 2 +text = "quit" + +[connection signal="pressed" from="CanvasLayer/Control/PlayButton" to="." method="_on_play_button_pressed"] +[connection signal="pressed" from="CanvasLayer/Control/QuitButton" to="." method="_on_quit_button_pressed"] diff --git a/project.godot b/project.godot index e392912784b8150068117c28acb10222c8e7847f..3a8e81e1f9f49e1f77d1eb37fd6c7dbaa2ef0552 100644 --- a/project.godot +++ b/project.godot @@ -14,7 +14,7 @@ config/name="Platformer 3D" config/description="Platformer 3D demo using a CharacterBody3D. It uses similar code to the 2D platformer, but implemented in 3D." config/tags=PackedStringArray("3d", "demo", "gridmap", "official", "physics") -run/main_scene="res://game.tscn" +run/main_scene="res://mainmenu/mainmenu.tscn" config/features=PackedStringArray("4.3") config/icon="res://icon.webp" @@ -22,6 +22,10 @@ config/icon="res://icon.webp" gdscript/warnings/untyped_declaration=1 +[dotnet] + +project/assembly_name="Platformer 3D" + [input] ui_accept={ diff --git a/win_flag/burger-cheese.glb b/win_flag/burger-cheese.glb new file mode 100644 index 0000000000000000000000000000000000000000..80cd26c6757485455eb3e391159a1909d678ab82 Binary files /dev/null and b/win_flag/burger-cheese.glb differ diff --git a/win_flag/burger-cheese.glb.import b/win_flag/burger-cheese.glb.import new file mode 100644 index 0000000000000000000000000000000000000000..54206602e370475b6589721a9ff6f8694b12bd36 --- /dev/null +++ b/win_flag/burger-cheese.glb.import @@ -0,0 +1,36 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://c3d1rjw0iujt6" +path="res://.godot/imported/burger-cheese.glb-7795635669d5e029b3875ba092f5682e.scn" + +[deps] + +source_file="res://win_flag/burger-cheese.glb" +dest_files=["res://.godot/imported/burger-cheese.glb-7795635669d5e029b3875ba092f5682e.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +_subresources={} +gltf/naming_version=1 +gltf/embedded_image_handling=1 diff --git a/win_flag/burger_cheese.tscn b/win_flag/burger_cheese.tscn new file mode 100644 index 0000000000000000000000000000000000000000..59f52eba84e619266c959e0531d0de2598c28169 --- /dev/null +++ b/win_flag/burger_cheese.tscn @@ -0,0 +1,31 @@ +[gd_scene load_steps=7 format=3 uid="uid://b7v56oetqdxlh"] + +[ext_resource type="PackedScene" uid="uid://c3d1rjw0iujt6" path="res://win_flag/burger-cheese.glb" id="1_hu56a"] +[ext_resource type="Texture2D" uid="uid://dryeryv2cbopm" path="res://win_flag/colormap.png" id="2_lpslh"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lr0c7"] +albedo_texture = ExtResource("2_lpslh") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_k1o8i"] +albedo_texture = ExtResource("2_lpslh") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_q88mq"] +albedo_texture = ExtResource("2_lpslh") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_bnngk"] +albedo_texture = ExtResource("2_lpslh") + +[node name="burger-cheese2" instance=ExtResource("1_hu56a")] +transform = Transform3D(3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0) + +[node name="bun-bottom" parent="burger-cheese" index="0"] +surface_material_override/0 = SubResource("StandardMaterial3D_lr0c7") + +[node name="bun-top" parent="burger-cheese" index="1"] +surface_material_override/0 = SubResource("StandardMaterial3D_k1o8i") + +[node name="cheese" parent="burger-cheese" index="2"] +surface_material_override/0 = SubResource("StandardMaterial3D_q88mq") + +[node name="patty" parent="burger-cheese" index="3"] +surface_material_override/0 = SubResource("StandardMaterial3D_bnngk") diff --git a/win_flag/colormap.png b/win_flag/colormap.png new file mode 100644 index 0000000000000000000000000000000000000000..1dfac9e6c4639266b629ad4c43e3048c2117d520 Binary files /dev/null and b/win_flag/colormap.png differ diff --git a/win_flag/colormap.png.import b/win_flag/colormap.png.import new file mode 100644 index 0000000000000000000000000000000000000000..ae0bb0eeb67daaa7a11a94fbfae9d540cb5abae0 --- /dev/null +++ b/win_flag/colormap.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dryeryv2cbopm" +path.s3tc="res://.godot/imported/colormap.png-0cf3ff2913cfdb59547f86ca4e9a82be.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://win_flag/colormap.png" +dest_files=["res://.godot/imported/colormap.png-0cf3ff2913cfdb59547f86ca4e9a82be.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +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=0 diff --git a/win_flag/floating_and_rotating.gd b/win_flag/floating_and_rotating.gd new file mode 100644 index 0000000000000000000000000000000000000000..88e5434340b7c8a76b54361c1123d3da929d9f46 --- /dev/null +++ b/win_flag/floating_and_rotating.gd @@ -0,0 +1,30 @@ +extends Node3D + +# Parameters that can be set per object +@export var rotation_speed = 1.0 # Rotation speed in radians per second +@export var float_speed = 2.0 # How fast the object floats up and down +@export var float_height = 0.5 # How high the object floats +@export var target_node: Node3D # Expose a generic target node for floating/rotating + +# Internal variable to track the starting Y position +var start_y = 0.0 + +func _ready() -> void: + # Ensure a target node is set + if target_node: + start_y = target_node.global_transform.origin.y + else: + print("No target node set for floating/rotating behavior.") + +func _process(delta: float) -> void: + if target_node: + # Apply rotation to the target node + target_node.rotate_y(rotation_speed * delta) + + # Apply floating to the target node + var new_y = start_y + float_height * sin(float_speed * get_time_since_start()) + target_node.global_transform.origin.y = new_y + +# Helper function to get the elapsed time since the game started +func get_time_since_start() -> float: + return Time.get_ticks_msec() / 1000.0 # Convert milliseconds to seconds diff --git a/win_flag/win_flag.gd b/win_flag/win_flag.gd new file mode 100644 index 0000000000000000000000000000000000000000..fae4c85309055ed51ca577a8dbc29656161fe0d7 --- /dev/null +++ b/win_flag/win_flag.gd @@ -0,0 +1,18 @@ +extends Area3D + + +# 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 + +# When the player enters the win flag, trigger the win condition +func _on_body_entered(body: Node3D) -> void: + # Check if the body is the player + if body.name == "Player": + print("Player touched the win flag!") + get_tree().change_scene_to_file("res://levelfinishscreen/levelfinishscreen.tscn") diff --git a/win_flag/win_flag.tscn b/win_flag/win_flag.tscn new file mode 100644 index 0000000000000000000000000000000000000000..68fe8e78a3074bbfe2ecf76fc05490c7a47feb3c --- /dev/null +++ b/win_flag/win_flag.tscn @@ -0,0 +1,24 @@ +[gd_scene load_steps=5 format=3 uid="uid://b03of5mof3l74"] + +[ext_resource type="Script" path="res://win_flag/win_flag.gd" id="1_5x3n8"] +[ext_resource type="Script" path="res://win_flag/floating_and_rotating.gd" id="1_cdtj8"] +[ext_resource type="PackedScene" uid="uid://b7v56oetqdxlh" path="res://win_flag/burger_cheese.tscn" id="1_vqagw"] + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_ywuv7"] +height = 1.10963 +radius = 0.456208 + +[node name="WinFlag" type="Area3D"] +script = ExtResource("1_5x3n8") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.305468, 0) +shape = SubResource("CylinderShape3D_ywuv7") + +[node name="burger-cheese" parent="." instance=ExtResource("1_vqagw")] + +[node name="FloatingNode" type="Node3D" parent="." node_paths=PackedStringArray("target_node")] +script = ExtResource("1_cdtj8") +target_node = NodePath("../burger-cheese") + +[connection signal="body_entered" from="." to="." method="_on_body_entered"]