From 94012868f0eebaed7b9c5b46770f03f638b7538f Mon Sep 17 00:00:00 2001 From: ArunKirupananthan Date: Tue, 29 Sep 2026 21:07:28 -0400 Subject: [PATCH] week 1 four big gameobjects --- .editorconfig | 4 ++ .gitattributes | 2 + .gitignore | 3 ++ icon.svg | 1 + icon.svg.import | 43 ++++++++++++++++++++ project.godot | 36 +++++++++++++++++ scenes/game.tscn | 78 ++++++++++++++++++++++++++++++++++++ scripts/gamecontoller.gd | 18 +++++++++ scripts/gamecontoller.gd.uid | 1 + scripts/player.gd | 30 ++++++++++++++ scripts/player.gd.uid | 1 + scripts/trigger.gd | 16 ++++++++ scripts/trigger.gd.uid | 1 + 13 files changed, 234 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 icon.svg create mode 100644 icon.svg.import create mode 100644 project.godot create mode 100644 scenes/game.tscn create mode 100644 scripts/gamecontoller.gd create mode 100644 scripts/gamecontoller.gd.uid create mode 100644 scripts/player.gd create mode 100644 scripts/player.gd.uid create mode 100644 scripts/trigger.gd create mode 100644 scripts/trigger.gd.uid diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f28239b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*] +charset = utf-8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0af181c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +/android/ diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..c6bbb7d --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..4c03b5f --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b4t80o563njss" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..1570105 --- /dev/null +++ b/project.godot @@ -0,0 +1,36 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Sept2026" +run/main_scene="uid://bmghctv58ymhx" +config/features=PackedStringArray("4.7", "Forward Plus") +config/icon="res://icon.svg" + +[display] + +window/stretch/mode="canvas_items" +window/stretch/aspect="expand" + +[file_customization] + +folder_colors={ +"res://scenes/": "orange", +"res://scripts/": "red" +} + +[physics] + +3d/physics_engine="Jolt Physics" + +[rendering] + +rendering_device/driver.windows="d3d12" diff --git a/scenes/game.tscn b/scenes/game.tscn new file mode 100644 index 0000000..1ce6caa --- /dev/null +++ b/scenes/game.tscn @@ -0,0 +1,78 @@ +[gd_scene format=3 uid="uid://bmghctv58ymhx"] + +[ext_resource type="Script" uid="uid://ci5kwydrjchlr" path="res://scripts/gamecontoller.gd" id="1_lnu2h"] +[ext_resource type="Script" uid="uid://k5itsiku45rk" path="res://scripts/player.gd" id="1_uwrxv"] +[ext_resource type="Script" uid="uid://qdgabfyqg4v4" path="res://scripts/trigger.gd" id="1_yqjtg"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_daopg"] +size = Vector2(156, 39.5) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_kvpdf"] +size = Vector2(95.25, 20) + +[sub_resource type="CircleShape2D" id="CircleShape2D_daopg"] +radius = 65.06919 + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_daopg"] + +[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_daopg"] +distance = -534.0 + +[node name="Game" type="Node2D" unique_id=2025408499] +script = ExtResource("1_lnu2h") + +[node name="StaticBody2D" type="StaticBody2D" parent="." unique_id=50045338] +position = Vector2(356, 397) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" unique_id=1746367507] +shape = SubResource("RectangleShape2D_daopg") + +[node name="RigidBody2D" type="RigidBody2D" parent="." unique_id=1155250024] +position = Vector2(-86, 6.000002) +rotation = -0.07132487 +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D" unique_id=1735923422] +position = Vector2(391, 309) +shape = SubResource("RectangleShape2D_kvpdf") +debug_color = Color(0.7640784, 0.29976174, 0.010127576, 0.41960785) + +[node name="RigidBody2D2" type="RigidBody2D" parent="." unique_id=1925655640] +position = Vector2(420, 226) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D2" unique_id=471803879] +position = Vector2(-17.625, 0) +rotation = 0.16720873 +shape = SubResource("RectangleShape2D_kvpdf") +debug_color = Color(0.7640784, 0.29976174, 0.010127576, 0.41960785) + +[node name="trigger" type="Area2D" parent="." unique_id=970658975] +position = Vector2(255, 470) +scale = Vector2(0.8503403, 0.740157) +script = ExtResource("1_yqjtg") +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="trigger" unique_id=496847008] +shape = SubResource("CircleShape2D_daopg") +debug_color = Color(0.90523595, 0.00013803899, 0.7489745, 0.41960785) + +[node name="CharacterBody2D" type="CharacterBody2D" parent="." unique_id=613044494] +position = Vector2(340, 352) +script = ExtResource("1_uwrxv") +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D" unique_id=1901684918] +shape = SubResource("CapsuleShape2D_daopg") +debug_color = Color(0.42452708, 0.6028724, 0.041758128, 0.41960785) + +[node name="StaticBody2D2" type="StaticBody2D" parent="." unique_id=2128236600] +position = Vector2(344, 11) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D2" unique_id=1639942213] +shape = SubResource("WorldBoundaryShape2D_daopg") + +[connection signal="areatriggered" from="trigger" to="." method="_on_trigger"] +[connection signal="body_entered" from="trigger" to="trigger" method="_on_body_entered"] diff --git a/scripts/gamecontoller.gd b/scripts/gamecontoller.gd new file mode 100644 index 0000000..028ecdb --- /dev/null +++ b/scripts/gamecontoller.gd @@ -0,0 +1,18 @@ +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_trigger(effect: Variant, Object: Variant) -> void: + print ("Game controller knows about trigger") + if effect == "destroy": + if not Object is Player: + Object.queue_free() diff --git a/scripts/gamecontoller.gd.uid b/scripts/gamecontoller.gd.uid new file mode 100644 index 0000000..8a47dd0 --- /dev/null +++ b/scripts/gamecontoller.gd.uid @@ -0,0 +1 @@ +uid://ci5kwydrjchlr diff --git a/scripts/player.gd b/scripts/player.gd new file mode 100644 index 0000000..80f85c5 --- /dev/null +++ b/scripts/player.gd @@ -0,0 +1,30 @@ +class_name Player extends CharacterBody2D + + +const SPEED = 300.0 +const JUMP_VELOCITY = -400.0 + + +func _physics_process(delta: float) -> void: + # Add the gravity. + if not is_on_floor(): + velocity += get_gravity() * delta + + # Handle jump. + if Input.is_action_just_pressed("ui_accept") and is_on_floor(): + velocity.y = JUMP_VELOCITY + + # Get the input direction and handle the movement/deceleration. + # As good practice, you should replace UI actions with custom gameplay actions. + var direction := Input.get_axis("ui_left", "ui_right") + if direction: + velocity.x = direction * SPEED + else: + velocity.x = move_toward(velocity.x, 0, SPEED) + + move_and_slide() + # find all things my player collided with + for i in get_slide_collision_count(): + var c = get_slide_collision(i) + if c.get_collider() is RigidBody2D: + c.get_collider().apply_central_impulse(-c.get_normal() * 200) diff --git a/scripts/player.gd.uid b/scripts/player.gd.uid new file mode 100644 index 0000000..d65a6e3 --- /dev/null +++ b/scripts/player.gd.uid @@ -0,0 +1 @@ +uid://k5itsiku45rk diff --git a/scripts/trigger.gd b/scripts/trigger.gd new file mode 100644 index 0000000..4f36887 --- /dev/null +++ b/scripts/trigger.gd @@ -0,0 +1,16 @@ +extends Area2D +var effect="destroy" +signal areatriggered(effect, Object) +# 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_body_entered(body: Node2D) -> void: + print("Trigger was triggered") + areatriggered.emit(effect, body) diff --git a/scripts/trigger.gd.uid b/scripts/trigger.gd.uid new file mode 100644 index 0000000..1046473 --- /dev/null +++ b/scripts/trigger.gd.uid @@ -0,0 +1 @@ +uid://qdgabfyqg4v4