From 3ec9bac0dab36daf2e7d35cf753b6c11aa8f5741 Mon Sep 17 00:00:00 2001 From: karl Date: Sat, 1 Feb 2020 16:06:53 +0100 Subject: [PATCH 1/5] Fix a thing with impulse offset + new camera --- BodyParts/Arm.gd | 2 +- BodyParts/Arm.tscn | 6 ++---- BodyParts/BodyBase/BodyBase.tscn | 2 +- Ingame/CameraFocus.gd | 16 ++++++++++++++++ Ingame/Testing.tscn | 16 +++++++++++----- 5 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 Ingame/CameraFocus.gd diff --git a/BodyParts/Arm.gd b/BodyParts/Arm.gd index 9b7ed44..570f038 100644 --- a/BodyParts/Arm.gd +++ b/BodyParts/Arm.gd @@ -15,7 +15,7 @@ func action(): func push(body): # 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) + base.apply_impulse(transform.basis.xform(global_transform.origin - 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 0413105..63e9496 100644 --- a/BodyParts/Arm.tscn +++ b/BodyParts/Arm.tscn @@ -13,8 +13,6 @@ radius = 0.591769 [node name="Arm" instance=ExtResource( 1 )] script = ExtResource( 3 ) -key = 0 -damage = 10.0 [node name="PartCollider" parent="." index="0"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2.83 ) @@ -29,14 +27,14 @@ visible = false transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) [node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"] -transform = Transform( 1, -1.98292e-23, -3.18966e-24, 6.71348e-24, -9.49949e-08, 1, -2.07636e-23, -1, -9.49949e-08, -2.23781e-16, -0.0078205, -5.05441 ) +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" [node name="RemoteTransform" type="RemoteTransform" parent="Mesh/Armature/Skeleton/BoneAttachment" index="0"] remote_path = NodePath("../../../../../TouchArea") [node name="TouchArea" parent="." index="2"] -transform = Transform( 1, -1.98292e-23, -3.18966e-24, 6.71348e-24, -9.49949e-08, 1, -2.07636e-23, -1, -9.49949e-08, -2.23781e-16, -0.0078205, -5.05441 ) +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 ) [node name="CollisionShape" type="CollisionShape" parent="TouchArea" index="0"] transform = Transform( 1, 2.98291e-24, -1.98247e-23, -2.07684e-23, -9.49949e-08, -1, -6.50669e-24, 1, -9.49949e-08, 0, 0, 0 ) diff --git a/BodyParts/BodyBase/BodyBase.tscn b/BodyParts/BodyBase/BodyBase.tscn index 95528e2..2f9456f 100644 --- a/BodyParts/BodyBase/BodyBase.tscn +++ b/BodyParts/BodyBase/BodyBase.tscn @@ -17,7 +17,7 @@ shape = SubResource( 2 ) 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="FrontRight" parent="." instance=ExtResource( 2 )] -transform = Transform( -0.5, 0, 0.866025, 0, 1, 0, -0.866025, 0, -0.5, -0.6, 0, 1 ) +transform = Transform( 0.5, -7.54979e-08, 0.866025, -1.50996e-07, -1, 0, 0.866025, -1.30766e-07, -0.5, -0.6, 0, 1 ) [node name="Mesh" parent="." instance=ExtResource( 3 )] transform = Transform( 0.2, 0, 0, 0, -8.74228e-09, 0.2, 0, -0.2, -8.74228e-09, 0, 0, 0 ) diff --git a/Ingame/CameraFocus.gd b/Ingame/CameraFocus.gd new file mode 100644 index 0000000..920504d --- /dev/null +++ b/Ingame/CameraFocus.gd @@ -0,0 +1,16 @@ +extends Spatial + + +onready var player1 = get_parent().get_node("Torso") +onready var player2 = get_parent().get_node("Torso2") + +onready var camera = get_node("Camera") + + +func _process(delta: float) -> void: + var center = player2.transform.origin + (player1.transform.origin - player2.transform.origin) / 2.0 + var distance = (player1.transform.origin - player2.transform.origin).length() + + camera.fov = distance + 50.0 + + transform.origin = center diff --git a/Ingame/Testing.tscn b/Ingame/Testing.tscn index 310dcba..d7b2beb 100644 --- a/Ingame/Testing.tscn +++ b/Ingame/Testing.tscn @@ -1,24 +1,24 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://BodyParts/Arm.tscn" type="PackedScene" id=1] [ext_resource path="res://UI/UI.tscn" type="PackedScene" id=2] [ext_resource path="res://BodyParts/BodyBase/BodyBase.tscn" type="PackedScene" id=3] [ext_resource path="res://Ingame/Ingame.gd" type="Script" id=4] [ext_resource path="res://Ingame/Arena.tscn" type="PackedScene" id=5] +[ext_resource path="res://Ingame/CameraFocus.gd" type="Script" id=6] [node name="InGame" type="Spatial"] script = ExtResource( 4 ) -[node name="Camera" type="Camera" parent="."] -transform = Transform( -4.37114e-08, -0.5, 0.866025, 0, 0.866025, 0.5, -1, 2.18557e-08, -3.78552e-08, 17, 9, -2 ) - [node name="Torso" parent="." instance=ExtResource( 3 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.02111, 0 ) +transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 3.02111, 28.4014 ) [node name="Arm" parent="Torso/FrontLeft" index="1" instance=ExtResource( 1 )] +transform = Transform( 1, 2.84217e-14, 0, -2.84217e-14, 1, 0, 0, 0, 1, 0, 0, 0 ) key = 83 [node name="Arm" parent="Torso/FrontRight" index="1" instance=ExtResource( 1 )] +transform = Transform( 1, 7.10543e-15, 0, -2.13163e-14, 1, 0, 0, 7.10543e-15, 1, 0, 0, 0 ) key = 65 [node name="Torso2" parent="." instance=ExtResource( 3 )] @@ -35,6 +35,12 @@ key = 87 [node name="Arena" parent="." instance=ExtResource( 5 )] +[node name="CameraFocus" type="Spatial" parent="."] +script = ExtResource( 6 ) + +[node name="Camera" type="Camera" parent="CameraFocus"] +transform = Transform( -4.2222e-08, -0.707107, 0.707107, -1.13133e-08, 0.707107, 0.707107, -1, 2.18557e-08, -3.78552e-08, 14, 13, 0 ) + [editable path="Torso"] [editable path="Torso2"] From ffae145aa6280f7428f423845ee3ce57f8b73035 Mon Sep 17 00:00:00 2001 From: Ententerminator Date: Sat, 1 Feb 2020 16:25:50 +0100 Subject: [PATCH 2/5] nino... weiter --- BodyConfig/bodyBuilderMenu.tscn | 1 - BodyConfig/bodyBuildingScript.gd | 25 +++++++++++++++---------- BodyParts/BodyBase/BodyBase.tscn | 10 ++++++---- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/BodyConfig/bodyBuilderMenu.tscn b/BodyConfig/bodyBuilderMenu.tscn index 6dfdb6a..d0f7a1b 100644 --- a/BodyConfig/bodyBuilderMenu.tscn +++ b/BodyConfig/bodyBuilderMenu.tscn @@ -66,7 +66,6 @@ collide_with_areas = true collide_with_bodies = false [node name="Torso" parent="." instance=ExtResource( 1 )] -[connection signal="pressed" from="GUI/HBoxC/VBoxC/Start" to="." method="_on_Button2_pressed"] [editable path="Torso"] diff --git a/BodyConfig/bodyBuildingScript.gd b/BodyConfig/bodyBuildingScript.gd index 9739736..78fe445 100644 --- a/BodyConfig/bodyBuildingScript.gd +++ b/BodyConfig/bodyBuildingScript.gd @@ -78,17 +78,24 @@ func _input(event): if _viewport.get_viewport().get_mouse_position().x >= 0: if event is InputEventMouseButton: if event.pressed: - print("Mouse Click at: ", event.position) _prev_mouse_pos = event.position _viewRot = true else: - print("mouse unpressed at: ", event.position) _viewRot = false func body_part_chosen(params): - var limb = _attachment_point.get_node("Limb") - if limb != null: + #no _attachment_point + if _attachment_point != null: + var limb = _attachment_point.get_node("Limb") + + #adding only possible if no first child + #if limb.get_child(0) == null: + # limb.add_child(BodyPartLoader.bodyparts[params].instance()) + + #if spot already taken, DELETE + if limb.get_child(0) != null: + delete_body_part() limb.add_child(BodyPartLoader.bodyparts[params].instance()) @@ -98,10 +105,8 @@ func make_it_shine(highlight : bool): func delete_body_part(): - var body_part = _attachment_point.get_node("Limb").get_child(0) - if body_part != null: - body_part.queue_free() - - - + if _attachment_point != null: + var body_part = _attachment_point.get_node("Limb").get_child(0) + if body_part != null: + body_part.queue_free() diff --git a/BodyParts/BodyBase/BodyBase.tscn b/BodyParts/BodyBase/BodyBase.tscn index 95528e2..eb25341 100644 --- a/BodyParts/BodyBase/BodyBase.tscn +++ b/BodyParts/BodyBase/BodyBase.tscn @@ -2,13 +2,18 @@ [ext_resource path="res://BodyParts/BodyBase/BodyBase.gd" type="Script" id=1] [ext_resource path="res://BodyParts/BodyBase/AttachmentPoint.tscn" type="PackedScene" id=2] -[ext_resource path="res://3D Input/Fertige GLBs/Torso.glb" type="PackedScene" id=3] + +[sub_resource type="CapsuleMesh" id=1] [sub_resource type="CapsuleShape" id=2] [node name="Torso" type="RigidBody"] script = ExtResource( 1 ) +[node name="TorsoMesh" type="MeshInstance" parent="."] +mesh = SubResource( 1 ) +material/0 = null + [node name="TorsoCollider" type="CollisionShape" parent="."] transform = Transform( 0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0 ) shape = SubResource( 2 ) @@ -18,6 +23,3 @@ transform = Transform( 0.5, -1.62921e-07, -0.866025, -3.25841e-07, -1, 0, -0.866 [node name="FrontRight" parent="." instance=ExtResource( 2 )] transform = Transform( -0.5, 0, 0.866025, 0, 1, 0, -0.866025, 0, -0.5, -0.6, 0, 1 ) - -[node name="Mesh" parent="." instance=ExtResource( 3 )] -transform = Transform( 0.2, 0, 0, 0, -8.74228e-09, 0.2, 0, -0.2, -8.74228e-09, 0, 0, 0 ) From 5b8458757274caf4a8fdad3ebfd83da091999241 Mon Sep 17 00:00:00 2001 From: mathias Date: Sat, 1 Feb 2020 16:29:58 +0100 Subject: [PATCH 3/5] Can now rotate the limbs --- BodyConfig/bodyBuildingScript.gd | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/BodyConfig/bodyBuildingScript.gd b/BodyConfig/bodyBuildingScript.gd index 9739736..23a958b 100644 --- a/BodyConfig/bodyBuildingScript.gd +++ b/BodyConfig/bodyBuildingScript.gd @@ -78,9 +78,14 @@ func _input(event): if _viewport.get_viewport().get_mouse_position().x >= 0: if event is InputEventMouseButton: if event.pressed: - print("Mouse Click at: ", event.position) - _prev_mouse_pos = event.position - _viewRot = true + if event.button_index == BUTTON_WHEEL_UP: + _attachment_point.get_node("Limb").rotate_z(0.1) + elif event.button_index == BUTTON_WHEEL_DOWN: + _attachment_point.get_node("Limb").rotate_z(-0.1) + else: + print("Mouse Click at: ", event.position) + _prev_mouse_pos = event.position + _viewRot = true else: print("mouse unpressed at: ", event.position) _viewRot = false From 83463e1a71f6a8969b70d1ce7e386b491891335a Mon Sep 17 00:00:00 2001 From: Ententerminator Date: Sat, 1 Feb 2020 16:44:12 +0100 Subject: [PATCH 4/5] imports, mathias schuld --- 3D Input/Beintextur.png.import | 34 ++++++++++++++++++++++++++++++++++ 3D Input/beinimage.png.import | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 3D Input/Beintextur.png.import create mode 100644 3D Input/beinimage.png.import diff --git a/3D Input/Beintextur.png.import b/3D Input/Beintextur.png.import new file mode 100644 index 0000000..c384a07 --- /dev/null +++ b/3D Input/Beintextur.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Beintextur.png-2ae020ac9731826dac97bd29939f551e.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://3D Input/Beintextur.png" +dest_files=[ "res://.import/Beintextur.png-2ae020ac9731826dac97bd29939f551e.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/3D Input/beinimage.png.import b/3D Input/beinimage.png.import new file mode 100644 index 0000000..9f17b69 --- /dev/null +++ b/3D Input/beinimage.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/beinimage.png-a7e3863a81de772333653d8998415984.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://3D Input/beinimage.png" +dest_files=[ "res://.import/beinimage.png-a7e3863a81de772333653d8998415984.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 From 7c3fd134e78d811769bc4a33de727f8af29baa64 Mon Sep 17 00:00:00 2001 From: Leon Palluch Date: Sat, 1 Feb 2020 16:54:53 +0100 Subject: [PATCH 5/5] mmmhh --- 3D Input/Beintextur.png.import | 34 ++++++++++++++++++++++++++++ 3D Input/beinimage.png.import | 34 ++++++++++++++++++++++++++++ Controllers/GameStateController.gd | 34 +++++++++++----------------- Controllers/GameStateController.tscn | 4 ++-- Resources/Fonts/FontReadMe.txt | 29 ++++++++++++++++++++++++ UI/WinScreen.tscn | 4 ++-- UI/WinScreenScript.gd | 4 ++-- 7 files changed, 116 insertions(+), 27 deletions(-) create mode 100644 3D Input/Beintextur.png.import create mode 100644 3D Input/beinimage.png.import create mode 100644 Resources/Fonts/FontReadMe.txt diff --git a/3D Input/Beintextur.png.import b/3D Input/Beintextur.png.import new file mode 100644 index 0000000..c384a07 --- /dev/null +++ b/3D Input/Beintextur.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Beintextur.png-2ae020ac9731826dac97bd29939f551e.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://3D Input/Beintextur.png" +dest_files=[ "res://.import/Beintextur.png-2ae020ac9731826dac97bd29939f551e.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/3D Input/beinimage.png.import b/3D Input/beinimage.png.import new file mode 100644 index 0000000..9f17b69 --- /dev/null +++ b/3D Input/beinimage.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/beinimage.png-a7e3863a81de772333653d8998415984.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://3D Input/beinimage.png" +dest_files=[ "res://.import/beinimage.png-a7e3863a81de772333653d8998415984.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/Controllers/GameStateController.gd b/Controllers/GameStateController.gd index 54dd23a..4f38f3c 100644 --- a/Controllers/GameStateController.gd +++ b/Controllers/GameStateController.gd @@ -2,21 +2,17 @@ extends Node var _win_screen_scene var _fighting_scene_path = "res://Ingame/Testing.tscn" - -#test vars -var test = 0 -var tested = false -signal player_win(player_id) - - +var _fighting_scene +var _body_build_scene func _ready(): _win_screen_scene = preload("res://UI/WinScreen.tscn").instance() - #_fighting_scene = preload("res://Ingame/Testing.tscn").instance() + _body_build_scene = preload("res://BodyConfig/bodyBuilderMenu.tscn").instance() + _fighting_scene = preload("res://Ingame/Testing.tscn").instance() - connect("player_win", self, "_switch_to_win") - _win_screen_scene.connect("start_fight", self, "_switch_to_fighting") - + InGameState.connect("player_win", self, "_switch_to_win") + _body_build_scene.connect("start_fight", self, "_switch_to_fighting") + _win_screen_scene.connect("build_body", self, "_switch_to_body_build") func _switch_scene(scene): #delete children @@ -35,15 +31,11 @@ func _switch_to_win(player_id): func _switch_to_fighting(): - #_switch_scene(_fighting_scene) - get_tree().reload_current_scene() + print("oh fuck") + + _switch_scene(_fighting_scene) + #get_tree().reload_current_scene() -# test -#func _process(delta): - #if test > 3 and not tested: - #tested = true - #test = 0 - #emit_signal("player_win", 1) - #else: - #test += delta +func _switch_to_body_build(): + _switch_scene(_body_build_scene) diff --git a/Controllers/GameStateController.tscn b/Controllers/GameStateController.tscn index e55c1f8..31e7866 100644 --- a/Controllers/GameStateController.tscn +++ b/Controllers/GameStateController.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=3 format=2] [ext_resource path="res://Controllers/GameStateController.gd" type="Script" id=1] -[ext_resource path="res://Ingame/Testing.tscn" type="PackedScene" id=2] +[ext_resource path="res://BodyConfig/bodyBuilderMenu.tscn" type="PackedScene" id=2] [node name="GameStateController" type="Node"] script = ExtResource( 1 ) -[node name="InGame" parent="." instance=ExtResource( 2 )] +[node name="Body Builder Menu" parent="." instance=ExtResource( 2 )] diff --git a/Resources/Fonts/FontReadMe.txt b/Resources/Fonts/FontReadMe.txt new file mode 100644 index 0000000..1d8b90b --- /dev/null +++ b/Resources/Fonts/FontReadMe.txt @@ -0,0 +1,29 @@ +T E P I D M O N K E Y F O N T S +freeware fonts for a freeware world + +Site: http://www.tepidmonkey.com/ +E-mail: brandon@tepidmonkey.com + +Thanks for your interest in my fonts! + +For help on how to unzip, unstuff or install one of my +fonts, please visit my site at +www.tepidmonkey.com and go to the Help section. +If you have any comments or questions, you can e-mail +me at brandon@tepidmonkey.com and I'll try to reply as +soon as possible. + +Every week, I present a brand new original font for +your downloading pleasure, so be sure to visit the web +site every Sunday. + +You may use this font(s) for non-commercial and +commercial purposes. You are not allowed to sell this +font for any fee at all. You are allowed to +redistribute it as long as you don't charge anything +for it and as long as you include this unaltered +ReadMe.txt file. You may not change any aspect of the font +file or of this file. +For the full set of terms of use (which override what +is listed here anyway), go to www.tepidmonkey.com +and visit the Terms section. \ No newline at end of file diff --git a/UI/WinScreen.tscn b/UI/WinScreen.tscn index 1a82773..bf0693b 100644 --- a/UI/WinScreen.tscn +++ b/UI/WinScreen.tscn @@ -38,9 +38,9 @@ align = 1 valign = 2 [node name="PlayerWon" type="Label" parent="MarginContainer/VBoxContainer"] -margin_top = 253.0 +margin_top = 254.0 margin_right = 1024.0 -margin_bottom = 503.0 +margin_bottom = 504.0 rect_min_size = Vector2( 0, 250 ) custom_fonts/font = ExtResource( 3 ) align = 1 diff --git a/UI/WinScreenScript.gd b/UI/WinScreenScript.gd index 6d9c713..d02ea86 100644 --- a/UI/WinScreenScript.gd +++ b/UI/WinScreenScript.gd @@ -3,7 +3,7 @@ extends Control export(NodePath) var labelPath export(NodePath) var continuePath -signal start_fight() +signal build_body() var _playerWonLabel var _continueButton @@ -20,4 +20,4 @@ func set_win_message(player_id): func _on_Continue_pressed(): print("test2") - emit_signal("start_fight") + emit_signal("build_body")