From a0c72f8faeaef0422b5a20562c047cd01b620f8c Mon Sep 17 00:00:00 2001 From: 3002102 <3002102@stud.hs-mannheim.de> Date: Sun, 12 Apr 2026 13:43:44 +0200 Subject: [PATCH] added game root node and player scene. also created assets, scenes and scripts folder --- icon.svg => assets/icon.svg | 0 icon.svg.import => assets/icon.svg.import | 6 +++--- project.godot | 3 ++- scenes/game.tscn | 9 ++++++++ scenes/player.tscn | 15 ++++++++++++++ scripts/player.gd | 25 +++++++++++++++++++++++ scripts/player.gd.uid | 1 + 7 files changed, 55 insertions(+), 4 deletions(-) rename icon.svg => assets/icon.svg (100%) rename icon.svg.import => assets/icon.svg.import (80%) create mode 100644 scenes/game.tscn create mode 100644 scenes/player.tscn create mode 100644 scripts/player.gd create mode 100644 scripts/player.gd.uid diff --git a/icon.svg b/assets/icon.svg similarity index 100% rename from icon.svg rename to assets/icon.svg diff --git a/icon.svg.import b/assets/icon.svg.import similarity index 80% rename from icon.svg.import rename to assets/icon.svg.import index e4e1387..2bf0b67 100644 --- a/icon.svg.import +++ b/assets/icon.svg.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://db6gtr4tljfh2" -path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +path="res://.godot/imported/icon.svg-56083ea2a1f1a4f1e49773bdc6d7826c.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://icon.svg" -dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] +source_file="res://assets/icon.svg" +dest_files=["res://.godot/imported/icon.svg-56083ea2a1f1a4f1e49773bdc6d7826c.ctex"] [params] diff --git a/project.godot b/project.godot index dda8ce6..d726138 100644 --- a/project.godot +++ b/project.godot @@ -11,8 +11,9 @@ config_version=5 [application] config/name="gae_wild_jam" +run/main_scene="uid://lq8e5h6fjrnq" config/features=PackedStringArray("4.6", "GL Compatibility") -config/icon="res://icon.svg" +config/icon="res://assets/icon.svg" [physics] diff --git a/scenes/game.tscn b/scenes/game.tscn new file mode 100644 index 0000000..4c4e43b --- /dev/null +++ b/scenes/game.tscn @@ -0,0 +1,9 @@ +[gd_scene format=3 uid="uid://lq8e5h6fjrnq"] + +[ext_resource type="PackedScene" uid="uid://cw8jnr0mscanx" path="res://scenes/player.tscn" id="1_uwrxv"] + +[node name="Game" type="Node2D" unique_id=1188224334] + +[node name="Player" parent="." unique_id=804585690 instance=ExtResource("1_uwrxv")] + +[node name="Camera2D" type="Camera2D" parent="Player" unique_id=866207293] diff --git a/scenes/player.tscn b/scenes/player.tscn new file mode 100644 index 0000000..7ca5ad7 --- /dev/null +++ b/scenes/player.tscn @@ -0,0 +1,15 @@ +[gd_scene format=3 uid="uid://cw8jnr0mscanx"] + +[ext_resource type="Script" uid="uid://cb378ofiodjbg" path="res://scripts/player.gd" id="1_3vyb7"] +[ext_resource type="Texture2D" uid="uid://db6gtr4tljfh2" path="res://assets/icon.svg" id="2_g2els"] + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_u8vuu"] + +[node name="Player" type="CharacterBody2D" unique_id=804585690] +script = ExtResource("1_3vyb7") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=896441301] +shape = SubResource("CapsuleShape2D_u8vuu") + +[node name="Sprite2D" type="Sprite2D" parent="." unique_id=723284336] +texture = ExtResource("2_g2els") diff --git a/scripts/player.gd b/scripts/player.gd new file mode 100644 index 0000000..b1f4780 --- /dev/null +++ b/scripts/player.gd @@ -0,0 +1,25 @@ +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() diff --git a/scripts/player.gd.uid b/scripts/player.gd.uid new file mode 100644 index 0000000..4b40520 --- /dev/null +++ b/scripts/player.gd.uid @@ -0,0 +1 @@ +uid://cb378ofiodjbg