Added killfloor and respawn
parent
8db36703d7
commit
d423da3c1b
3
Game.gd
3
Game.gd
|
@ -122,6 +122,9 @@ sync func remove_player(id):
|
||||||
if player.name == str(id):
|
if player.name == str(id):
|
||||||
$Players.remove_child(player)
|
$Players.remove_child(player)
|
||||||
|
|
||||||
|
func get_spawn_point():
|
||||||
|
return $Level/SpawnPoint
|
||||||
|
|
||||||
func on_peer_connected(id):
|
func on_peer_connected(id):
|
||||||
print("Peer connected with id ", id)
|
print("Peer connected with id ", id)
|
||||||
|
|
||||||
|
|
10
Level.tscn
10
Level.tscn
|
@ -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]
|
[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
|
width = 19.8983
|
||||||
height = 1.04801
|
height = 1.04801
|
||||||
depth = 3.06491
|
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 )]
|
||||||
|
|
|
@ -26,7 +26,6 @@ var velocity = Vector3.ZERO
|
||||||
var walkDirection = Vector2.ZERO
|
var walkDirection = Vector2.ZERO
|
||||||
var walkDirInt = Vector2.ZERO
|
var walkDirInt = Vector2.ZERO
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
# Declare member variables here. Examples:
|
||||||
# var a = 2
|
# var a = 2
|
||||||
# var b = "text"
|
# var b = "text"
|
||||||
|
@ -91,6 +90,14 @@ master func on_hit():
|
||||||
health -= 30
|
health -= 30
|
||||||
print(health)
|
print(health)
|
||||||
|
|
||||||
|
master func kill():
|
||||||
|
health = 0
|
||||||
|
spawn()
|
||||||
|
|
||||||
|
func spawn():
|
||||||
|
health = 150
|
||||||
|
game.get_spawn_point().spawn(self)
|
||||||
|
|
||||||
func shoot():
|
func shoot():
|
||||||
var space_state = get_world().direct_space_state
|
var space_state = get_world().direct_space_state
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
radius = 0.33
|
radius = 0.33
|
||||||
height = 1.1
|
height = 1.1
|
||||||
|
|
||||||
[sub_resource type="CylinderShape" id=3]
|
[sub_resource type="CylinderShape" id=2]
|
||||||
radius = 0.2
|
radius = 0.2
|
||||||
height = 0.3
|
height = 0.3
|
||||||
|
|
||||||
[sub_resource type="CapsuleMesh" id=2]
|
[sub_resource type="CapsuleMesh" id=3]
|
||||||
radius = 0.33
|
radius = 0.33
|
||||||
mid_height = 1.1
|
mid_height = 1.1
|
||||||
|
|
||||||
|
@ -26,11 +26,11 @@ shape = SubResource( 1 )
|
||||||
|
|
||||||
[node name="CollisionShapeFeet" type="CollisionShape" parent="."]
|
[node name="CollisionShapeFeet" type="CollisionShape" parent="."]
|
||||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.150321, 0 )
|
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="."]
|
[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 )
|
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
|
material/0 = null
|
||||||
|
|
||||||
[node name="Debug" type="Label" parent="."]
|
[node name="Debug" type="Label" parent="."]
|
||||||
|
|
Reference in New Issue