-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathshrimpcurrent.gd
More file actions
46 lines (35 loc) · 1 KB
/
Copy pathshrimpcurrent.gd
File metadata and controls
46 lines (35 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
extends Node2D
#imsxz, this script handles the player's """MIND""" essentially it lets them pick a shrimp after their shrimp dies.
var player_name = ""
var player_id = null
var shrimp = null
var picked_shrimp = "res://testing_shrimp.tscn"
#called by client when they want to spawn a new shrimp.
func spawn_shrimp():
if shrimp:
return
rpc("setup_shrimp_node", picked_shrimp)
sync_up()
remotesync func setup_shrimp_node(new_shrimp):
var chosen_shrimp = load(new_shrimp).instance()
add_child(chosen_shrimp)
chosen_shrimp.set_network_master(player_id)
chosen_shrimp.setup_vars()
shrimp = chosen_shrimp
$bar.visible = true
remotesync func set_player_name(new_name):
player_name = new_name
$bar/name.text = new_name
func set_player_id(new_id):
player_id = new_id
func set_cursor(tex):
$Destination/Sprite2.set_texture(tex)
func sync_up():
if shrimp:
shrimp.set_puppet_vars()
func set_shrimp(path):
picked_shrimp = path
func on_shrimp_death():
$bar.visible = false
shrimp.queue_free()
shrimp = null