Added killfloor and respawn

This commit is contained in:
Jan 2020-06-19 01:21:17 +02:00
parent 8db36703d7
commit d423da3c1b
4 changed files with 24 additions and 6 deletions

View file

@ -122,6 +122,9 @@ sync func remove_player(id):
if player.name == str(id):
$Players.remove_child(player)
func get_spawn_point():
return $Level/SpawnPoint
func on_peer_connected(id):
print("Peer connected with id ", id)

View file

@ -1,4 +1,7 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://LevelComponents/Killfloor.tscn" type="PackedScene" id=1]
[ext_resource path="res://LevelComponents/SpawnPoint.tscn" type="PackedScene" id=2]
[sub_resource type="BoxShape" id=1]
@ -93,3 +96,8 @@ transform = Transform( 1.3411e-07, -2.98023e-08, -1, 0.258819, 0.965926, 0, 0.96
width = 19.8983
height = 1.04801
depth = 3.06491
[node name="Killfloor" parent="." instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.3435, 0 )
[node name="SpawnPoint" parent="." instance=ExtResource( 2 )]

View file

@ -26,7 +26,6 @@ var velocity = Vector3.ZERO
var walkDirection = Vector2.ZERO
var walkDirInt = Vector2.ZERO
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
@ -91,6 +90,14 @@ master func on_hit():
health -= 30
print(health)
master func kill():
health = 0
spawn()
func spawn():
health = 150
game.get_spawn_point().spawn(self)
func shoot():
var space_state = get_world().direct_space_state

View file

@ -6,11 +6,11 @@
radius = 0.33
height = 1.1
[sub_resource type="CylinderShape" id=3]
[sub_resource type="CylinderShape" id=2]
radius = 0.2
height = 0.3
[sub_resource type="CapsuleMesh" id=2]
[sub_resource type="CapsuleMesh" id=3]
radius = 0.33
mid_height = 1.1
@ -26,11 +26,11 @@ shape = SubResource( 1 )
[node name="CollisionShapeFeet" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.150321, 0 )
shape = SubResource( 3 )
shape = SubResource( 2 )
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.882822, 0 )
mesh = SubResource( 2 )
mesh = SubResource( 3 )
material/0 = null
[node name="Debug" type="Label" parent="."]