commit 4dada35f76826c9fa8b25532e0384403a13aa769 Author: TimRatledge Date: Mon Apr 20 21:13:00 2026 -0400 static body, rigid body, characterbody. area, signals 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/Scenes/game.tscn b/Scenes/game.tscn new file mode 100644 index 0000000..03c1787 --- /dev/null +++ b/Scenes/game.tscn @@ -0,0 +1,74 @@ +[gd_scene format=3 uid="uid://bcisk0tho1stb"] + +[ext_resource type="Script" uid="uid://b4efh8nwneqkf" path="res://Scripts/player.gd" id="1_ebmjs"] +[ext_resource type="Script" uid="uid://ctdwfmqkny8rc" path="res://Scripts/game controller.gd" id="1_qxrlw"] +[ext_resource type="Script" uid="uid://kb3v21msvi17" path="res://Scripts/trigger.gd" id="3_wrm1d"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_2poj3"] +size = Vector2(82, 20) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ebmjs"] + +[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_2poj3"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_2poj3"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_3dryh"] +radius = 18.110771 + +[node name="Game" type="Node2D" unique_id=1323011736] +script = ExtResource("1_qxrlw") + +[node name="platfrom" type="StaticBody2D" parent="." unique_id=446401574] +position = Vector2(399, 122) +constant_linear_velocity = Vector2(10, 0) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="platfrom" unique_id=1022493365] +shape = SubResource("RectangleShape2D_2poj3") + +[node name="RigidBody2D" type="RigidBody2D" parent="." unique_id=193574446] +position = Vector2(360, 27.000004) +rotation = -1.7350631 +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D" unique_id=73164979] +shape = SubResource("RectangleShape2D_ebmjs") +debug_color = Color(0.8238579, 0.39945692, 0.031017382, 0.41960785) + +[node name="RigidBody2D2" type="RigidBody2D" parent="." unique_id=1977575109] +position = Vector2(428.99997, 26) +rotation = 0.54410887 +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D2" unique_id=1267574160] +shape = SubResource("RectangleShape2D_ebmjs") +debug_color = Color(0.8238579, 0.39945692, 0.031017382, 0.41960785) + +[node name="StaticBody2D" type="StaticBody2D" parent="." unique_id=1443311972] +position = Vector2(402, 247) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" unique_id=1935948289] +shape = SubResource("WorldBoundaryShape2D_2poj3") + +[node name="CharacterBody2D" type="CharacterBody2D" parent="." unique_id=793835080] +position = Vector2(399, 75) +script = ExtResource("1_ebmjs") +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D" unique_id=75435339] +shape = SubResource("CircleShape2D_2poj3") +debug_color = Color(0.25014314, 0.63459045, 0.102719225, 0.41960785) + +[node name="Area2D" type="Area2D" parent="." unique_id=1630381885] +position = Vector2(447, 155) +script = ExtResource("3_wrm1d") +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=180262903] +shape = SubResource("CircleShape2D_3dryh") +debug_color = Color(0.77940935, 0.23498747, 0.906131, 0.41960785) + +[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_body_entered"] +[connection signal="triggerActiveSignal" from="Area2D" to="." method="_on_triggerSignal"] diff --git a/Scripts/game controller.gd b/Scripts/game controller.gd new file mode 100644 index 0000000..c161670 --- /dev/null +++ b/Scripts/game controller.gd @@ -0,0 +1,17 @@ +extends Node2D + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + get_window().grab_focus() + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + + +func _on_triggerSignal(body: Variant, intentMessage: Variant) -> void: + print("GC knows about a trigger!") + if not body is Player and intentMessage == "destroy": + body.queue_free() diff --git a/Scripts/game controller.gd.uid b/Scripts/game controller.gd.uid new file mode 100644 index 0000000..62f18a2 --- /dev/null +++ b/Scripts/game controller.gd.uid @@ -0,0 +1 @@ +uid://ctdwfmqkny8rc diff --git a/Scripts/player.gd b/Scripts/player.gd new file mode 100644 index 0000000..06b142b --- /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() + for i in get_slide_collision_count(): + var c = get_slide_collision(i) + if c.get_collider() is RigidBody2D: + #deliver the impact + c.get_collider().apply_central_impulse(-c.get_normal() * 100) diff --git a/Scripts/player.gd.uid b/Scripts/player.gd.uid new file mode 100644 index 0000000..6df23cb --- /dev/null +++ b/Scripts/player.gd.uid @@ -0,0 +1 @@ +uid://b4efh8nwneqkf diff --git a/Scripts/trigger.gd b/Scripts/trigger.gd new file mode 100644 index 0000000..b2a46b2 --- /dev/null +++ b/Scripts/trigger.gd @@ -0,0 +1,9 @@ +class_name Trigger extends Area2D +@export var intent:String="destroy" +signal triggerActiveSignal(body, intentMessage) + + + +func _on_body_entered(body: Node2D) -> void: + print("Body Entered Trigger") + triggerActiveSignal.emit(body,intent) diff --git a/Scripts/trigger.gd.uid b/Scripts/trigger.gd.uid new file mode 100644 index 0000000..9d1a5af --- /dev/null +++ b/Scripts/trigger.gd.uid @@ -0,0 +1 @@ +uid://kb3v21msvi17 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..3d5b51e --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dh5dx7goqr6lh" +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..94ca7de --- /dev/null +++ b/project.godot @@ -0,0 +1,30 @@ +; 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="AprilGame" +run/main_scene="uid://bcisk0tho1stb" +config/features=PackedStringArray("4.6", "Forward Plus") +config/icon="res://icon.svg" + +[file_customization] + +folder_colors={ +"res://Scripts/": "red" +} + +[physics] + +3d/physics_engine="Jolt Physics" + +[rendering] + +rendering_device/driver.windows="d3d12"