added multiplayer connection. TODO: Sync Inventory values. Disable moving of other color tiles
This commit is contained in:
parent
e8cd148bc7
commit
3de181134d
13 changed files with 360 additions and 67 deletions
46
main_menu.gd
46
main_menu.gd
|
|
@ -1,44 +1,26 @@
|
|||
extends Control
|
||||
|
||||
const WEBSOCKET_ENDPOINT: String = "wss://dev.bytesandpieces.xyz:9088"
|
||||
|
||||
const insect_resources = [
|
||||
preload("res://Tile/Prefabs/Ant.tres"),
|
||||
preload("res://Tile/Prefabs/Bee.tres"),
|
||||
preload("res://Tile/Prefabs/Beetle.tres"),
|
||||
preload("res://Tile/Prefabs/Grasshopper.tres"),
|
||||
preload("res://Tile/Prefabs/Ladybug.tres"),
|
||||
preload("res://Tile/Prefabs/Mosquito.tres"),
|
||||
preload("res://Tile/Prefabs/Pillbug.tres"),
|
||||
preload("res://Tile/Prefabs/Spider.tres")
|
||||
]
|
||||
|
||||
var insect_data = {
|
||||
|
||||
}
|
||||
|
||||
func prepare_insect_data() -> void:
|
||||
var c: int = 65
|
||||
|
||||
#for i in insect_resources:
|
||||
#for k in 2:
|
||||
#print(String.chr(c))
|
||||
#c = c + 1
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
prepare_insect_data()
|
||||
|
||||
WSClient.lobby_joined.connect(_on_lobby_joined)
|
||||
|
||||
func _on_lobby_joined(lobby: String) -> void:
|
||||
pass
|
||||
|
||||
GameData.lobby_code = lobby
|
||||
|
||||
get_tree().change_scene_to_file("res://Multiplayer/Multiplayer.tscn")
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func _on_host_button_pressed():
|
||||
GameData.is_player_black = false
|
||||
WSClient.start(GameData.WEBSOCKET_ENDPOINT, "")
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
WSClient.start(WEBSOCKET_ENDPOINT, "", false)
|
||||
pass # Replace with function body.
|
||||
|
||||
func _on_join_button_pressed():
|
||||
get_tree().change_scene_to_file("res://UI/join_menu.tscn")
|
||||
|
||||
|
||||
func _on_exit_button_pressed():
|
||||
get_tree().quit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue