Players can fight each other (but bose lose health)
This commit is contained in:
1 parent
c73f181dd5
commit
e8c7cb3e33
7 files changed
+28
-11
No files matched your search
+5
-3
@@ -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,8 +15,8 @@ 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 )]
|
||||
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
|
||||
[sub_resource type="SphereShape" id=5]
|
||||
|
||||
[node name="Torso" type="RigidBody"]
|
||||
[node name="Torso" type="RigidBody" groups=[
|
||||
"Player",
|
||||
]]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="TorsoMesh" type="MeshInstance" parent="."]
|
||||
@@ -20,7 +22,6 @@ 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 )
|
||||
|
||||
[node name="FrontLeft" type="Spatial" parent="."]
|
||||
|
||||
@@ -22,13 +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.origin
|
||||
var translation = physics_shape.global_transform
|
||||
print(translation)
|
||||
|
||||
remove_child(physics_shape)
|
||||
base.add_child(physics_shape)
|
||||
|
||||
physics_shape.global_transform.origin = translation
|
||||
physics_shape.global_transform = translation
|
||||
|
||||
setup_done = true
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ func _on_touch_area_entered(body):
|
||||
if body.is_in_group("Terrain"):
|
||||
push(body)
|
||||
elif body.is_in_group("Player"):
|
||||
InGameState.subtract_player_health(body.id, damage)
|
||||
InGameState.subtract_player_health(body.player_id, damage)
|
||||
|
||||
|
||||
func push(body):
|
||||
|
||||
Reference in new issue
Block a user