This commit is contained in:
Leon Palluch 2020-02-02 12:20:58 +01:00
commit 93857b958c
16 changed files with 171 additions and 32 deletions

View File

@ -2,33 +2,35 @@
importer="texture"
type="StreamTexture"
path="res://.import/froschtexture.png-4981f80e68642c0c23396f3b44826854.stex"
path.s3tc="res://.import/froschtexture.png-4981f80e68642c0c23396f3b44826854.s3tc.stex"
path.etc2="res://.import/froschtexture.png-4981f80e68642c0c23396f3b44826854.etc2.stex"
metadata={
"vram_texture": false
"imported_formats": [ "s3tc", "etc2" ],
"vram_texture": true
}
[deps]
source_file="res://3D Input/froschtexture.png"
dest_files=[ "res://.import/froschtexture.png-4981f80e68642c0c23396f3b44826854.stex" ]
dest_files=[ "res://.import/froschtexture.png-4981f80e68642c0c23396f3b44826854.s3tc.stex", "res://.import/froschtexture.png-4981f80e68642c0c23396f3b44826854.etc2.stex" ]
[params]
compress/mode=0
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/repeat=true
flags/filter=true
flags/mipmaps=false
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=2
flags/srgb=1
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
detect_3d=false
svg/scale=1.0

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +1,9 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://BodyParts/BodyBase/BodyBase.tscn" type="PackedScene" id=1]
[ext_resource path="res://BodyConfig/bodyBuildingScript.gd" type="Script" id=2]
[ext_resource path="res://BodyConfig/LoadBodyParts.gd" type="Script" id=3]
[ext_resource path="res://Ingame/Arena.tscn" type="PackedScene" id=4]
[node name="Body Builder Menu" type="Spatial"]
script = ExtResource( 2 )
@ -11,6 +12,7 @@ cameraPath = NodePath("GUI/HBoxC/ViewportContainer/Viewport/Camera")
rayCastPath = NodePath("GUI/HBoxC/ViewportContainer/Viewport/MouseLook")
viewPortPath = NodePath("GUI/HBoxC/ViewportContainer/Viewport")
playerNumPath = NodePath("PlayerCountLabel")
costProgressPath = NodePath("GUI/HBoxC/VBoxC/HBoxContainer/ProgressBar")
[node name="GUI" type="MarginContainer" parent="."]
anchor_right = 1.0
@ -33,15 +35,31 @@ margin_bottom = 600.0
rect_min_size = Vector2( 300, 500 )
script = ExtResource( 3 )
[node name="Start" type="Button" parent="GUI/HBoxC/VBoxC"]
[node name="HBoxContainer" type="HBoxContainer" parent="GUI/HBoxC/VBoxC"]
margin_right = 300.0
margin_bottom = 20.0
margin_bottom = 14.0
[node name="Label" type="Label" parent="GUI/HBoxC/VBoxC/HBoxContainer"]
margin_right = 36.0
margin_bottom = 14.0
text = "Cost: "
[node name="ProgressBar" type="ProgressBar" parent="GUI/HBoxC/VBoxC/HBoxContainer"]
margin_left = 40.0
margin_right = 240.0
margin_bottom = 14.0
rect_min_size = Vector2( 200, 0 )
[node name="Start" type="Button" parent="GUI/HBoxC/VBoxC"]
margin_top = 18.0
margin_right = 300.0
margin_bottom = 38.0
text = "Start Game"
[node name="Delete" type="Button" parent="GUI/HBoxC/VBoxC"]
margin_top = 24.0
margin_top = 42.0
margin_right = 300.0
margin_bottom = 44.0
margin_bottom = 62.0
text = "Delete"
[node name="ViewportContainer" type="ViewportContainer" parent="GUI/HBoxC"]
@ -79,4 +97,7 @@ __meta__ = {
}
[node name="Torso" parent="." instance=ExtResource( 1 )]
[node name="Arena" parent="." instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 0.707107, -0.707107, 0, 0.707107, 0.707107, 8, -9.91555, -6.62132 )
[connection signal="pressed" from="GUI/HBoxC/VBoxC/Start" to="." method="_on_Start_pressed"]

View File

