Compare commits
1 Commits
21e16b16a5
...
8fbd8c86f3
Author | SHA1 | Date |
---|---|---|
EvanGee | 8fbd8c86f3 |
|
@ -71,6 +71,7 @@ func server_add_player(id: int):
|
||||||
%PlayerSpawner.spawn(id)
|
%PlayerSpawner.spawn(id)
|
||||||
|
|
||||||
static func find_level(node: Node) -> Level:
|
static func find_level(node: Node) -> Level:
|
||||||
|
var parent := node
|
||||||
while not (node is Level):
|
while not (node is Level):
|
||||||
node = node.get_parent()
|
node = node.get_parent()
|
||||||
return node
|
return node
|
||||||
|
|
|
@ -27,7 +27,6 @@ func is_on_ground() -> bool:
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
print(is_on_ground())
|
|
||||||
if not is_on_floor():
|
if not is_on_floor():
|
||||||
velocity.y -= gravity * delta
|
velocity.y -= gravity * delta
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ func get_first_bumper() -> Player:
|
||||||
func _on_tag_detection_area_entered(area):
|
func _on_tag_detection_area_entered(area):
|
||||||
if not (area.get_parent() is Player):
|
if not (area.get_parent() is Player):
|
||||||
return
|
return
|
||||||
var _other_player: Player = area.get_parent()
|
var other_player: Player = area.get_parent()
|
||||||
if is_bumping.is_connected(_bump_check):
|
if is_bumping.is_connected(_bump_check):
|
||||||
return
|
return
|
||||||
is_bumping.connect(_bump_check)
|
is_bumping.connect(_bump_check)
|
||||||
|
@ -67,7 +66,7 @@ func _on_tag_detection_area_entered(area):
|
||||||
func _on_tag_detection_area_exited(area):
|
func _on_tag_detection_area_exited(area):
|
||||||
if not (area.get_parent() is Player):
|
if not (area.get_parent() is Player):
|
||||||
return
|
return
|
||||||
var _other_player: Player = area.get_parent()
|
var other_player: Player = area.get_parent()
|
||||||
if not is_bumping.is_connected(_bump_check):
|
if not is_bumping.is_connected(_bump_check):
|
||||||
return
|
return
|
||||||
is_bumping.disconnect(_bump_check)
|
is_bumping.disconnect(_bump_check)
|
||||||
|
@ -75,7 +74,6 @@ func _on_tag_detection_area_exited(area):
|
||||||
|
|
||||||
func _on_tag_detection_body_entered(body):
|
func _on_tag_detection_body_entered(body):
|
||||||
if body.is_in_group("ground"):
|
if body.is_in_group("ground"):
|
||||||
print("fuck")
|
|
||||||
if not is_grounded.is_connected(body.grounded):
|
if not is_grounded.is_connected(body.grounded):
|
||||||
is_grounded.connect(body.grounded)
|
is_grounded.connect(body.grounded)
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,8 @@ extends Control
|
||||||
signal join_lobby(addr: String, port: int)
|
signal join_lobby(addr: String, port: int)
|
||||||
|
|
||||||
@rpc("reliable", "authority", "call_local")
|
@rpc("reliable", "authority", "call_local")
|
||||||
func add(port: int):
|
func add(addr: String, port: int):
|
||||||
var lobby_button := preload("res://server/lobby_list_entry.tscn").instantiate()
|
var lobby_button := preload("res://server/lobby_list_entry.tscn").instantiate()
|
||||||
var addr := "127.0.0.1"
|
|
||||||
var peer := (multiplayer.multiplayer_peer as ENetMultiplayerPeer).get_peer(1)
|
|
||||||
if peer != null:
|
|
||||||
addr = peer.get_remote_address()
|
|
||||||
lobby_button.address = addr
|
lobby_button.address = addr
|
||||||
lobby_button.port = port
|
lobby_button.port = port
|
||||||
$Lobbies.add_child(lobby_button, true)
|
$Lobbies.add_child(lobby_button, true)
|
||||||
|
|
|
@ -19,14 +19,14 @@ func _ready():
|
||||||
func peer_connected(id: int):
|
func peer_connected(id: int):
|
||||||
print("Client " + str(id) + " connected to master server")
|
print("Client " + str(id) + " connected to master server")
|
||||||
for lobby in %LobbyList.lobbies():
|
for lobby in %LobbyList.lobbies():
|
||||||
%LobbyList.add.rpc_id(id, lobby.port)
|
%LobbyList.add.rpc_id(id, lobby.address, lobby.port)
|
||||||
|
|
||||||
func create_lobby():
|
func create_lobby():
|
||||||
var lobby := preload("res://server/lobby.tscn").instantiate()
|
var lobby := preload("res://server/lobby.tscn").instantiate()
|
||||||
lobby.port = next_port_num
|
lobby.port = next_port_num
|
||||||
next_port_num += 1
|
next_port_num += 1
|
||||||
%Lobbies.add_child(lobby)
|
%Lobbies.add_child(lobby)
|
||||||
%LobbyList.add.rpc(lobby.port)
|
%LobbyList.add.rpc(external_address, lobby.port)
|
||||||
|
|
||||||
func _on_create_lobby_pressed():
|
func _on_create_lobby_pressed():
|
||||||
create_lobby()
|
create_lobby()
|
||||||
|
|
Loading…
Reference in New Issue