automerge
This commit is contained in:
commit
e64bdba994
@ -1,15 +1,16 @@
|
||||
extends RigidBody
|
||||
extends "res://Ingame/BodyParts/PushingBodyPart.gd"
|
||||
|
||||
|
||||
onready var anim = get_node("AnimationPlayer")
|
||||
onready var skeleton = get_node("Armature/Skeleton")
|
||||
# Declare member variables here. Examples:
|
||||
# var a: int = 2
|
||||
# var b: String = "text"
|
||||
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventKey:
|
||||
if event.pressed and event.scancode == KEY_A:
|
||||
play()
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func play():
|
||||
anim.play("ArmatureAction001")
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta: float) -> void:
|
||||
# pass
|
||||
|
File diff suppressed because one or more lines are too long
17
Ingame/BodyParts/BodyBase.gd
Normal file
17
Ingame/BodyParts/BodyBase.gd
Normal file
@ -0,0 +1,17 @@
|
||||
extends Spatial
|
||||
class_name BodyBase
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a: int = 2
|
||||
# var b: String = "text"
|
||||
|
||||
|
||||
# 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
|
20
Ingame/BodyParts/BodyBase.tscn
Normal file
20
Ingame/BodyParts/BodyBase.tscn
Normal file
@ -0,0 +1,20 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://Ingame/BodyParts/BodyBase.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="CapsuleMesh" id=1]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape" id=2]
|
||||
points = PoolVector3Array( -0.976555, -0.115531, 0.676252, -0.97477, 0.129786, 0.675025, -0.972729, 0.170391, -0.632762, -0.930705, -0.318757, -0.672787, -0.884938, -0.438707, 0.628485, -0.852838, 0.129915, 1.00335, -0.849191, 0.496531, -0.672869, -0.803433, 0.574508, 0.628223, -0.768518, 0.129545, -1.12264, -0.725725, -0.3591, 1.07922, -0.721015, -0.680519, -0.586622, -0.683166, 0.534891, 0.994835, -0.648419, -0.115498, -1.24963, -0.562995, -0.807204, 0.672059, -0.526953, 0.130336, 1.33554, -0.480814, 0.617232, -1.11842, -0.479804, 0.859538, -0.669774, -0.479803, 0.859536, 0.669773, -0.440687, -0.603552, -1.16064, -0.43878, -0.884893, -0.628588, -0.317763, -0.885919, 0.832213, -0.282246, -0.240683, 1.42608, -0.198218, 0.335642, -1.41718, -0.197532, -0.975449, 0.552572, -0.15707, 0.581984, 1.29355, -0.156757, -0.525388, -1.33211, -0.156757, -0.525388, 1.33211, -0.117117, -0.199568, -1.46926, -0.116847, 0.213598, 1.46606, -0.11591, -0.976507, -0.67622, -0.115807, 0.826041, -1.04422, -0.115565, 0.988039, -0.551618, -0.0747357, 0.947977, 0.797463, 0.12956, -0.768424, -1.12278, 0.129786, -0.97477, 0.675025, 0.171135, 0.58102, -1.29182, 0.172267, 0.172267, -1.46605, 0.2128, -0.321832, 1.41923, 0.25284, 0.825812, -1.0032, 0.253122, 0.949838, 0.676403, 0.29257, -0.686201, 1.16252, 0.332014, 0.94129, -0.507643, 0.33379, 0.61975, 1.20479, 0.335646, -0.19822, -1.41719, 0.378044, -0.0339178, 1.42212, 0.413277, -0.845586, -0.832511, 0.453569, -0.885709, -0.54779, 0.496551, -0.441258, -1.24375, 0.496608, -0.849134, 0.672975, 0.572962, 0.775053, 0.747599, 0.577133, 0.332796, -1.24188, 0.654399, 0.735187, -0.667508, 0.700886, 0.25188, 1.16319, 0.736328, -0.560023, 0.871037, 0.742227, -0.237757, -1.12308, 0.742233, -0.237759, 1.12309, 0.85642, 0.492308, 0.626846, 0.856435, 0.492317, -0.626858, 0.859536, -0.479803, -0.669773, 0.866929, 0.170866, -0.962149, 0.899981, -0.398467, 0.669636, 0.990148, -0.0336554, -0.593795, 0.990984, 0.0890012, 0.553274, 0.991375, 0.00714278, 0.594536 )
|
||||
|
||||
[node name="BodyBase" type="RigidBody"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0 )
|
||||
mesh = SubResource( 1 )
|
||||
material/0 = null
|
||||
|
||||
[node name="BaseCollider" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0 )
|
||||
shape = SubResource( 2 )
|
43
Ingame/BodyParts/BodyPart.gd
Normal file
43
Ingame/BodyParts/BodyPart.gd
Normal file
@ -0,0 +1,43 @@
|
||||
extends Spatial
|
||||
class_name BodyPart
|
||||
|
||||
# Must be the direct child of a BodyBase
|
||||
|
||||
|
||||
onready var base = get_parent()
|
||||
onready var physics_shape = get_node("PartCollider")
|
||||
|
||||
export(int) var key
|
||||
|
||||
var setup_done = false
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
assert(base is BodyBase)
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
remove_child(physics_shape)
|
||||
base.add_child(physics_shape)
|
||||
|
||||
physics_shape.translation = translation
|
||||
|
||||
setup_done = true
|
||||
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventKey:
|
||||
if event.pressed and event.scancode == key:
|
||||
action()
|
||||
|
||||
|
||||
# Do something with the base
|
||||
func action():
|
||||
pass
|
8
Ingame/BodyParts/BodyPart.tscn
Normal file
8
Ingame/BodyParts/BodyPart.tscn
Normal file
@ -0,0 +1,8 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Ingame/BodyParts/BodyPart.gd" type="Script" id=1]
|
||||
|
||||
[node name="BodyPart" type="Spatial"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="PartCollider" type="CollisionShape" parent="."]
|
18
Ingame/BodyParts/PushingBodyPart.gd
Normal file
18
Ingame/BodyParts/PushingBodyPart.gd
Normal file
@ -0,0 +1,18 @@
|
||||
extends BodyPart
|
||||
class_name PushingBodyPart
|
||||
|
||||
onready var touch_area = get_node("TouchArea")
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
touch_area.connect("body_entered", self, "_on_touch_area_entered")
|
||||
|
||||
|
||||
func _on_touch_area_entered(body):
|
||||
if body.name != base.name:
|
||||
push(body)
|
||||
|
||||
|
||||
func push(body):
|
||||
pass
|
9
Ingame/BodyParts/PushingBodyPart.tscn
Normal file
9
Ingame/BodyParts/PushingBodyPart.tscn
Normal file
@ -0,0 +1,9 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Ingame/BodyParts/BodyPart.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Ingame/BodyParts/PushingBodyPart.gd" type="Script" id=2]
|
||||
|
||||
[node name="PushingBodyPart" instance=ExtResource( 1 )]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="TouchArea" type="Area" parent="." index="1"]
|
@ -1,12 +1,13 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://Ingame/BodyParts/Arm.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Ingame/BodyParts/BodyBase.tscn" type="PackedScene" id=2]
|
||||
|
||||
[sub_resource type="PlaneMesh" id=1]
|
||||
size = Vector2( 10, 10 )
|
||||
|
||||
[sub_resource type="ConcavePolygonShape" id=2]
|
||||
data = PoolVector3Array( 5, 0, 5, -5, 0, 5, 5, 0, -5, -5, 0, 5, -5, 0, -5, 5, 0, -5 )
|
||||
[sub_resource type="BoxShape" id=2]
|
||||
extents = Vector3( 5, 1, 5 )
|
||||
|
||||
[node name="Spatial" type="Spatial"]
|
||||
|
||||
@ -18,14 +19,23 @@ material/0 = null
|
||||
[node name="StaticBody" type="StaticBody" parent="MeshInstance"]
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="MeshInstance/StaticBody"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Camera" type="Camera" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 0.866025, 0.5, 0, -0.5, 0.866025, 0, 6, 8 )
|
||||
|
||||
[node name="Arm" parent="." instance=ExtResource( 1 )]
|
||||
transform = Transform( 3.87553e-08, -0.0559087, -0.998436, -8.97299e-08, -0.998436, 0.0559087, -1, 8.74228e-08, -4.37114e-08, 0, 4, 0 )
|
||||
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="DirectionalLight" type="DirectionalLight" parent="."]
|
||||
transform = Transform( 0.999532, 0.0126075, 0.027872, -0.0305909, 0.411942, 0.910697, 0, -0.911123, 0.412135, 0, 0, 0 )
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="BodyBase" parent="." instance=ExtResource( 2 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 7, 0 )
|
||||
|
||||
[node name="Arm" parent="BodyBase" instance=ExtResource( 1 )]
|
||||
transform = Transform( -0.965926, 0.258819, 0, -0.258819, -0.965926, 0, 0, 0, 1, 0, -4.76837e-07, 0 )
|
||||
key = 65
|
||||
|
||||
[node name="Arm2" parent="BodyBase" instance=ExtResource( 1 )]
|
||||
transform = Transform( 0.965926, -0.258819, -8.74228e-08, -0.258819, -0.965926, 0, -8.44439e-08, 2.26267e-08, -1, 0, -4.76837e-07, 0 )
|
||||
key = 83
|
||||
|
@ -8,14 +8,32 @@
|
||||
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_classes=[ {
|
||||
"base": "Spatial",
|
||||
"class": "BodyBase",
|
||||
"language": "GDScript",
|
||||
"path": "res://Ingame/BodyParts/BodyBase.gd"
|
||||
}, {
|
||||
"base": "Spatial",
|
||||
"class": "BodyPart",
|
||||
"language": "GDScript",
|
||||
"path": "res://Ingame/BodyParts/BodyPart.gd"
|
||||
}, {
|
||||
"base": "BodyPart",
|
||||
"class": "PushingBodyPart",
|
||||
"language": "GDScript",
|
||||
"path": "res://Ingame/BodyParts/PushingBodyPart.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
|
||||
"BodyBase": "",
|
||||
"BodyPart": "",
|
||||
"PushingBodyPart": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="BodyPartFighter"
|
||||
run/main_scene="res://Ingame/Testing.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[rendering]
|
||||
|
Loading…
x
Reference in New Issue
Block a user