@ -5,6 +5,7 @@ export(NodePath) var cameraPath
export(NodePath) var rayCastPath
export(NodePath) var viewPortPath
export(NodePath) var playerNumPath
export(NodePath) var costProgressPath
const ROT_MOD = 500
const ROT_DECLINE = 0.1
@ -16,6 +17,7 @@ var _rayCast : RayCast
var _torso : RigidBody
var _viewport : Viewport
var _playerNum : Label
var _costProgress : ProgressBar
var _velx = 0
var _vely = 0
@ -33,6 +35,7 @@ func _ready():
_rayCast = get_node(rayCastPath) as RayCast
_viewport = get_node(viewPortPath) as Viewport
_playerNum = get_node(playerNumPath) as Label
_costProgress = get_node(costProgressPath) as ProgressBar
# Keybinds of first player
_torso.get_node("DownFrontLeft").key = KEY_D
@ -134,15 +137,26 @@ func body_part_chosen(params):
#no _attachment_point
if _attachment_point != null:
var limb = _attachment_point.get_node("Limb")
var new_part = BodyPartLoader.bodyparts[params].instance()
#adding only possible if no first child
#if limb.get_child(0) == null:
# limb.add_child(BodyPartLoader.bodyparts[params].instance())
# Check if we have enough cost points left
var current_cost = 0
# If we already have something in that slot, we can place
# the new one if the total cost WITHOUT that existing part
# is low enough
if limb.get_child(0) != null:
current_cost += limb.get_child(0).cost
if _costProgress.value + new_part.cost - current_cost <= _costProgress.max_value:
#if spot already taken, DELETE
if limb.get_child(0) != null:
delete_body_part()
limb.add_child(BodyPartLoader.bodyparts[params].instance())
limb.add_child(new_part)
# Add the cost of that part
_costProgress.value += new_part.cost
func make_it_shine(highlight : bool):
@ -154,8 +168,10 @@ func delete_body_part():
if _attachment_point != null:
var body_part = _attachment_point.get_node("Limb").get_child(0)
if body_part != null:
_costProgress.value -= body_part.cost
body_part.queue_free()
func _on_Start_pressed():
make_it_shine(false)
emit_signal("start_fight", _torso)

View File

@ -9,6 +9,8 @@ onready var physics_shape = get_node("PartCollider")
var setup_done = false
export(float) var cost
# Called when the node enters the scene tree for the first time.
func _ready() -> void:

29
BodyParts/FrogLeg.gd Normal file
View File

@ -0,0 +1,29 @@
extends PushingBodyPart
onready var anim = get_node("Mesh/AnimationPlayer")
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func action():
anim.play("ArmatureAction")
func _is_animation_playing():
return anim.is_playing()
func push(body):
# We multiply by 0.1 because we only want it to spin slightly, it should mostly go up
var offset = transform.basis.xform(Vector3.ZERO) #transform.basis.xform(touch_area.global_transform.origin - base.global_transform.origin) * 0.5
var direction = (base.transform.basis.y - base.transform.basis.z).normalized() * 20.0
base.apply_impulse(offset, direction)
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta: float) -> void:
# pass

52
BodyParts/FrogLeg.tscn Normal file
View File

