diff --git a/3D Input/Bein_Mensch2.blend b/3D Input/Bein_Mensch2.blend new file mode 100644 index 0000000..633127d Binary files /dev/null and b/3D Input/Bein_Mensch2.blend differ diff --git a/3D Input/Bein_Mensch2.blend1 b/3D Input/Bein_Mensch2.blend1 new file mode 100644 index 0000000..dd943f1 Binary files /dev/null and b/3D Input/Bein_Mensch2.blend1 differ diff --git a/3D Input/Bein_Pferd.blend1 b/3D Input/Bein_Pferd.blend1 new file mode 100644 index 0000000..7385850 Binary files /dev/null and b/3D Input/Bein_Pferd.blend1 differ diff --git a/3D Input/Grundkörper Version 2.blend b/3D Input/Grundkörper Version 2.blend new file mode 100644 index 0000000..80d0c3c Binary files /dev/null and b/3D Input/Grundkörper Version 2.blend differ diff --git a/3D Input/Grundkörper Version 2.blend1 b/3D Input/Grundkörper Version 2.blend1 new file mode 100644 index 0000000..8cd2282 Binary files /dev/null and b/3D Input/Grundkörper Version 2.blend1 differ diff --git a/3D Input/Mensch_vogelarm_img.jpg b/3D Input/Mensch_vogelarm_img.jpg new file mode 100644 index 0000000..e432867 Binary files /dev/null and b/3D Input/Mensch_vogelarm_img.jpg differ diff --git a/3D Input/Mensch_vogelarm_img.jpg.import b/3D Input/Mensch_vogelarm_img.jpg.import new file mode 100644 index 0000000..203be74 --- /dev/null +++ b/3D Input/Mensch_vogelarm_img.jpg.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Mensch_vogelarm_img.jpg-5d39f9db9f9783e3ca3f442f40cfd4a4.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://3D Input/Mensch_vogelarm_img.jpg" +dest_files=[ "res://.import/Mensch_vogelarm_img.jpg-5d39f9db9f9783e3ca3f442f40cfd4a4.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/BodyParts/Arm.gd b/BodyParts/Arm.gd index f3f6ffe..9b7ed44 100644 --- a/BodyParts/Arm.gd +++ b/BodyParts/Arm.gd @@ -14,8 +14,8 @@ func action(): func push(body): - # TODO: Hardcoded values - maybe try to generalize - base.apply_impulse(transform.basis.xform(Vector3(0.0, 0.0, -3.0)), base.transform.basis.y * 10.0) + # We multiply by 0.1 because we only want it to spin slightly, it should mostly go up + base.apply_impulse(transform.basis.xform(touch_area.global_transform.origin) * 0.1, base.transform.basis.y * 5.0) # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta: float) -> void: diff --git a/BodyParts/Arm.tscn b/BodyParts/Arm.tscn index 17eb018..200c275 100644 --- a/BodyParts/Arm.tscn +++ b/BodyParts/Arm.tscn @@ -4,7 +4,9 @@ [ext_resource path="res://3D Input/untitled.glb" type="PackedScene" id=2] [ext_resource path="res://BodyParts/Arm.gd" type="Script" id=3] -[sub_resource type="SphereShape" id=1] +[sub_resource type="CapsuleShape" id=3] +radius = 0.724339 +height = 5.27855 [sub_resource type="SphereShape" id=2] radius = 0.591769 @@ -13,11 +15,14 @@ radius = 0.591769 script = ExtResource( 3 ) [node name="PartCollider" parent="." index="0"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -8 ) -shape = SubResource( 1 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5.34203 ) +shape = SubResource( 3 ) [node name="Mesh" parent="." index="1" instance=ExtResource( 2 )] +[node name="Sphere" parent="Mesh" index="0"] +visible = false + [node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"] transform = Transform( 1, -1.98247e-23, -2.98292e-24, 6.50669e-24, -9.49949e-08, 1, -2.07684e-23, -1, -9.49949e-08, -2.23781e-16, -0.0078205, -5.05441 ) bone_name = "bone_2" diff --git a/BodyParts/BodyBase/BodyBase.gd b/BodyParts/BodyBase/BodyBase.gd index 99d95e9..f48b502 100644 --- a/BodyParts/BodyBase/BodyBase.gd +++ b/BodyParts/BodyBase/BodyBase.gd @@ -1,9 +1,9 @@ extends Spatial class_name BodyBase -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" + +export(int) var player_id + # Called when the node enters the scene tree for the first time. func _ready(): diff --git a/BodyParts/BodyBase/BodyBase.tscn b/BodyParts/BodyBase/BodyBase.tscn index f6859cf..b80b9b8 100644 --- a/BodyParts/BodyBase/BodyBase.tscn +++ b/BodyParts/BodyBase/BodyBase.tscn @@ -8,12 +8,12 @@ [sub_resource type="SphereMesh" id=3] -[sub_resource type="GDScript" id=6] - -[sub_resource type="SphereShape" id=4] +[sub_resource type="GDScript" id=4] [sub_resource type="SphereShape" id=5] +[sub_resource type="SphereShape" id=6] + [node name="Torso" type="RigidBody"] script = ExtResource( 1 ) @@ -26,7 +26,7 @@ transform = Transform( 0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0 ) shape = SubResource( 2 ) [node name="FrontLeft" type="Spatial" parent="."] -transform = Transform( 1.62921e-07, -5.30863e-14, -1, -3.25841e-07, -1, 0, -1, 3.25841e-07, -1.62921e-07, 0.6, 0, 1 ) +transform = Transform( 0.5, -1.62921e-07, -0.866025, -3.25841e-07, -1, 0, -0.866025, 2.82187e-07, -0.5, 0.6, 0, 1 ) [node name="FrontLeftAttachMent" type="MeshInstance" parent="FrontLeft"] transform = Transform( 0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 0 ) @@ -34,14 +34,14 @@ mesh = SubResource( 3 ) material/0 = null [node name="Area" type="Area" parent="FrontLeft"] -script = SubResource( 6 ) +script = SubResource( 4 ) [node name="CollisionShape" type="CollisionShape" parent="FrontLeft/Area"] transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0 ) -shape = SubResource( 4 ) +shape = SubResource( 5 ) [node name="FrontRight" type="Spatial" parent="."] -transform = Transform( 1.62921e-07, -5.30863e-14, 1, -3.25841e-07, -1, 0, 1, -3.25841e-07, -1.62921e-07, -0.6, 0, 1 ) +transform = Transform( 0.5, -1.62921e-07, 0.866025, -3.25841e-07, -1, 0, 0.866025, -2.82187e-07, -0.5, -0.6, 0, 1 ) [node name="FrontRightAttachMent" type="MeshInstance" parent="FrontRight"] transform = Transform( 0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 0 ) @@ -52,4 +52,4 @@ material/0 = null [node name="CollisionShape" type="CollisionShape" parent="FrontRight/Area"] transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0 ) -shape = SubResource( 5 ) +shape = SubResource( 6 ) diff --git a/BodyParts/BodyPart.gd b/BodyParts/BodyPart.gd index e3b6e2f..18f6034 100644 --- a/BodyParts/BodyPart.gd +++ b/BodyParts/BodyPart.gd @@ -22,12 +22,13 @@ func _ready() -> void: func _process(delta: float) -> void: # We do this here because we want the whole tree to really be done instancing if not setup_done: - var translation = physics_shape.global_transform.basis * physics_shape.translation + var translation = physics_shape.global_transform + print(translation) remove_child(physics_shape) base.add_child(physics_shape) - physics_shape.translation = translation + physics_shape.global_transform = translation setup_done = true diff --git a/BodyParts/PushingBodyPart.gd b/BodyParts/PushingBodyPart.gd index 5b445ef..11e5615 100644 --- a/BodyParts/PushingBodyPart.gd +++ b/BodyParts/PushingBodyPart.gd @@ -3,6 +3,8 @@ class_name PushingBodyPart onready var touch_area = get_node("TouchArea") +export(float) var damage = 10.0 + # Called when the node enters the scene tree for the first time. func _ready() -> void: @@ -11,7 +13,10 @@ func _ready() -> void: func _on_touch_area_entered(body): if body.name != base.name: - push(body) + if body.is_in_group("Terrain"): + push(body) + elif body.is_in_group("Player"): + InGameState.subtract_player_health(body.player_id, damage) func push(body): diff --git a/Ingame/Testing.tscn b/Ingame/Testing.tscn index 6d46412..1170527 100644 --- a/Ingame/Testing.tscn +++ b/Ingame/Testing.tscn @@ -19,7 +19,9 @@ transform = Transform( 10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0 ) mesh = SubResource( 1 ) material/0 = null -[node name="StaticBody" type="StaticBody" parent="MeshInstance"] +[node name="StaticBody" type="StaticBody" parent="MeshInstance" groups=[ +"Terrain", +]] [node name="CollisionShape" type="CollisionShape" parent="MeshInstance/StaticBody"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 ) @@ -37,10 +39,26 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.02111, 0 ) [node name="Arm" parent="Torso/FrontLeft" index="1" instance=ExtResource( 1 )] key = 83 +damage = 10.0 [node name="Arm" parent="Torso/FrontRight" index="1" instance=ExtResource( 1 )] key = 65 +damage = 10.0 + +[node name="Torso2" parent="." instance=ExtResource( 3 )] +transform = Transform( -0.866025, -0.353553, -0.353553, -6.18172e-08, -0.707107, 0.707107, -0.5, 0.612372, 0.612372, 0, 3.02111, -9 ) +player_id = 1 + +[node name="Arm" parent="Torso2/FrontLeft" index="1" instance=ExtResource( 1 )] +key = 81 +damage = 10.0 + +[node name="Arm" parent="Torso2/FrontRight" index="1" instance=ExtResource( 1 )] +key = 87 +damage = 10.0 [node name="UI" parent="." instance=ExtResource( 2 )] [editable path="Torso"] + +[editable path="Torso2"] diff --git a/UI/UI.tscn b/UI/UI.tscn index 1b33837..13854aa 100644 --- a/UI/UI.tscn +++ b/UI/UI.tscn @@ -55,6 +55,7 @@ script = ExtResource( 1 ) __meta__ = { "_edit_use_anchors_": false } +player_id = 1 [node name="HSplitContainer2" type="HSplitContainer" parent="MarginContainer/PlayerHealthController/VSplitContainer"] visible = false diff --git a/UI/WinScreen.tscn b/UI/WinScreen.tscn new file mode 100644 index 0000000..77fb92c --- /dev/null +++ b/UI/WinScreen.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://UI/WinScreenScript.gd" type="Script" id=1] + +[node name="Spatial" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} +labelPath = NodePath("MarginContainer/VBoxContainer/PlayerWon") + +[node name="MarginContainer" type="MarginContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] +margin_right = 1024.0 +margin_bottom = 600.0 + +[node name="Congratz" type="Label" parent="MarginContainer/VBoxContainer"] +margin_top = -1.0 +margin_right = 1024.0 +margin_bottom = 249.0 +rect_min_size = Vector2( 0, 250 ) +text = "CONGRATULATIONS!" +align = 1 +valign = 2 + +[node name="PlayerWon" type="Label" parent="MarginContainer/VBoxContainer"] +margin_top = 254.0 +margin_right = 1024.0 +margin_bottom = 404.0 +rect_min_size = Vector2( 0, 150 ) +align = 1 +valign = 1 diff --git a/UI/WinScreenScript.gd b/UI/WinScreenScript.gd new file mode 100644 index 0000000..0e8dae2 --- /dev/null +++ b/UI/WinScreenScript.gd @@ -0,0 +1,22 @@ +extends Control + +export(NodePath) var labelPath + +#signal player_win(player_id) + +var _playerWonLabel + +# Called when the node enters the scene tree for the first time. +func _ready(): + _playerWonLabel = get_node(labelPath) as Label + + #connect("player_win", self, "_win_message") + + #emit_signal("player_win", 1) + + +func _win_message(player_id): + _playerWonLabel.text = "test" + + #print("game won!") + #print(player_id) diff --git a/project.godot b/project.godot index b3782d6..32d0b12 100644 --- a/project.godot +++ b/project.godot @@ -38,6 +38,7 @@ config/icon="res://icon.png" [autoload] BodyPartLoader="*res://Global/BodyPartLoader.gd" +InGameState="*res://Global/InGameState.gd" [rendering]