Generate basic world & recieve data on client
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
source_md5="ea3da320528c7d54640506628b12b80c"
|
||||
dest_md5="f8c65d4e4cd80d79c48ff0c014cf0377"
|
||||
|
BIN
client/.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.stex
Normal file
BIN
client/.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.stex
Normal file
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
source_md5="b38dac28f777cd24a94ae764cf60780a"
|
||||
dest_md5="8568362e706ffbdddbdcb895eaad16c8"
|
||||
|
BIN
client/.import/grass.png-d6f949232ad65f7c5ac8611d6943aaf7.stex
Normal file
BIN
client/.import/grass.png-d6f949232ad65f7c5ac8611d6943aaf7.stex
Normal file
Binary file not shown.
BIN
client/art/tiles/dirt.png
Normal file
BIN
client/art/tiles/dirt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 108 B |
34
client/art/tiles/dirt.png.import
Normal file
34
client/art/tiles/dirt.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/tiles/dirt.png"
|
||||
dest_files=[ "res://.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
client/art/tiles/grass.png
Normal file
BIN
client/art/tiles/grass.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
34
client/art/tiles/grass.png.import
Normal file
34
client/art/tiles/grass.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/grass.png-d6f949232ad65f7c5ac8611d6943aaf7.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/tiles/grass.png"
|
||||
dest_files=[ "res://.import/grass.png-d6f949232ad65f7c5ac8611d6943aaf7.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
43
client/nodes/tileset.tres
Normal file
43
client/nodes/tileset.tres
Normal file
@ -0,0 +1,43 @@
|
||||
[gd_resource type="TileSet" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://art/tiles/grass.png" type="Texture" id=1]
|
||||
[ext_resource path="res://art/tiles/dirt.png" type="Texture" id=2]
|
||||
|
||||
[resource]
|
||||
0/name = "grass.png 0"
|
||||
0/texture = ExtResource( 1 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
0/modulate = Color( 1, 1, 1, 1 )
|
||||
0/region = Rect2( 0, 0, 352, 160 )
|
||||
0/tile_mode = 1
|
||||
0/autotile/bitmask_mode = 1
|
||||
0/autotile/bitmask_flags = [ Vector2( 0, 0 ), 432, Vector2( 0, 1 ), 438, Vector2( 0, 2 ), 54, Vector2( 0, 3 ), 48, Vector2( 1, 0 ), 504, Vector2( 1, 1 ), 511, Vector2( 1, 2 ), 63, Vector2( 1, 3 ), 56, Vector2( 2, 0 ), 216, Vector2( 2, 1 ), 219, Vector2( 2, 2 ), 27, Vector2( 2, 3 ), 24, Vector2( 3, 0 ), 144, Vector2( 3, 1 ), 146, Vector2( 3, 2 ), 18, Vector2( 3, 3 ), 16, Vector2( 4, 0 ), 176, Vector2( 4, 1 ), 182, Vector2( 4, 2 ), 434, Vector2( 4, 3 ), 50, Vector2( 4, 4 ), 178, Vector2( 5, 0 ), 248, Vector2( 5, 1 ), 255, Vector2( 5, 2 ), 507, Vector2( 5, 3 ), 59, Vector2( 5, 4 ), 251, Vector2( 6, 0 ), 440, Vector2( 6, 1 ), 447, Vector2( 6, 2 ), 510, Vector2( 6, 3 ), 62, Vector2( 6, 4 ), 446, Vector2( 7, 0 ), 152, Vector2( 7, 1 ), 155, Vector2( 7, 2 ), 218, Vector2( 7, 3 ), 26, Vector2( 7, 4 ), 154, Vector2( 8, 0 ), 184, Vector2( 8, 1 ), 191, Vector2( 8, 2 ), 506, Vector2( 8, 3 ), 58, Vector2( 8, 4 ), 186, Vector2( 9, 0 ), 443, Vector2( 9, 1 ), 254, Vector2( 9, 2 ), 442, Vector2( 9, 3 ), 190, Vector2( 10, 2 ), 250, Vector2( 10, 3 ), 187 ]
|
||||
0/autotile/icon_coordinate = Vector2( 0, 0 )
|
||||
0/autotile/tile_size = Vector2( 32, 32 )
|
||||
0/autotile/spacing = 0
|
||||
0/autotile/occluder_map = [ ]
|
||||
0/autotile/navpoly_map = [ ]
|
||||
0/autotile/priority_map = [ ]
|
||||
0/autotile/z_index_map = [ ]
|
||||
0/occluder_offset = Vector2( 0, 0 )
|
||||
0/navigation_offset = Vector2( 0, 0 )
|
||||
0/shape_offset = Vector2( 0, 0 )
|
||||
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
0/shape_one_way = false
|
||||
0/shape_one_way_margin = 0.0
|
||||
0/shapes = [ ]
|
||||
0/z_index = 0
|
||||
1/name = "dirt.png 1"
|
||||
1/texture = ExtResource( 2 )
|
||||
1/tex_offset = Vector2( 0, 0 )
|
||||
1/modulate = Color( 1, 1, 1, 1 )
|
||||
1/region = Rect2( 0, 0, 32, 32 )
|
||||
1/tile_mode = 0
|
||||
1/occluder_offset = Vector2( 0, 0 )
|
||||
1/navigation_offset = Vector2( 0, 0 )
|
||||
1/shape_offset = Vector2( 0, 0 )
|
||||
1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
1/shape_one_way = false
|
||||
1/shape_one_way_margin = 0.0
|
||||
1/shapes = [ ]
|
||||
1/z_index = 0
|
11
client/scenes/World.tscn
Normal file
11
client/scenes/World.tscn
Normal file
File diff suppressed because one or more lines are too long
@ -40,7 +40,7 @@ func login(_text=""):
|
||||
display_message(error.message)
|
||||
else:
|
||||
display_message("Connected to server!", Color.green)
|
||||
yield(ServerConnection.join_world_async(), "completed")
|
||||
# Load World
|
||||
|
||||
func display_message(message="", color=Color.red):
|
||||
errorLabel.add_color_override("font_color", color)
|
||||
|
@ -1,5 +1,7 @@
|
||||
extends Node
|
||||
|
||||
signal tile_update(tile_data)
|
||||
|
||||
const KEY := "defaultkey"
|
||||
const SERVER_ENDPOINT := "nakama.cloudsumu.com"
|
||||
|
||||
@ -8,6 +10,10 @@ var _client : NakamaClient = Nakama.create_client(KEY, SERVER_ENDPOINT, 7350, "h
|
||||
var _socket : NakamaSocket
|
||||
var _precenses : Dictionary = {}
|
||||
|
||||
enum OPCODE {
|
||||
tile_update = 1
|
||||
}
|
||||
|
||||
func authenticate_async(email : String, password : String) -> NakamaException:
|
||||
var result : NakamaException = null
|
||||
|
||||
@ -36,6 +42,7 @@ func connect_to_server_async() -> NakamaException:
|
||||
_socket = Nakama.create_socket_from(_client)
|
||||
var result : NakamaAsyncResult = yield(_socket.connect_async(_session), "completed")
|
||||
if not result.is_exception():
|
||||
_socket.connect("received_match_state", self, "_on_socket_received_match_state")
|
||||
_socket.connect("closed", self, "_on_socket_closed")
|
||||
return null
|
||||
return result.exception
|
||||
@ -60,3 +67,9 @@ func join_world_async() -> Dictionary:
|
||||
|
||||
func _on_socket_closed():
|
||||
_socket = null
|
||||
|
||||
func _on_socket_received_match_state(match_state: NakamaRTAPI.MatchData):
|
||||
match match_state.op_code:
|
||||
OPCODE.tile_update:
|
||||
emit_signal("tile_update", JSON.parse(match_state.data).result)
|
||||
|
||||
|
15
client/scripts/singletons/WorldManager.gd
Normal file
15
client/scripts/singletons/WorldManager.gd
Normal file
@ -0,0 +1,15 @@
|
||||
extends Node
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
ServerConnection.connect("tile_update", self, "on_tile_update")
|
||||
yield(ServerConnection.join_world_async(), "completed")
|
||||
|
||||
func on_tile_update(tile_data):
|
||||
print(tile_data)
|
Reference in New Issue
Block a user