@ -0,0 +1,52 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://BodyParts/PushingBodyPart.tscn" type="PackedScene" id=1]
[ext_resource path="res://BodyParts/FrogLeg.gd" type="Script" id=2]
[ext_resource path="res://3D Input/Fertige GLBs/Bein_Frosch.glb" type="PackedScene" id=3]
[ext_resource path="res://3D Input/froschtexture.png" type="Texture" id=4]
[sub_resource type="BoxShape" id=2]
extents = Vector3( 0.649825, 2.07811, 1.64282 )
[sub_resource type="SphereShape" id=3]
radius = 0.115004
[sub_resource type="SpatialMaterial" id=1]
albedo_texture = ExtResource( 4 )
roughness = 0.3
[node name="FrogLeg" instance=ExtResource( 1 )]
transform = Transform( -1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0, 1, 0, 0, 0 )
script = ExtResource( 2 )
[node name="PartCollider" parent="." index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.21377, -0.911304, -3.94992 )
shape = SubResource( 2 )
[node name="TouchArea" parent="." index="1"]
transform = Transform( 2.2019, -0.624093, -2.57245, 1.35866, 3.13817, 0.40161, 2.27179, -1.27191, 2.25313, 0.307055, -2.49965, -4.98782 )
[node name="CollisionShape" type="CollisionShape" parent="TouchArea" index="0"]
shape = SubResource( 3 )
[node name="Mesh" parent="." index="2" instance=ExtResource( 3 )]
transform = Transform( -1.13133e-08, 4.2222e-08, 1, 0.965926, 0.258819, 0, -0.258819, 0.965926, -4.37114e-08, 0.734499, -2.94707, -2.68774 )
[node name="Skeleton" parent="Mesh/Armature" index="0"]
bones/3/bound_children = [ NodePath("BoneAttachment") ]
[node name="froschbein" parent="Mesh/Armature/Skeleton" index="0"]
transform = Transform( 1, -1.49012e-08, 0, 0, 1, -5.96046e-08, 0, 2.98023e-08, 1, 0, 0, 0 )
material/0 = SubResource( 1 )
[node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"]
transform = Transform( -0.207654, -0.97489, 0.0804374, -0.106263, -0.059262, -0.99257, 0.972414, -0.214658, -0.091288, 0.208948, 1.33566, -0.895561 )
bone_name = "bone_3"
[node name="RemoteTransform" type="RemoteTransform" parent="Mesh/Armature/Skeleton/BoneAttachment" index="0"]
remote_path = NodePath("../../../../../TouchArea")
[node name="AnimationPlayer" parent="Mesh" index="2"]
playback_speed = 2.0
[editable path="Mesh"]

View File

@ -4,6 +4,10 @@ extends PushingBodyPart
onready var anim = get_node("Mesh/AnimationPlayer")
func _is_animation_playing():
return anim.is_playing()
func action():
anim.play("ArmatureAction")

View File

@ -13,13 +13,14 @@ radius = 0.125064
[node name="HumanArm" instance=ExtResource( 1 )]
transform = Transform( -4.37114e-08, 1, 4.37114e-08, 0, -4.37114e-08, 1, 1, 4.37114e-08, 1.91069e-15, 0, 0, 0 )
script = ExtResource( 2 )
cost = 10.0
[node name="PartCollider" parent="." index="0"]
transform = Transform( 0.796097, 0, -0.605169, 0, 1, -3.55271e-15, 0.605169, 8.35188e-23, 0.796097, -0.894889, 1.42109e-14, -2.6182 )
shape = SubResource( 1 )
[node name="TouchArea" parent="." index="1"]
transform = Transform( -0.114995, 2.15415, 2.55188, -3.31495, -0.382831, 0.173782, 0.404395, -2.52562, 2.15021, -0.0333271, -0.131349, -3.878 )
transform = Transform( -0.118289, 2.18551, 2.52493, -3.31556, -0.378316, 0.172131, 0.398447, -2.49922, 2.18193, -0.0255739, -0.127111, -3.79535 )
[node name="CollisionShape" type="CollisionShape" parent="TouchArea" index="0"]
shape = SubResource( 2 )
@ -27,8 +28,11 @@ shape = SubResource( 2 )
[node name="Mesh" parent="." index="2" instance=ExtResource( 4 )]
transform = Transform( 2, 0, 0, 0, 2, 0, 0, 0, 2, -0.357728, -8.51476, 0 )
[node name="Skeleton" parent="Mesh/Armature" index="0"]
bones/7/bound_children = [ NodePath("BoneAttachment") ]
[node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"]
transform = Transform( 0.0638506, -0.727912, -0.682691, -0.242273, 0.652315, -0.718184, 0.968104, 0.211254, -0.134703, 0.0541456, 1.16231, 0.134369 )
transform = Transform( 0.0646207, -0.736312, -0.673549, -0.240426, 0.64359, -0.726627, 0.968514, 0.208894, -0.135439, 0.054756, 1.13784, 0.129916 )
bone_name = "bone_6"
[node name="RemoteTransform" type="RemoteTransform" parent="Mesh/Armature/Skeleton/BoneAttachment" index="0"]

View File

@ -9,6 +9,10 @@ func _ready() -> void:
pass # Replace with function body.
func _is_animation_playing():
return anim.is_playing()
func action():
anim.play("ArmatureAction")

View File

@ -17,13 +17,14 @@ albedo_texture = ExtResource( 4 )
[node name="HumanLeg" instance=ExtResource( 1 )]
transform = Transform( 1, 8.74228e-08, -3.82137e-15, 0, -4.37114e-08, -1, -8.74228e-08, 1, -4.37114e-08, 0, 0, 0 )
script = ExtResource( 2 )
cost = 20.0
[node name="PartCollider" parent="." index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.37252, -0.326758 )
shape = SubResource( 1 )
[node name="TouchArea" parent="." index="1"]
transform = Transform( 3.95755, 9.02389e-13, -4.54747e-13, -1.36424e-12, -0.554944, -3.91846, 1.57933e-13, 3.91846, -0.554943, -1.33582e-12, -5.30189, -1.33664 )
transform = Transform( 3.95756, 9.05942e-13, -4.54747e-13, -1.33582e-12, -0.554944, -3.91846, 1.57933e-13, 3.91846, -0.554943, -1.3074e-12, -5.3019, -1.33665 )
[node name="CollisionShape" type="CollisionShape" parent="TouchArea" index="0"]
shape = SubResource( 2 )

View File

@ -11,8 +11,13 @@ func _ready() -> void:
touch_area.connect("body_entered", self, "_on_touch_area_entered")
# Override in derived classes!
func _is_animation_playing():
return true
func _on_touch_area_entered(body):
if body.name != base.name:
if body.name != base.name and _is_animation_playing():
if body.is_in_group("Terrain"):
push(body)
elif body.is_in_group("Player"):

View File

@ -6,3 +6,4 @@ var bodyparts : Dictionary
func _ready():
bodyparts["Human Arm"] = load("res://BodyParts/HumanArm.tscn")
bodyparts["Human Leg"] = load("res://BodyParts/HumanLeg.tscn")
bodyparts["Frog Leg"] = load("res://BodyParts/FrogLeg.tscn")

View File

@ -2,11 +2,9 @@
[ext_resource path="res://Ingame/Level/Torch.tscn" type="PackedScene" id=1]
[ext_resource path="res://Ingame/Level/Ground.tscn" type="PackedScene" id=2]
[ext_resource path="res://default_env.tres" type="Environment" id=3]
[ext_resource path="res://Ingame/Level/Fence.tscn" type="PackedScene" id=5]
[sub_resource type="Environment" id=1]
ambient_light_color = Color( 0.203922, 0.231373, 0.329412, 1 )
[sub_resource type="Curve3D" id=2]
_data = {
"points": PoolVector3Array( -6.18582, 0, 7.84923, 6.18582, 0, -7.84923, -49.9513, 0, -34.3585, -4.51454, 0, 0.679321, 4.51454, 0, -0.679321, -15.3927, 0, -53.766, -21.9094, 0, -9.41343, 21.9094, 0, 9.41343, 23.1226, 0, -50.5878, -3.51591, 0, -8.89224, 3.51591, 0, 8.89224, 48.9412, 0, -26.3448, -0.144619, 0, -5.61391, 0.144619, 0, 5.61391, 60.7732, 0, 13.6973, 4.99704, -4.57764e-05, -11.0807, -4.99704, 4.57764e-05, 11.0807, 54.4575, 0, 49.3261, 10.0432, 0, -5.64291, -10.0432, 0, 5.64291, 32.3244, 0, 71.386, 10.2301, 0, -1.21242, -10.2301, 0, 1.21242, 2.64864, -1.52588e-05, 80.1473, 8.65666, 0, 3.83833, -8.65666, 0, -3.83833, -24.225, 0, 77.5418, 6.10191, 0, 6.62698, -6.10191, 0, -6.62698, -47.3545, 0, 62.2559, 2.38824, 0, 9.77866, -2.38824, 0, -9.77866, -62.2404, 0, 29.8337, -1.39743, 0, 9.2999, 1.39743, 0, -9.2999, -65.2092, 0, -9.54412, 0, 0, 0, 0, 0, 0, -49.9513, 0, -34.3585 ),
@ -34,7 +32,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 52.7943, 0, 76.6803 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.293457, 0, 5.53332 )
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource( 1 )
environment = ExtResource( 3 )
[node name="ground" parent="." instance=ExtResource( 2 )]

View File

@ -1,7 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[gd_resource type="Environment" format=2]
[resource]
background_mode = 2
background_sky = SubResource( 1 )
ambient_light_color = Color( 0.203922, 0.231373, 0.329412, 1 )
tonemap_mode = 2
tonemap_exposure = 0.6
tonemap_white = 1.5