diff --git a/indigogameone/.gitattributes b/indigogameone/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/indigogameone/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/indigogameone/.gitignore b/indigogameone/.gitignore new file mode 100644 index 0000000..0af181c --- /dev/null +++ b/indigogameone/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +/android/ diff --git a/indigogameone/icon.svg b/indigogameone/icon.svg new file mode 100644 index 0000000..9d8b7fa --- /dev/null +++ b/indigogameone/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/indigogameone/icon.svg.import b/indigogameone/icon.svg.import new file mode 100644 index 0000000..32f2bec --- /dev/null +++ b/indigogameone/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dge3vcdfdbs8m" +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/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +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=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/indigogameone/project.godot b/indigogameone/project.godot new file mode 100644 index 0000000..fcf2904 --- /dev/null +++ b/indigogameone/project.godot @@ -0,0 +1,16 @@ +; 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="indigogameone" +run/main_scene="res://scenes/game.tscn" +config/features=PackedStringArray("4.3", "Forward Plus") +config/icon="res://icon.svg" diff --git a/indigogameone/scenes/crate.tscn b/indigogameone/scenes/crate.tscn new file mode 100644 index 0000000..3f859ff --- /dev/null +++ b/indigogameone/scenes/crate.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=2 format=3 uid="uid://d4lcu5l7nqd2f"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_51x3g"] + +[node name="RigidBody2D" type="RigidBody2D"] +position = Vector2(557, 287) +rotation = -0.704149 +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_51x3g") +debug_color = Color(0.819608, 0.447059, 0.654902, 0.643137) diff --git a/indigogameone/scenes/game.tscn b/indigogameone/scenes/game.tscn new file mode 100644 index 0000000..45f7d39 --- /dev/null +++ b/indigogameone/scenes/game.tscn @@ -0,0 +1,63 @@ +[gd_scene load_steps=7 format=3 uid="uid://bpvxf6b1pgvw1"] + +[ext_resource type="PackedScene" uid="uid://d4lcu5l7nqd2f" path="res://scenes/crate.tscn" id="1_5062r"] +[ext_resource type="Script" path="res://scripts/player.gd" id="2_u8ltq"] +[ext_resource type="PackedScene" uid="uid://ckvtpjm5q2t0d" path="res://scenes/trigger.tscn" id="3_bhtcy"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_by4gc"] +size = Vector2(25.75, 20) + +[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_7qxn5"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_gwwau"] + +[node name="World" type="Node2D"] + +[node name="platform" type="StaticBody2D" parent="."] +position = Vector2(373, 218) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="platform"] +shape = SubResource("RectangleShape2D_by4gc") + +[node name="platform2" type="StaticBody2D" parent="."] +position = Vector2(312, 290) +scale = Vector2(7.14333, 0.916857) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="platform2"] +shape = SubResource("RectangleShape2D_by4gc") + +[node name="platform3" type="StaticBody2D" parent="."] +position = Vector2(486, 340) +scale = Vector2(7.14333, 0.916857) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="platform3"] +shape = SubResource("RectangleShape2D_by4gc") + +[node name="Floor" type="StaticBody2D" parent="."] +position = Vector2(558, 525) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Floor"] +shape = SubResource("WorldBoundaryShape2D_7qxn5") + +[node name="RigidBody2D" parent="." instance=ExtResource("1_5062r")] + +[node name="RigidBody2D2" parent="." instance=ExtResource("1_5062r")] +position = Vector2(424, 370) + +[node name="RigidBody2D3" parent="." instance=ExtResource("1_5062r")] +position = Vector2(603, 416) + +[node name="CharacterBody2D" type="CharacterBody2D" parent="."] +position = Vector2(555, 322) +script = ExtResource("2_u8ltq") +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"] +shape = SubResource("CircleShape2D_gwwau") +debug_color = Color(0.858824, 0.227451, 0.4, 0.909804) + +[node name="Area2D" parent="." instance=ExtResource("3_bhtcy")] diff --git a/indigogameone/scenes/trigger.tscn b/indigogameone/scenes/trigger.tscn new file mode 100644 index 0000000..7163478 --- /dev/null +++ b/indigogameone/scenes/trigger.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=3 format=3 uid="uid://ckvtpjm5q2t0d"] + +[ext_resource type="Script" path="res://scripts/trigger.gd" id="1_sw0t6"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_o2g0y"] +radius = 116.43 + +[node name="Area2D" type="Area2D"] +position = Vector2(724, 403) +script = ExtResource("1_sw0t6") +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_o2g0y") +debug_color = Color(0.54902, 0.419608, 0.960784, 0.333333) + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] +[connection signal="body_exited" from="." to="." method="_on_body_exited"] diff --git a/indigogameone/scripts/player.gd b/indigogameone/scripts/player.gd new file mode 100644 index 0000000..13ed12d --- /dev/null +++ b/indigogameone/scripts/player.gd @@ -0,0 +1,31 @@ +extends CharacterBody2D + + +const SPEED = 300.0 +const JUMP_VELOCITY = -400.0 + + +func _physics_process(delta: float) -> void: + # Add the gravity. where main game loop is gonna go + 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: #checking if its a crate + c.get_collider().apply_central_impulse(-c.get_normal()*100) + + #i is gonna be increased by one by every colision as I move diff --git a/indigogameone/scripts/trigger.gd b/indigogameone/scripts/trigger.gd new file mode 100644 index 0000000..b630d2f --- /dev/null +++ b/indigogameone/scripts/trigger.gd @@ -0,0 +1,19 @@ +extends Area2D + + +# 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 +#signals main ways obj interact with each other + +func _on_body_entered(body: Node2D) -> void: + print("Trigger is fired") + + +func _on_body_exited(body: Node2D) -> void: + print("Excited Trigger") # Replace with function body.