MP sync working, redoing all menus now
This commit is contained in:
1 parent
d3dcbc153a
commit
d7572b48cc
16 files changed
+327
-70
No files matched your search
@@ -9,6 +9,7 @@ extends CharacterBody2D
|
|||||||
@export var attack_speed := 2000
|
@export var attack_speed := 2000
|
||||||
@export var throwback_strength := 2
|
@export var throwback_strength := 2
|
||||||
@onready var player_sprite = $Sprite2D
|
@onready var player_sprite = $Sprite2D
|
||||||
|
@onready var player_cam = $player_cam
|
||||||
@onready var player := get_node(".")
|
@onready var player := get_node(".")
|
||||||
#Animation
|
#Animation
|
||||||
@onready var anim_tree = $AnimationTree
|
@onready var anim_tree = $AnimationTree
|
||||||
@@ -44,9 +45,19 @@ signal value_changed
|
|||||||
signal health_changed
|
signal health_changed
|
||||||
signal player_killed
|
signal player_killed
|
||||||
|
|
||||||
|
func _enter_tree():
|
||||||
|
set_multiplayer_authority(str(name).to_int())
|
||||||
|
|
||||||
|
@rpc("any_peer")
|
||||||
|
func set_spawn_location(spawn_position: Vector2):
|
||||||
|
print("RPC position update! from PEER ID: ", player.name, spawn_position)
|
||||||
|
set_position(spawn_position)
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
if not is_multiplayer_authority(): return
|
if not is_multiplayer_authority(): return
|
||||||
print("Setting IDLE")
|
print("Setting IDLE: ", get_position())
|
||||||
|
player_cam.make_current()
|
||||||
|
#player_cam.current = true # for mp to set the camera
|
||||||
#anim_mode.travel("idle")
|
#anim_mode.travel("idle")
|
||||||
|
|
||||||
|
|
||||||
@@ -107,6 +118,9 @@ func attack_finished():
|
|||||||
is_attacking = false
|
is_attacking = false
|
||||||
|
|
||||||
func get_input():
|
func get_input():
|
||||||
|
if Input.is_action_just_pressed("reset_pos"):
|
||||||
|
print("REsetting player POS: ")
|
||||||
|
set_position(Vector2(-110, 561))
|
||||||
if Input.is_action_just_pressed("print_pos"):
|
if Input.is_action_just_pressed("print_pos"):
|
||||||
print("PLAYER POSITION!: ", player.get_position())
|
print("PLAYER POSITION!: ", player.get_position())
|
||||||
if Input.is_action_just_pressed("show_inventory"):
|
if Input.is_action_just_pressed("show_inventory"):
|
||||||
@@ -171,7 +185,9 @@ func get_input():
|
|||||||
else:
|
else:
|
||||||
anim_tree.set("parameters/walkIdleBlend/blend_amount", 0)
|
anim_tree.set("parameters/walkIdleBlend/blend_amount", 0)
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
|
if not is_multiplayer_authority(): return
|
||||||
# if not is_multiplayer_authority():
|
# if not is_multiplayer_authority():
|
||||||
# get_input()
|
# get_input()
|
||||||
# move_and_slide()
|
# move_and_slide()
|
||||||
@@ -185,7 +201,11 @@ func _physics_process(delta):
|
|||||||
var collider = collision.get_collider()
|
var collider = collision.get_collider()
|
||||||
if collider.is_in_group("moveable"):
|
if collider.is_in_group("moveable"):
|
||||||
var normal = collision.get_normal()
|
var normal = collision.get_normal()
|
||||||
collider.apply_central_impulse(-collision.get_normal() * push_power)
|
collider.apply_central_force(-collision.get_normal() * push_power)
|
||||||
|
#collider.applied_force = -collision.get_normal() * push_power
|
||||||
|
#collider.move_object.rpc()
|
||||||
|
|
||||||
|
#collider.apply_central_impulse()
|
||||||
# push back the player when player pushed
|
# push back the player when player pushed
|
||||||
#player_hit.is_player_hit = true
|
#player_hit.is_player_hit = true
|
||||||
#player_hit.hit_velocity = push_power * .1
|
#player_hit.hit_velocity = push_power * .1
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
[gd_scene load_steps=20 format=3 uid="uid://c1gncjamuavvs"]
|
[gd_scene load_steps=22 format=3 uid="uid://c1gncjamuavvs"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Characters/test_player/test_player.gd" id="1_6aci1"]
|
[ext_resource type="Script" path="res://Characters/test_player/test_player.gd" id="1_6aci1"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cs5o8bykug82q" path="res://Characters/test_player/WARRIOR SKELETON SS 2.png" id="1_8pmbp"]
|
[ext_resource type="Texture2D" uid="uid://cs5o8bykug82q" path="res://Characters/test_player/WARRIOR SKELETON SS 2.png" id="1_8pmbp"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://0ou4asf4vsc1" path="res://UI/Inventory/Inventory.tscn" id="3_fol83"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_a08cb"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_3qub5"]
|
||||||
size = Vector2(22, 20)
|
size = Vector2(22, 20)
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_1103t"]
|
[sub_resource type="Animation" id="Animation_v17mb"]
|
||||||
resource_name = "attack"
|
resource_name = "attack"
|
||||||
length = 0.65
|
length = 0.65
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
@@ -22,7 +23,7 @@ tracks/0/keys = {
|
|||||||
"values": [Vector2i(0, 5), Vector2i(1, 5), Vector2i(2, 5), Vector2i(3, 5)]
|
"values": [Vector2i(0, 5), Vector2i(1, 5), Vector2i(2, 5), Vector2i(3, 5)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_vnyb5"]
|
[sub_resource type="Animation" id="Animation_dhyjd"]
|
||||||
resource_name = "damage"
|
resource_name = "damage"
|
||||||
step = 0.01
|
step = 0.01
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
@@ -38,7 +39,7 @@ tracks/0/keys = {
|
|||||||
"values": [Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1)]
|
"values": [Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(0.792157, 0.0901961, 0.0901961, 1), Color(1, 1, 1, 1)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_gq32v"]
|
[sub_resource type="Animation" id="Animation_jals6"]
|
||||||
resource_name = "die"
|
resource_name = "die"
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
@@ -53,7 +54,7 @@ tracks/0/keys = {
|
|||||||
"values": [Vector2i(0, 4), Vector2i(1, 4), Vector2i(2, 4), Vector2i(3, 4), Vector2i(4, 4)]
|
"values": [Vector2i(0, 4), Vector2i(1, 4), Vector2i(2, 4), Vector2i(3, 4), Vector2i(4, 4)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_r2lqp"]
|
[sub_resource type="Animation" id="Animation_mhxr4"]
|
||||||
resource_name = "idle"
|
resource_name = "idle"
|
||||||
length = 2.0
|
length = 2.0
|
||||||
loop_mode = 1
|
loop_mode = 1
|
||||||
@@ -70,7 +71,7 @@ tracks/0/keys = {
|
|||||||
"values": [Vector2i(0, 0), Vector2i(1, 0), Vector2i(2, 0), Vector2i(3, 0), Vector2i(4, 0)]
|
"values": [Vector2i(0, 0), Vector2i(1, 0), Vector2i(2, 0), Vector2i(3, 0), Vector2i(4, 0)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_psmw8"]
|
[sub_resource type="Animation" id="Animation_5kwsw"]
|
||||||
resource_name = "walk"
|
resource_name = "walk"
|
||||||
loop_mode = 1
|
loop_mode = 1
|
||||||
step = 0.01
|
step = 0.01
|
||||||
@@ -87,81 +88,97 @@ tracks/0/keys = {
|
|||||||
"values": [Vector2i(0, 1), Vector2i(1, 1), Vector2i(2, 1), Vector2i(3, 1), Vector2i(4, 1), Vector2i(5, 1)]
|
"values": [Vector2i(0, 1), Vector2i(1, 1), Vector2i(2, 1), Vector2i(3, 1), Vector2i(4, 1), Vector2i(5, 1)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_rx5pu"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_mfcw3"]
|
||||||
_data = {
|
_data = {
|
||||||
"attack": SubResource("Animation_1103t"),
|
"attack": SubResource("Animation_v17mb"),
|
||||||
"damage": SubResource("Animation_vnyb5"),
|
"damage": SubResource("Animation_dhyjd"),
|
||||||
"die": SubResource("Animation_gq32v"),
|
"die": SubResource("Animation_jals6"),
|
||||||
"idle": SubResource("Animation_r2lqp"),
|
"idle": SubResource("Animation_mhxr4"),
|
||||||
"walk": SubResource("Animation_psmw8")
|
"walk": SubResource("Animation_5kwsw")
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_7kx25"]
|
[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_lqar1"]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_gm2dr"]
|
[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_vr7py"]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_cl8pn"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_d7310"]
|
||||||
animation = &"attack"
|
animation = &"attack"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_tyu0k"]
|
[sub_resource type="AnimationNodeOneShot" id="AnimationNodeOneShot_83svy"]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_f5cnp"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ixc0x"]
|
||||||
animation = &"damage"
|
animation = &"damage"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_4qn65"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_wmn47"]
|
||||||
animation = &"die"
|
animation = &"die"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_kqkvd"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_poall"]
|
||||||
animation = &"idle"
|
animation = &"idle"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_66hu3"]
|
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_cxexk"]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_jxg51"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6a4lj"]
|
||||||
animation = &"walk"
|
animation = &"walk"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_6ake6"]
|
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_4pmjh"]
|
||||||
graph_offset = Vector2(-1059.2, -82.3198)
|
graph_offset = Vector2(-769.911, -161.25)
|
||||||
nodes/AttackOneShot/node = SubResource("AnimationNodeOneShot_7kx25")
|
nodes/AttackOneShot/node = SubResource("AnimationNodeOneShot_lqar1")
|
||||||
nodes/AttackOneShot/position = Vector2(-320, 60)
|
nodes/AttackOneShot/position = Vector2(-320, 60)
|
||||||
nodes/DieOneShot/node = SubResource("AnimationNodeOneShot_gm2dr")
|
nodes/DieOneShot/node = SubResource("AnimationNodeOneShot_vr7py")
|
||||||
nodes/DieOneShot/position = Vector2(-120, 180)
|
nodes/DieOneShot/position = Vector2(-120, 180)
|
||||||
nodes/attack_anim/node = SubResource("AnimationNodeAnimation_cl8pn")
|
nodes/attack_anim/node = SubResource("AnimationNodeAnimation_d7310")
|
||||||
nodes/attack_anim/position = Vector2(-560, 200)
|
nodes/attack_anim/position = Vector2(-560, 200)
|
||||||
nodes/damageOneShot/node = SubResource("AnimationNodeOneShot_tyu0k")
|
nodes/damageOneShot/node = SubResource("AnimationNodeOneShot_83svy")
|
||||||
nodes/damageOneShot/position = Vector2(100, 320)
|
nodes/damageOneShot/position = Vector2(100, 320)
|
||||||
nodes/damage_anim/node = SubResource("AnimationNodeAnimation_f5cnp")
|
nodes/damage_anim/node = SubResource("AnimationNodeAnimation_ixc0x")
|
||||||
nodes/damage_anim/position = Vector2(-200, 460)
|
nodes/damage_anim/position = Vector2(-200, 460)
|
||||||
nodes/die_anim/node = SubResource("AnimationNodeAnimation_4qn65")
|
nodes/die_anim/node = SubResource("AnimationNodeAnimation_wmn47")
|
||||||
nodes/die_anim/position = Vector2(-440, 340)
|
nodes/die_anim/position = Vector2(-440, 340)
|
||||||
nodes/idle_anim/node = SubResource("AnimationNodeAnimation_kqkvd")
|
nodes/idle_anim/node = SubResource("AnimationNodeAnimation_poall")
|
||||||
nodes/idle_anim/position = Vector2(-940, 60)
|
nodes/idle_anim/position = Vector2(-940, 60)
|
||||||
nodes/output/position = Vector2(400, 340)
|
nodes/output/position = Vector2(400, 340)
|
||||||
nodes/walkIdleBlend/node = SubResource("AnimationNodeBlend2_66hu3")
|
nodes/walkIdleBlend/node = SubResource("AnimationNodeBlend2_cxexk")
|
||||||
nodes/walkIdleBlend/position = Vector2(-660, -40)
|
nodes/walkIdleBlend/position = Vector2(-660, -40)
|
||||||
nodes/walk_anim/node = SubResource("AnimationNodeAnimation_jxg51")
|
nodes/walk_anim/node = SubResource("AnimationNodeAnimation_6a4lj")
|
||||||
nodes/walk_anim/position = Vector2(-920, -80)
|
nodes/walk_anim/position = Vector2(-920, -80)
|
||||||
node_connections = [&"output", 0, &"damageOneShot", &"AttackOneShot", 0, &"walkIdleBlend", &"AttackOneShot", 1, &"attack_anim", &"DieOneShot", 0, &"AttackOneShot", &"DieOneShot", 1, &"die_anim", &"damageOneShot", 0, &"DieOneShot", &"damageOneShot", 1, &"damage_anim", &"walkIdleBlend", 0, &"walk_anim", &"walkIdleBlend", 1, &"idle_anim"]
|
node_connections = [&"output", 0, &"damageOneShot", &"AttackOneShot", 0, &"walkIdleBlend", &"AttackOneShot", 1, &"attack_anim", &"DieOneShot", 0, &"AttackOneShot", &"DieOneShot", 1, &"die_anim", &"damageOneShot", 0, &"DieOneShot", &"damageOneShot", 1, &"damage_anim", &"walkIdleBlend", 0, &"walk_anim", &"walkIdleBlend", 1, &"idle_anim"]
|
||||||
|
|
||||||
|
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_n4dy6"]
|
||||||
|
properties/0/path = NodePath(".:position")
|
||||||
|
properties/0/spawn = true
|
||||||
|
properties/0/sync = true
|
||||||
|
properties/1/path = NodePath(".:rotation")
|
||||||
|
properties/1/spawn = true
|
||||||
|
properties/1/sync = true
|
||||||
|
properties/2/path = NodePath("Sprite2D:frame")
|
||||||
|
properties/2/spawn = true
|
||||||
|
properties/2/sync = true
|
||||||
|
properties/3/path = NodePath("Sprite2D:flip_h")
|
||||||
|
properties/3/spawn = true
|
||||||
|
properties/3/sync = true
|
||||||
|
|
||||||
[node name="test_player" type="CharacterBody2D" groups=["player"]]
|
[node name="test_player" type="CharacterBody2D" groups=["player"]]
|
||||||
|
motion_mode = 1
|
||||||
script = ExtResource("1_6aci1")
|
script = ExtResource("1_6aci1")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(1, 2)
|
position = Vector2(1, 2)
|
||||||
shape = SubResource("RectangleShape2D_a08cb")
|
shape = SubResource("RectangleShape2D_3qub5")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
z_index = 1
|
z_index = 1
|
||||||
texture = ExtResource("1_8pmbp")
|
texture = ExtResource("1_8pmbp")
|
||||||
hframes = 6
|
hframes = 6
|
||||||
vframes = 6
|
vframes = 6
|
||||||
|
frame = 4
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
libraries = {
|
libraries = {
|
||||||
"": SubResource("AnimationLibrary_rx5pu")
|
"": SubResource("AnimationLibrary_mfcw3")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="AnimationTree" type="AnimationTree" parent="."]
|
[node name="AnimationTree" type="AnimationTree" parent="."]
|
||||||
tree_root = SubResource("AnimationNodeBlendTree_6ake6")
|
tree_root = SubResource("AnimationNodeBlendTree_4pmjh")
|
||||||
anim_player = NodePath("../AnimationPlayer")
|
anim_player = NodePath("../AnimationPlayer")
|
||||||
active = true
|
active = true
|
||||||
parameters/AttackOneShot/active = false
|
parameters/AttackOneShot/active = false
|
||||||
@@ -174,6 +191,13 @@ parameters/walkIdleBlend/blend_amount = 1.0
|
|||||||
|
|
||||||
[node name="player_cam" type="Camera2D" parent="."]
|
[node name="player_cam" type="Camera2D" parent="."]
|
||||||
modulate = Color(0, 0, 0, 1)
|
modulate = Color(0, 0, 0, 1)
|
||||||
current = true
|
|
||||||
|
|
||||||
[node name="InvulnerableTimer" type="Timer" parent="."]
|
[node name="InvulnerableTimer" type="Timer" parent="."]
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="Inventory" parent="CanvasLayer" instance=ExtResource("3_fol83")]
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
|
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||||
|
replication_config = SubResource("SceneReplicationConfig_n4dy6")
|
||||||
@@ -1,22 +1,81 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@onready var manager = get_node(".")
|
@onready var manager = get_node(".")
|
||||||
|
@onready var main_menu = $CanvasLayer/MainMenu
|
||||||
|
@onready var start_game_menu = $CanvasLayer/StartGameMenu
|
||||||
|
@onready var address_entry = $CanvasLayer/MainMenu/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2/AddressEntry
|
||||||
|
@onready var notifications = $CanvasLayer/notifications
|
||||||
|
@onready var spawner = $MultiplayerSpawner
|
||||||
|
|
||||||
|
|
||||||
|
var PORT = 9999
|
||||||
|
var enet_peer = ENetMultiplayerPeer.new()
|
||||||
|
|
||||||
const Level1 = preload("res://Levels/Level1/Level1.tscn")
|
const Level1 = preload("res://Levels/Level1/Level1.tscn")
|
||||||
const Player = preload("res://Characters/test_player/test_player.tscn")
|
const Player = preload("res://Characters/test_player/test_player.tscn")
|
||||||
|
var spawn_location: Vector2 = Vector2.ZERO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
|
#get_tree().paused = true
|
||||||
var level_1 = Level1.instantiate()
|
var level_1 = Level1.instantiate()
|
||||||
var spawn_location = level_1.get_node("PlayerSpawnLocation")
|
var spawn_location_in_level = level_1.get_node("PlayerSpawnLocation")
|
||||||
spawn_location.set_visible(false)
|
spawn_location = spawn_location_in_level.get_position()
|
||||||
manager.add_child(level_1)
|
spawn_location_in_level.set_visible(false)
|
||||||
var new_player = Player.instantiate()
|
add_child(level_1)
|
||||||
manager.add_child(new_player)
|
|
||||||
new_player.set_position(spawn_location.get_position())
|
|
||||||
|
|
||||||
|
|
||||||
|
func add_player(peer_id):
|
||||||
|
var player = Player.instantiate()
|
||||||
|
player.name = str(peer_id)
|
||||||
|
add_child(player) # Adds to current scene under root node
|
||||||
|
if peer_id == 1:
|
||||||
|
player.set_position(spawn_location)
|
||||||
|
else:
|
||||||
|
spawn_location = spawn_location + Vector2(50, 0)
|
||||||
|
player.set_spawn_location.rpc(spawn_location)
|
||||||
|
print("SPAWN LOCATION: ", spawn_location, " PEER ID: ", player.name)
|
||||||
|
# show_notification.rpc("Test Message")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@rpc("call_local")
|
||||||
|
func show_notification(my_message: String):
|
||||||
|
notifications.show_new_notification(my_message)
|
||||||
|
|
||||||
|
func _on_host_button_pressed(): # When hosting a new game
|
||||||
|
main_menu.hide()
|
||||||
|
start_game_menu.show()
|
||||||
|
enet_peer.create_server(PORT)
|
||||||
|
multiplayer.multiplayer_peer = enet_peer
|
||||||
|
multiplayer.peer_connected.connect(add_player)
|
||||||
|
|
||||||
|
add_player(multiplayer.get_unique_id())
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _on_join_button_pressed():
|
||||||
|
main_menu.hide()
|
||||||
|
enet_peer.create_client("localhost", PORT)
|
||||||
|
multiplayer.multiplayer_peer = enet_peer
|
||||||
|
|
||||||
|
|
||||||
|
func _on_start_game_button_pressed():
|
||||||
|
start_game_menu.hide()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_play_single_player_button_pressed():
|
||||||
|
var player = Player.instantiate()
|
||||||
|
player.name = str(1)
|
||||||
|
add_child(player)
|
||||||
|
player.set_position(spawn_location)
|
||||||
|
main_menu.hide()
|
||||||
|
notifications.hide()
|
||||||
@@ -2,5 +2,38 @@
|
|||||||
|
|
||||||
[ext_resource type="Script" path="res://Game Manager/game_manager.gd" id="1_bkvdw"]
|
[ext_resource type="Script" path="res://Game Manager/game_manager.gd" id="1_bkvdw"]
|
||||||
|
|
||||||
[node name="game_manager" type="Node2D"]
|
[node name="game_manager" type="Node"]
|
||||||
script = ExtResource("1_bkvdw")
|
script = ExtResource("1_bkvdw")
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="StartGameMenu" type="Control" parent="CanvasLayer"]
|
||||||
|
process_mode = 3
|
||||||
|
visible = false
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="PanelContainer" type="PanelContainer" parent="CanvasLayer/StartGameMenu"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="CanvasLayer/StartGameMenu/PanelContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="StartGameButton" type="Button" parent="CanvasLayer/StartGameMenu/PanelContainer/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Start Game"
|
||||||
|
|
||||||
|
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
|
||||||
|
_spawnable_scenes = PackedStringArray("res://Characters/test_player/test_player.tscn", "res://PhysicsObjects/HandStatue/HandStatue.tscn")
|
||||||
|
spawn_path = NodePath("..")
|
||||||
|
|
||||||
|
[connection signal="pressed" from="CanvasLayer/StartGameMenu/PanelContainer/MarginContainer/StartGameButton" to="." method="_on_start_game_button_pressed"]
|
||||||
@@ -9,11 +9,8 @@
|
|||||||
[node name="TileMap" parent="." instance=ExtResource("1_1k16l")]
|
[node name="TileMap" parent="." instance=ExtResource("1_1k16l")]
|
||||||
layer_0/tile_data = PackedInt32Array(0, 0, 0, 65537, 0, 0, 131074, 0, 0, 131075, 0, 0, 196611, 0, 0, 196612, 0, 0, 262148, 0, 0, 262149, 0, 0, 327686, 0, 0, 327687, 0, 0, 327688, 0, 0, 393224, 0, 0, 458760, 0, 0, 1, 0, 0, 131073, 0, 0, 196609, 0, 0, 262145, 0, 0, 327681, 0, 0, 393217, 0, 0, 458753, 0, 0, 2, 0, 0, 65538, 0, 0, 196610, 0, 0, 262146, 0, 0, 327682, 0, 0, 393218, 0, 0, 458754, 0, 0, 3, 0, 0, 65539, 0, 0, 262147, 0, 0, 327683, 0, 0, 393219, 0, 0, 458755, 0, 0, 4, 0, 0, 65540, 0, 0, 131076, 0, 0, 327684, 0, 0, 393220, 0, 0, 458756, 0, 0, 5, 0, 0, 65541, 0, 0, 131077, 0, 0, 196613, 0, 0, 327685, 0, 0, 393221, 0, 0, 458757, 0, 0, 6, 0, 0, 65542, 0, 0, 131078, 0, 0, 196614, 0, 0, 262150, 0, 0, 393222, 0, 0, 458758, 0, 0, 7, 0, 0, 65543, 0, 0, 131079, 0, 0, 196615, 0, 0, 262151, 0, 0, 393223, 0, 0, 458759, 0, 0, 8, 0, 0, 65544, 0, 0, 131080, 0, 0, 196616, 0, 0, 262152, 0, 0, 65536, 0, 0, 131072, 0, 0, 196608, 0, 0, 262144, 0, 0, 327680, 0, 0, 393216, 0, 0, 458752, 0, 0, -65536, 0, 6, -65535, 0, 6, -65534, 0, 6, -65533, 0, 6, -65532, 0, 6, -65531, 0, 6, -65530, 0, 6, -65529, 0, 6, -65528, 0, 6, -131072, 0, 5, -131071, 0, 5, -131070, 0, 5, -131069, 0, 5, -131068, 0, 5, -131067, 0, 5, -131066, 0, 5, -131065, 0, 5, -131064, 0, 5, -196608, 0, 2, -196607, 0, 2, -196606, 0, 2, -196605, 0, 2, -196604, 0, 2, -196603, 0, 2, -196602, 0, 2, -196601, 0, 2, -196600, 0, 2, -196599, 65536, 3, -131063, 0, 1, -65527, 0, 1, 9, 0, 1, 65545, 0, 1, 131081, 0, 1, 196617, 0, 1, 262153, 0, 1, 327689, 0, 1, 393225, 0, 1, 458761, 0, 1, 524291, 196608, 0, 524292, 196608, 0, 589827, 196608, 0, 655363, 196608, 0, 720899, 196608, 0, 786435, 196608, 0, 851971, 196608, 0, 917507, 196608, 0, 983043, 196608, 0, 1048579, 196608, 0, 589828, 196608, 0, 655364, 196608, 0, 720900, 196608, 0, 786436, 196608, 0, 851972, 196608, 0, 917508, 196608, 0, 983044, 196608, 0, 1048580, 196608, 0, 524296, 65536, 2, 524295, 65536, 2, 524294, 65536, 2, 524293, 196608, 1, 524297, 65536, 4, 589829, 0, 1, 655365, 0, 1, 720901, 0, 1, 786437, 0, 1, 851973, 0, 1, 917509, 196608, 2, 983045, 0, 5, 1048581, 0, 6, -131073, 0, 3, -65537, 65536, 1, -1, 65536, 1, 65535, 65536, 1, 131071, 65536, 1, 196607, 65536, 1, 262143, 65536, 1, 327679, 65536, 1, 393215, 65536, 1, 458751, 65536, 1, 524287, 65536, 1, 524288, 65536, 2, 524289, 65536, 2, 524290, 262144, 1, 589826, 65536, 1, 655362, 65536, 1, 720898, 65536, 1, 786434, 65536, 1, 851970, 65536, 1, 917506, 262144, 2, 983042, 0, 5, 1048578, 0, 6, 589823, 0, 4, 1179643, 0, 0, 1245179, 0, 0, 1310715, 0, 0, 1376251, 0, 0, 1441787, 0, 0, 1507323, 0, 0, 1572859, 0, 0, 1638395, 0, 0, 1703931, 0, 0, 1769467, 0, 0, 1835003, 0, 0, 1900539, 0, 0, 1966075, 0, 0, 2031611, 0, 0, 2097147, 0, 0, 2162683, 0, 0, 1179644, 0, 0, 1245180, 0, 0, 1310716, 0, 0, 1376252, 0, 0, 1441788, 0, 0, 1507324, 0, 0, 1572860, 0, 0, 1638396, 0, 0, 1703932, 0, 0, 1769468, 0, 0, 1835004, 0, 0, 1900540, 0, 0, 1966076, 0, 0, 2031612, 0, 0, 2097148, 0, 0, 2162684, 0, 0, 1179645, 0, 0, 1245181, 0, 0, 1310717, 0, 0, 1376253, 0, 0, 1441789, 0, 0, 1507325, 0, 0, 1572861, 0, 0, 1638397, 0, 0, 1703933, 0, 0, 1769469, 0, 0, 1835005, 0, 0, 1900541, 0, 0, 1966077, 0, 0, 2031613, 0, 0, 2097149, 0, 0, 2162685, 0, 0, 1179646, 0, 0, 1245182, 0, 0, 1310718, 0, 0, 1376254, 327680, 0, 1441790, 327680, 0, 1507326, 327680, 0, 1572862, 0, 0, 1638398, 0, 0, 1703934, 0, 0, 1769470, 0, 0, 1835006, 0, 0, 1900542, 0, 0, 1966078, 0, 0, 2031614, 0, 0, 2097150, 0, 0, 2162686, 0, 0, 1179647, 0, 0, 1245183, 0, 0, 1310719, 0, 0, 1376255, 327680, 0, 1441791, 327680, 0, 1507327, 327680, 0, 1572863, 0, 0, 1638399, 0, 0, 1703935, 0, 0, 1769471, 0, 0, 1835007, 0, 0, 1900543, 0, 0, 1966079, 0, 0, 2031615, 0, 0, 2097151, 0, 0, 2162687, 0, 0, 1114112, 0, 0, 1179648, 0, 0, 1245184, 0, 0, 1310720, 327680, 0, 1376256, 327680, 0, 1441792, 327680, 0, 1507328, 0, 0, 1572864, 0, 0, 1638400, 0, 0, 1703936, 0, 0, 1769472, 0, 0, 1835008, 0, 0, 1900544, 0, 0, 1966080, 0, 0, 2031616, 0, 0, 2097152, 0, 0, 1114113, 0, 0, 1179649, 0, 0, 1245185, 0, 0, 1310721, 327680, 0, 1376257, 327680, 0, 1441793, 327680, 0, 1507329, 0, 0, 1572865, 0, 0, 1638401, 0, 0, 1703937, 0, 0, 1769473, 0, 0, 1835009, 0, 0, 1900545, 0, 0, 1966081, 0, 0, 2031617, 0, 0, 2097153, 0, 0, 1114114, 0, 0, 1179650, 0, 0, 1245186, 0, 0, 1310722, 0, 0, 1376258, 0, 0, 1441794, 0, 0, 1507330, 0, 0, 1572866, 0, 0, 1638402, 0, 0, 1703938, 0, 0, 1769474, 0, 0, 1835010, 0, 0, 1900546, 0, 0, 1966082, 0, 0, 2031618, 0, 0, 2097154, 0, 0, 1114115, 0, 0, 1179651, 0, 0, 1245187, 0, 0, 1310723, 0, 0, 1376259, 0, 0, 1441795, 0, 0, 1507331, 0, 0, 1572867, 0, 0, 1638403, 0, 0, 1703939, 0, 0, 1769475, 0, 0, 1835011, 0, 0, 1900547, 0, 0, 1966083, 0, 0, 2031619, 0, 0, 2097155, 0, 0, 1114116, 0, 0, 1179652, 0, 0, 1245188, 0, 0, 1310724, 0, 0, 1376260, 0, 0, 1441796, 0, 0, 1507332, 0, 0, 1572868, 0, 0, 1638404, 0, 0, 1703940, 0, 0, 1769476, 0, 0, 1835012, 0, 0, 1900548, 0, 0, 1966084, 0, 0, 2031620, 0, 0, 2097156, 0, 0, 1114117, 0, 0, 1179653, 0, 0, 1245189, 0, 0, 131Line truncated
|
layer_0/tile_data = PackedInt32Array(0, 0, 0, 65537, 0, 0, 131074, 0, 0, 131075, 0, 0, 196611, 0, 0, 196612, 0, 0, 262148, 0, 0, 262149, 0, 0, 327686, 0, 0, 327687, 0, 0, 327688, 0, 0, 393224, 0, 0, 458760, 0, 0, 1, 0, 0, 131073, 0, 0, 196609, 0, 0, 262145, 0, 0, 327681, 0, 0, 393217, 0, 0, 458753, 0, 0, 2, 0, 0, 65538, 0, 0, 196610, 0, 0, 262146, 0, 0, 327682, 0, 0, 393218, 0, 0, 458754, 0, 0, 3, 0, 0, 65539, 0, 0, 262147, 0, 0, 327683, 0, 0, 393219, 0, 0, 458755, 0, 0, 4, 0, 0, 65540, 0, 0, 131076, 0, 0, 327684, 0, 0, 393220, 0, 0, 458756, 0, 0, 5, 0, 0, 65541, 0, 0, 131077, 0, 0, 196613, 0, 0, 327685, 0, 0, 393221, 0, 0, 458757, 0, 0, 6, 0, 0, 65542, 0, 0, 131078, 0, 0, 196614, 0, 0, 262150, 0, 0, 393222, 0, 0, 458758, 0, 0, 7, 0, 0, 65543, 0, 0, 131079, 0, 0, 196615, 0, 0, 262151, 0, 0, 393223, 0, 0, 458759, 0, 0, 8, 0, 0, 65544, 0, 0, 131080, 0, 0, 196616, 0, 0, 262152, 0, 0, 65536, 0, 0, 131072, 0, 0, 196608, 0, 0, 262144, 0, 0, 327680, 0, 0, 393216, 0, 0, 458752, 0, 0, -65536, 0, 6, -65535, 0, 6, -65534, 0, 6, -65533, 0, 6, -65532, 0, 6, -65531, 0, 6, -65530, 0, 6, -65529, 0, 6, -65528, 0, 6, -131072, 0, 5, -131071, 0, 5, -131070, 0, 5, -131069, 0, 5, -131068, 0, 5, -131067, 0, 5, -131066, 0, 5, -131065, 0, 5, -131064, 0, 5, -196608, 0, 2, -196607, 0, 2, -196606, 0, 2, -196605, 0, 2, -196604, 0, 2, -196603, 0, 2, -196602, 0, 2, -196601, 0, 2, -196600, 0, 2, -196599, 65536, 3, -131063, 0, 1, -65527, 0, 1, 9, 0, 1, 65545, 0, 1, 131081, 0, 1, 196617, 0, 1, 262153, 0, 1, 327689, 0, 1, 393225, 0, 1, 458761, 0, 1, 524291, 196608, 0, 524292, 196608, 0, 589827, 196608, 0, 655363, 196608, 0, 720899, 196608, 0, 786435, 196608, 0, 851971, 196608, 0, 917507, 196608, 0, 983043, 196608, 0, 1048579, 196608, 0, 589828, 196608, 0, 655364, 196608, 0, 720900, 196608, 0, 786436, 196608, 0, 851972, 196608, 0, 917508, 196608, 0, 983044, 196608, 0, 1048580, 196608, 0, 524296, 65536, 2, 524295, 65536, 2, 524294, 65536, 2, 524293, 196608, 1, 524297, 65536, 4, 589829, 0, 1, 655365, 0, 1, 720901, 0, 1, 786437, 0, 1, 851973, 0, 1, 917509, 196608, 2, 983045, 0, 5, 1048581, 0, 6, -131073, 0, 3, -65537, 65536, 1, -1, 65536, 1, 65535, 65536, 1, 131071, 65536, 1, 196607, 65536, 1, 262143, 65536, 1, 327679, 65536, 1, 393215, 65536, 1, 458751, 65536, 1, 524287, 65536, 1, 524288, 65536, 2, 524289, 65536, 2, 524290, 262144, 1, 589826, 65536, 1, 655362, 65536, 1, 720898, 65536, 1, 786434, 65536, 1, 851970, 65536, 1, 917506, 262144, 2, 983042, 0, 5, 1048578, 0, 6, 589823, 0, 4, 1179643, 0, 0, 1245179, 0, 0, 1310715, 0, 0, 1376251, 0, 0, 1441787, 0, 0, 1507323, 0, 0, 1572859, 0, 0, 1638395, 0, 0, 1703931, 0, 0, 1769467, 0, 0, 1835003, 0, 0, 1900539, 0, 0, 1966075, 0, 0, 2031611, 0, 0, 2097147, 0, 0, 2162683, 0, 0, 1179644, 0, 0, 1245180, 0, 0, 1310716, 0, 0, 1376252, 0, 0, 1441788, 0, 0, 1507324, 0, 0, 1572860, 0, 0, 1638396, 0, 0, 1703932, 0, 0, 1769468, 0, 0, 1835004, 0, 0, 1900540, 0, 0, 1966076, 0, 0, 2031612, 0, 0, 2097148, 0, 0, 2162684, 0, 0, 1179645, 0, 0, 1245181, 0, 0, 1310717, 0, 0, 1376253, 0, 0, 1441789, 0, 0, 1507325, 0, 0, 1572861, 0, 0, 1638397, 0, 0, 1703933, 0, 0, 1769469, 0, 0, 1835005, 0, 0, 1900541, 0, 0, 1966077, 0, 0, 2031613, 0, 0, 2097149, 0, 0, 2162685, 0, 0, 1179646, 0, 0, 1245182, 0, 0, 1310718, 0, 0, 1376254, 327680, 0, 1441790, 327680, 0, 1507326, 327680, 0, 1572862, 0, 0, 1638398, 0, 0, 1703934, 0, 0, 1769470, 0, 0, 1835006, 0, 0, 1900542, 0, 0, 1966078, 0, 0, 2031614, 0, 0, 2097150, 0, 0, 2162686, 0, 0, 1179647, 0, 0, 1245183, 0, 0, 1310719, 0, 0, 1376255, 327680, 0, 1441791, 327680, 0, 1507327, 327680, 0, 1572863, 0, 0, 1638399, 0, 0, 1703935, 0, 0, 1769471, 0, 0, 1835007, 0, 0, 1900543, 0, 0, 1966079, 0, 0, 2031615, 0, 0, 2097151, 0, 0, 2162687, 0, 0, 1114112, 0, 0, 1179648, 0, 0, 1245184, 0, 0, 1310720, 327680, 0, 1376256, 327680, 0, 1441792, 327680, 0, 1507328, 0, 0, 1572864, 0, 0, 1638400, 0, 0, 1703936, 0, 0, 1769472, 0, 0, 1835008, 0, 0, 1900544, 0, 0, 1966080, 0, 0, 2031616, 0, 0, 2097152, 0, 0, 1114113, 0, 0, 1179649, 0, 0, 1245185, 0, 0, 1310721, 327680, 0, 1376257, 327680, 0, 1441793, 327680, 0, 1507329, 0, 0, 1572865, 0, 0, 1638401, 0, 0, 1703937, 0, 0, 1769473, 0, 0, 1835009, 0, 0, 1900545, 0, 0, 1966081, 0, 0, 2031617, 0, 0, 2097153, 0, 0, 1114114, 0, 0, 1179650, 0, 0, 1245186, 0, 0, 1310722, 0, 0, 1376258, 0, 0, 1441794, 0, 0, 1507330, 0, 0, 1572866, 0, 0, 1638402, 0, 0, 1703938, 0, 0, 1769474, 0, 0, 1835010, 0, 0, 1900546, 0, 0, 1966082, 0, 0, 2031618, 0, 0, 2097154, 0, 0, 1114115, 0, 0, 1179651, 0, 0, 1245187, 0, 0, 1310723, 0, 0, 1376259, 0, 0, 1441795, 0, 0, 1507331, 0, 0, 1572867, 0, 0, 1638403, 0, 0, 1703939, 0, 0, 1769475, 0, 0, 1835011, 0, 0, 1900547, 0, 0, 1966083, 0, 0, 2031619, 0, 0, 2097155, 0, 0, 1114116, 0, 0, 1179652, 0, 0, 1245188, 0, 0, 1310724, 0, 0, 1376260, 0, 0, 1441796, 0, 0, 1507332, 0, 0, 1572868, 0, 0, 1638404, 0, 0, 1703940, 0, 0, 1769476, 0, 0, 1835012, 0, 0, 1900548, 0, 0, 1966084, 0, 0, 2031620, 0, 0, 2097156, 0, 0, 1114117, 0, 0, 1179653, 0, 0, 1245189, 0, 0, 131Line truncated
|
||||||
|
|
||||||
[node name="HandStatue" parent="." instance=ExtResource("2_jwx5u")]
|
|
||||||
position = Vector2(106, 343)
|
|
||||||
|
|
||||||
[node name="PlayerSpawnLocation" parent="." instance=ExtResource("3_h26d8")]
|
[node name="PlayerSpawnLocation" parent="." instance=ExtResource("3_h26d8")]
|
||||||
position = Vector2(215, 344)
|
position = Vector2(-10, 461)
|
||||||
|
|
||||||
[node name="HandStatue2" parent="." instance=ExtResource("2_jwx5u")]
|
[node name="HandStatue" parent="." instance=ExtResource("2_jwx5u")]
|
||||||
position = Vector2(159, 346)
|
position = Vector2(89, 378)
|
||||||
@@ -1,27 +1,34 @@
|
|||||||
extends RigidBody2D
|
extends RigidBody2D
|
||||||
|
|
||||||
@onready var rigid_body = get_node(".")
|
@export var initial_impulse:Vector2 = Vector2(0,0)
|
||||||
|
@export var damage_speed:int = 50
|
||||||
|
@export var max_speed:int = 150
|
||||||
|
@export var push_strength:int = 20
|
||||||
|
|
||||||
@onready var last_velocity:Vector2 = Vector2(0,0)
|
@onready var last_velocity:Vector2 = Vector2(0,0)
|
||||||
@onready var current_player:CharacterBody2D = null
|
@onready var current_player:CharacterBody2D = null
|
||||||
|
|
||||||
@export var initial_impulse:Vector2 = Vector2(0,0)
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
print("Statue Ready!")
|
|
||||||
if initial_impulse != Vector2.ZERO:
|
|
||||||
rigid_body.apply_central_impulse(initial_impulse)
|
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
last_velocity = get_linear_velocity()
|
||||||
|
if last_velocity.length() > damage_speed:
|
||||||
|
set_modulate(Color("8e2325"))
|
||||||
|
else:
|
||||||
|
set_modulate(Color("ffffff"))
|
||||||
|
if last_velocity.length() > max_speed:
|
||||||
|
set_linear_velocity(get_linear_velocity().normalized() * max_speed)
|
||||||
|
last_velocity.length()
|
||||||
|
|
||||||
|
|
||||||
func _on_body_entered(body):
|
func _on_body_entered(body):
|
||||||
print("body entered! ")
|
|
||||||
if body.is_in_group("player"):
|
if body.is_in_group("player"):
|
||||||
print("Player collided!")
|
if last_velocity.length() > damage_speed:
|
||||||
current_player = body
|
current_player = body
|
||||||
current_player.player_hit.is_player_hit = true
|
current_player.player_hit.is_player_hit = true
|
||||||
current_player.player_hit.hit_velocity = last_velocity
|
current_player.player_hit.hit_velocity = last_velocity.normalized() * push_strength
|
||||||
|
|
||||||
if last_velocity.x > 50 or last_velocity.y < -50 or last_velocity.x < -50 or last_velocity.y > 50:
|
|
||||||
current_player.health_changed_func(-1)
|
current_player.health_changed_func(-1)
|
||||||
rigid_body.set_sleeping(true)
|
# set_freeze_enabled(true)
|
||||||
|
# await get_tree().create_timer(0.5).timeout
|
||||||
|
set_sleeping(true)
|
||||||
|
# set_freeze_enabled(false)
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://ca4ghctk5gllj"]
|
[gd_scene load_steps=6 format=3 uid="uid://ca4ghctk5gllj"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cgtkkroa583fo" path="res://TileSets/Stuff.png" id="1_462gd"]
|
[ext_resource type="Texture2D" uid="uid://cgtkkroa583fo" path="res://TileSets/Stuff.png" id="1_462gd"]
|
||||||
[ext_resource type="Script" path="res://PhysicsObjects/HandStatue/HandStatue.gd" id="1_ap0lt"]
|
[ext_resource type="Script" path="res://PhysicsObjects/HandStatue/HandStatue.gd" id="1_ap0lt"]
|
||||||
@@ -12,12 +12,21 @@ bounce = 0.76
|
|||||||
radius = 9.0
|
radius = 9.0
|
||||||
height = 34.0
|
height = 34.0
|
||||||
|
|
||||||
|
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_14ixl"]
|
||||||
|
properties/0/path = NodePath(".:position")
|
||||||
|
properties/0/spawn = false
|
||||||
|
properties/0/sync = false
|
||||||
|
properties/1/path = NodePath(".:linear_velocity")
|
||||||
|
properties/1/spawn = false
|
||||||
|
properties/1/sync = true
|
||||||
|
|
||||||
[node name="HandStatue" type="RigidBody2D" groups=["moveable"]]
|
[node name="HandStatue" type="RigidBody2D" groups=["moveable"]]
|
||||||
physics_material_override = SubResource("PhysicsMaterial_ho34d")
|
physics_material_override = SubResource("PhysicsMaterial_ho34d")
|
||||||
|
max_contacts_reported = 3
|
||||||
contact_monitor = true
|
contact_monitor = true
|
||||||
|
can_sleep = false
|
||||||
lock_rotation = true
|
lock_rotation = true
|
||||||
script = ExtResource("1_ap0lt")
|
script = ExtResource("1_ap0lt")
|
||||||
initial_impulse = Vector2(200, 0)
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(0, -4)
|
position = Vector2(0, -4)
|
||||||
@@ -29,4 +38,7 @@ texture = ExtResource("1_462gd")
|
|||||||
region_enabled = true
|
region_enabled = true
|
||||||
region_rect = Rect2(48, 36, 16, 28)
|
region_rect = Rect2(48, 36, 16, 28)
|
||||||
|
|
||||||
|
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||||
|
replication_config = SubResource("SceneReplicationConfig_14ixl")
|
||||||
|
|
||||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
extends MultiplayerSynchronizer
|
||||||
|
|
||||||
|
|
||||||
|
#func _enter_tree():
|
||||||
|
# set_multiplayer_authority(1)
|
||||||
|
#
|
||||||
|
## Called when the node enters the scene tree for the first time.
|
||||||
|
#func _ready():
|
||||||
|
# if not is_multiplayer_authority(): return
|
||||||
|
#
|
||||||
|
#
|
||||||
|
## Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# if not is_multiplayer_authority(): return
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#func _physics_process(delta):
|
||||||
|
# if not is_multiplayer_authority(): return
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 841 B |
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dwqq3s0su5myy"
|
||||||
|
path="res://.godot/imported/bomb_anim.png-1c92dadf237f59ac8452a68f910adeb7.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://PickupableObjects/Bomb/bomb_anim.png"
|
||||||
|
dest_files=["res://.godot/imported/bomb_anim.png-1c92dadf237f59ac8452a68f910adeb7.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 221 B |
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dmqfqmr16bdqk"
|
||||||
|
path="res://.godot/imported/bomb_icon.png-7e2eda12156138a4003e63cacc06b10a.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://PickupableObjects/Bomb/bomb_icon.png"
|
||||||
|
dest_files=["res://.godot/imported/bomb_icon.png-7e2eda12156138a4003e63cacc06b10a.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 3.6 KiB |
@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/Stuff.png-96e376a9d98d7c764e870eeeeddfebc9.ct
|
|||||||
[params]
|
[params]
|
||||||
|
|
||||||
compress/mode=0
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/bptc_ldr=0
|
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
mipmaps/generate=false
|
mipmaps/generate=false
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
[gd_scene format=3 uid="uid://bk6yvc16x1n2k"]
|
||||||
|
|
||||||
|
[node name="MainMenu" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
+11
-1
@@ -17,10 +17,16 @@ config/icon="res://icon.svg"
|
|||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
|
window/stretch/mode="viewport"
|
||||||
window/stretch/scale=2.0
|
window/stretch/scale=2.0
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
|
reset_pos={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194439,"key_label":0,"unicode":49,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
print_pos={
|
print_pos={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||||
@@ -61,6 +67,11 @@ show_inventory={
|
|||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194306,"key_label":0,"unicode":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194306,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
test_force={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194441,"key_label":0,"unicode":51,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
@@ -68,5 +79,4 @@ show_inventory={
|
|||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
renderer/rendering_method="gl_compatibility"
|
|
||||||
textures/canvas_textures/default_texture_filter=0
|
textures/canvas_textures/default_texture_filter=0
|
||||||
Reference in new issue
Block a user