Intialize and cleanup repo
1
client/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
builds
|
@ -0,0 +1,3 @@
|
||||
source_md5="a4e0d3e007a723598d9eed9e588ed896"
|
||||
dest_md5="88bbb9adf5d8cd95e82a6575379f8e40"
|
||||
|
@ -0,0 +1,3 @@
|
||||
source_md5="4c0163ed6b4faca64ec2e22663865646"
|
||||
dest_md5="871974c0415189bb7ee4d25f66c7e6cc"
|
||||
|
@ -0,0 +1,3 @@
|
||||
source_md5="f91f5b2c10fb1c2bbb2b9efd001ec156"
|
||||
dest_md5="a8bf84e7a011aab313ecd6a6228e1c03"
|
||||
|
BIN
client/.import/boar.png-967bf326ec5327a3976d5df0c5a68796.stex
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="7e41bf3051b18e392a4bb6c0cc45cd7c"
|
||||
dest_md5="92eb858faaa1840609e0a1d10f0a2ab1"
|
||||
|
BIN
client/.import/client.png-db3748b41e665cc4fe95f391916f4633.stex
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="f58728ec69e9bc4674d83fecd231606d"
|
||||
dest_md5="6be2b17787f2b16451812c382e0468ed"
|
||||
|
BIN
client/.import/crystal.png-04011f2545568870c52ee0bd59c3fb9c.stex
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
|
||||
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"
|
||||
|
BIN
client/.import/favicon.png-ad684d17faa662133229b6300264136f.stex
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
|
||||
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"
|
||||
|
BIN
client/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="50ac0416cbd1377e0e34e05c7b94300d"
|
||||
dest_md5="d6ea88e54993b8c2ac6268ed67ffc779"
|
||||
|
@ -0,0 +1,3 @@
|
||||
source_md5="bb2665ac1d6c81fe488f5c1d8f1efc4b"
|
||||
dest_md5="0519566be172bacfd61403d302597e4e"
|
||||
|
BIN
client/.import/logo.png-9164f87f81119ac7320e78ed71593bc1.stex
Normal file
@ -0,0 +1,3 @@
|
||||
source_md5="4c0163ed6b4faca64ec2e22663865646"
|
||||
dest_md5="871974c0415189bb7ee4d25f66c7e6cc"
|
||||
|
@ -0,0 +1,3 @@
|
||||
source_md5="b96dd394315a26f6321ee1fed85511a1"
|
||||
dest_md5="0ea1da6f385d124f752a105fbe1e2838"
|
||||
|
@ -0,0 +1,3 @@
|
||||
source_md5="234d4f7df7c457bb857680ca94728ab3"
|
||||
dest_md5="a04bb0e22087eb7e6f923c0f3dc75e4a"
|
||||
|
@ -0,0 +1,3 @@
|
||||
source_md5="a4e0d3e007a723598d9eed9e588ed896"
|
||||
dest_md5="88bbb9adf5d8cd95e82a6575379f8e40"
|
||||
|
9
client/ReadMe.md
Normal file
@ -0,0 +1,9 @@
|
||||
# LD46 Client
|
||||
|
||||
## Build Requirements
|
||||
|
||||
Godot 3.2.1-stable
|
||||
|
||||
### Godot Modules
|
||||
|
||||
- [GDNet3](https://github.com/perdugames/gdnet3)
|
BIN
client/assets/audio/music/secret.ogg
Normal file
15
client/assets/audio/music/secret.ogg.import
Normal file
@ -0,0 +1,15 @@
|
||||
[remap]
|
||||
|
||||
importer="ogg_vorbis"
|
||||
type="AudioStreamOGGVorbis"
|
||||
path="res://.import/secret.ogg-61e6c38fdabb5c087e6529738a5bce74.oggstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/audio/music/secret.ogg"
|
||||
dest_files=[ "res://.import/secret.ogg-61e6c38fdabb5c087e6529738a5bce74.oggstr" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
BIN
client/assets/audio/music/wizards.ogg
Normal file
15
client/assets/audio/music/wizards.ogg.import
Normal file
@ -0,0 +1,15 @@
|
||||
[remap]
|
||||
|
||||
importer="ogg_vorbis"
|
||||
type="AudioStreamOGGVorbis"
|
||||
path="res://.import/wizards.ogg-236c384d94b8eed7664fa0b0b9be0425.oggstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/audio/music/wizards.ogg"
|
||||
dest_files=[ "res://.import/wizards.ogg-236c384d94b8eed7664fa0b0b9be0425.oggstr" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
BIN
client/assets/images/character/iron_player.ase
Normal file
BIN
client/assets/images/character/iron_player.png
Normal file
After Width: | Height: | Size: 281 B |
34
client/assets/images/character/iron_player.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/iron_player.png-39ad5fd525cfa67c8ed824c0580890d8.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/images/character/iron_player.png"
|
||||
dest_files=[ "res://.import/iron_player.png-39ad5fd525cfa67c8ed824c0580890d8.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
|
BIN
client/assets/images/enemies/boar.ase
Normal file
BIN
client/assets/images/enemies/boar.png
Normal file
After Width: | Height: | Size: 213 B |
34
client/assets/images/enemies/boar.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/boar.png-967bf326ec5327a3976d5df0c5a68796.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/images/enemies/boar.png"
|
||||
dest_files=[ "res://.import/boar.png-967bf326ec5327a3976d5df0c5a68796.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
|
BIN
client/assets/images/entities/crystal.ase
Normal file
BIN
client/assets/images/entities/crystal.png
Normal file
After Width: | Height: | Size: 306 B |
34
client/assets/images/entities/crystal.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/crystal.png-04011f2545568870c52ee0bd59c3fb9c.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/images/entities/crystal.png"
|
||||
dest_files=[ "res://.import/crystal.png-04011f2545568870c52ee0bd59c3fb9c.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
|
BIN
client/assets/images/logo.ase
Normal file
BIN
client/assets/images/logo.png
Normal file
After Width: | Height: | Size: 620 B |
34
client/assets/images/logo.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/logo.png-9164f87f81119ac7320e78ed71593bc1.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/images/logo.png"
|
||||
dest_files=[ "res://.import/logo.png-9164f87f81119ac7320e78ed71593bc1.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
|
BIN
client/assets/images/tiles/floor/stone_floor.ase
Normal file
BIN
client/assets/images/tiles/floor/stone_floor.png
Normal file
After Width: | Height: | Size: 155 B |
34
client/assets/images/tiles/floor/stone_floor.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/stone_floor.png-eac509d75ac0cd89365424259b561ea3.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/images/tiles/floor/stone_floor.png"
|
||||
dest_files=[ "res://.import/stone_floor.png-eac509d75ac0cd89365424259b561ea3.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
|
BIN
client/assets/images/tiles/wall/stone_wall.ase
Normal file
BIN
client/assets/images/tiles/wall/stone_wall.png
Normal file
After Width: | Height: | Size: 118 B |
34
client/assets/images/tiles/wall/stone_wall.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/stone_wall.png-5d77d917e4c5071ba4b40c12c46181d7.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/images/tiles/wall/stone_wall.png"
|
||||
dest_files=[ "res://.import/stone_wall.png-5d77d917e4c5071ba4b40c12c46181d7.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
|
7
client/default_env.tres
Normal file
@ -0,0 +1,7 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
48
client/export_presets.cfg
Normal file
@ -0,0 +1,48 @@
|
||||
[preset.0]
|
||||
|
||||
name="Linux/X11"
|
||||
platform="Linux/X11"
|
||||
runnable=true
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="builds/client.x86_64"
|
||||
patch_list=PoolStringArray( )
|
||||
script_export_mode=1
|
||||
script_encryption_key=""
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
texture_format/bptc=false
|
||||
texture_format/s3tc=true
|
||||
texture_format/etc=false
|
||||
texture_format/etc2=false
|
||||
texture_format/no_bptc_fallbacks=true
|
||||
binary_format/64_bits=true
|
||||
binary_format/embed_pck=false
|
||||
custom_template/release="/var/home/vetra/Projects/godot-enet/bin/godot.x11.opt.64"
|
||||
custom_template/debug="/var/home/vetra/Projects/godot-enet/bin/godot.x11.opt.debug.64"
|
||||
|
||||
[preset.1]
|
||||
|
||||
name="HTML5"
|
||||
platform="HTML5"
|
||||
runnable=true
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="builds/client.html"
|
||||
patch_list=PoolStringArray( )
|
||||
script_export_mode=1
|
||||
script_encryption_key=""
|
||||
|
||||
[preset.1.options]
|
||||
|
||||
vram_texture_compression/for_desktop=true
|
||||
vram_texture_compression/for_mobile=false
|
||||
html/custom_html_shell=""
|
||||
html/head_include=""
|
||||
custom_template/release=""
|
||||
custom_template/debug=""
|
BIN
client/icon.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
34
client/icon.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.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
|
6
client/nodes/MusicManager.tscn
Normal file
@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/singletons/MusicManager.gd" type="Script" id=1]
|
||||
|
||||
[node name="MusicManager" type="AudioStreamPlayer"]
|
||||
script = ExtResource( 1 )
|
6
client/nodes/NetworkManager.tscn
Normal file
@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/network/NetworkManager.gd" type="Script" id=1]
|
||||
|
||||
[node name="NetworkManager" type="Node"]
|
||||
script = ExtResource( 1 )
|
39
client/nodes/Player.tscn
Normal file
@ -0,0 +1,39 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://assets/images/character/iron_player.png" type="Texture" id=1]
|
||||
[ext_resource path="res://scripts/entities/Player.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
|
||||
[sub_resource type="DynamicFontData" id=2]
|
||||
font_path = "res://assets/fonts/hf-free-complete/compass-pro-v1.1/CompassPro.ttf"
|
||||
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
font_data = SubResource( 2 )
|
||||
|
||||
[node name="Player" type="KinematicBody2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
current = true
|
||||
zoom = Vector2( 0.5, 0.5 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
margin_left = -32.0
|
||||
margin_top = -30.0
|
||||
margin_right = 32.0
|
||||
margin_bottom = -10.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
custom_colors/font_color = Color( 1, 1, 1, 0.607843 )
|
||||
text = "Username"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
16
client/nodes/entities/crystal.tscn
Normal file
@ -0,0 +1,16 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://assets/images/entities/crystal.png" type="Texture" id=1]
|
||||
[ext_resource path="res://scripts/entities/LifeCrystal.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 16.0
|
||||
|
||||
[node name="LifeCrystal" type="Area2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
35
client/nodes/entities/player.tscn
Normal file
@ -0,0 +1,35 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://assets/images/character/iron_player.png" type="Texture" id=1]
|
||||
[ext_resource path="res://scripts/entities/Player.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
|
||||
[sub_resource type="DynamicFontData" id=2]
|
||||
font_path = "res://assets/fonts/hf-free-complete/compass-pro-v1.1/CompassPro.ttf"
|
||||
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
font_data = SubResource( 2 )
|
||||
|
||||
[node name="Player" type="KinematicBody2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
margin_left = -32.0
|
||||
margin_top = -30.0
|
||||
margin_right = 32.0
|
||||
margin_bottom = -10.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
custom_colors/font_color = Color( 1, 1, 1, 0.607843 )
|
||||
text = "Username"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
29
client/project.godot
Normal file
@ -0,0 +1,29 @@
|
||||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_class_icons={
|
||||
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="client"
|
||||
run/main_scene="res://scenes/login.scn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[autoload]
|
||||
|
||||
MusicManager="*res://nodes/MusicManager.tscn"
|
||||
NetworkManager="*res://nodes/NetworkManager.tscn"
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_environment="res://default_env.tres"
|
BIN
client/scenes/game.scn
Normal file
37
client/scenes/icon.tscn
Normal file
19
client/scenes/loader.tscn
Normal file
@ -0,0 +1,19 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "extends Node
|
||||
|
||||
var music = preload(\"res://nodes/MusicManager.tscn\")
|
||||
var network = preload(\"res://nodes/NetworkManager.tscn\")
|
||||
|
||||
func _ready():
|
||||
var root : Node = get_node(\"/root\")
|
||||
var m = music.instance()
|
||||
root.add_child(m)
|
||||
var n = network.instance()
|
||||
root.add_child(n)
|
||||
get_tree().change_scene(\"res://scenes/login.scn\")
|
||||
"
|
||||
|
||||
[node name="Node" type="Node"]
|
||||
script = SubResource( 1 )
|
BIN
client/scenes/login.scn
Normal file
6
client/scripts/entities/LifeCrystal.gd
Normal file
@ -0,0 +1,6 @@
|
||||
extends Area2D
|
||||
|
||||
const ROTATION_SPEED = 1
|
||||
|
||||
func _process(delta):
|
||||
$Sprite.rotation = $Sprite.rotation + delta * ROTATION_SPEED
|
23
client/scripts/entities/Player.gd
Normal file
@ -0,0 +1,23 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
export var user : String = ""
|
||||
|
||||
func _ready():
|
||||
$Label.text = user
|
||||
#$Label.text = $"/root/NetworkManager".username
|
||||
|
||||
func _process(delta):
|
||||
var movePos : Vector2 = Vector2(0,0)
|
||||
|
||||
|
||||
if(Input.is_action_just_pressed("ui_up")):
|
||||
movePos.y = movePos.y + 1
|
||||
if(Input.is_action_just_pressed("ui_down")):
|
||||
movePos.y = movePos.y - 1
|
||||
if(Input.is_action_just_pressed("ui_right")):
|
||||
movePos.x = movePos.x + 1
|
||||
if(Input.is_action_just_pressed("ui_left")):
|
||||
movePos.x = movePos.x - 1
|
||||
|
||||
if movePos != Vector2.ZERO:
|
||||
$"/root/NetworkManager".move_player(movePos.x, movePos.y)
|
113
client/scripts/network/NetworkManager.gd
Normal file
@ -0,0 +1,113 @@
|
||||
extends Node
|
||||
|
||||
const SERVER_HOST : String = "192.168.1.34"
|
||||
const SERVER_PORT : int = 7777
|
||||
|
||||
signal disconnection
|
||||
signal connection_established
|
||||
signal error_occured
|
||||
signal logged_in
|
||||
|
||||
signal world_data_recieved
|
||||
|
||||
var username : String = ""
|
||||
|
||||
var client : GDNetHost = null
|
||||
var peer : GDNetPeer = null
|
||||
var server_address : GDNetAddress = null
|
||||
var connected : bool = false
|
||||
|
||||
var packetQueue = []
|
||||
var error_info = ""
|
||||
var world_data : String = ""
|
||||
|
||||
|
||||
var connection_timer : Timer
|
||||
|
||||
func _init():
|
||||
server_address = GDNetAddress.new()
|
||||
|
||||
server_address.set_host(SERVER_HOST)
|
||||
server_address.set_port(SERVER_PORT)
|
||||
|
||||
client = GDNetHost.new()
|
||||
client.set_max_peers(1)
|
||||
client.set_event_wait(250)
|
||||
client.bind()
|
||||
|
||||
func connect_to_server():
|
||||
peer = client.host_connect(server_address)
|
||||
if not connection_timer:
|
||||
connection_timer = Timer.new()
|
||||
add_child(connection_timer)
|
||||
connection_timer.connect("timeout", self, "timeout_check")
|
||||
connection_timer.start(1)
|
||||
|
||||
func timeout_check():
|
||||
if username == "":
|
||||
display_error("Connection failed!")
|
||||
connection_timer.stop()
|
||||
|
||||
func request_world_map():
|
||||
var request_packet : PoolByteArray = "2|".to_ascii()
|
||||
packetQueue.append(request_packet)
|
||||
|
||||
func connect_as_user(username : String):
|
||||
connect_to_server()
|
||||
var username_packet : PoolByteArray = ("1|" + username).to_ascii()
|
||||
|
||||
packetQueue.append(username_packet)
|
||||
|
||||
func display_error(error = "Unknown error occured!"):
|
||||
error_info = error
|
||||
print("Error: " + error)
|
||||
emit_signal("error_occured")
|
||||
|
||||
func disconnect_from_server():
|
||||
peer.disconnect_later()
|
||||
|
||||
func process_events():
|
||||
if(client.is_event_available()):
|
||||
var event : GDNetEvent = client.get_event()
|
||||
|
||||
var event_type = event.get_event_type()
|
||||
|
||||
if(event_type == GDNetEvent.RECEIVE):
|
||||
var ascii_data : String = str(event.get_packet().get_string_from_ascii())
|
||||
if len(ascii_data) > 0:
|
||||
if ascii_data[0] == '1':
|
||||
if ascii_data.substr(2,2) == "OK":
|
||||
username = ascii_data.substr(4)
|
||||
print("Logged in as: " + username)
|
||||
emit_signal("logged_in")
|
||||
else:
|
||||
display_error("Username not accepted! Reason: " + ascii_data.substr(2))
|
||||
elif ascii_data[0] == '2':
|
||||
world_data = ascii_data.substr(2)
|
||||
emit_signal("world_data_recieved")
|
||||
elif(event_type == GDNetEvent.CONNECT):
|
||||
print("Connected to server with hostname: " + server_address.get_host() + ":" + str(server_address.get_port()))
|
||||
connected = true
|
||||
emit_signal("connection_established")
|
||||
elif(event_type == GDNetEvent.DISCONNECT):
|
||||
print("Disconnected from server")
|
||||
connected = false
|
||||
emit_signal("disconnection")
|
||||
|
||||
func move_player(x,y):
|
||||
var pckt : PoolByteArray = ("3|" + str(x) + "," + str(y)).to_ascii()
|
||||
|
||||
packetQueue.append(pckt)
|
||||
|
||||
func _process(delta):
|
||||
process_events()
|
||||
|
||||
if len(packetQueue) > 0 and connected:
|
||||
peer.send_packet(packetQueue[0], 0, GDNetMessage.RELIABLE)
|
||||
packetQueue.remove(0)
|
||||
|
||||
|
||||
if(Input.is_action_just_pressed("ui_cancel")):
|
||||
print("PACKET")
|
||||
peer.send_packet("TEST".to_ascii(), 0, GDNetMessage.RELIABLE)
|
||||
|
15
client/scripts/singletons/MusicManager.gd
Normal file
@ -0,0 +1,15 @@
|
||||
extends AudioStreamPlayer
|
||||
|
||||
var main_player : AudioStreamPlayer
|
||||
var looping : bool = false
|
||||
|
||||
func _ready():
|
||||
main_player = self
|
||||
|
||||
func play_music(song, loop=true):
|
||||
var audio_file = "res://assets/audio/music/" + song + ".ogg"
|
||||
if File.new().file_exists(audio_file):
|
||||
var track = load(audio_file)
|
||||
looping = loop
|
||||
main_player.stream = track
|
||||
#main_player.play()
|
21
client/scripts/systems/LoginManager.gd
Normal file
@ -0,0 +1,21 @@
|
||||
extends Node
|
||||
|
||||
|
||||
func _ready():
|
||||
$"/root/MusicManager".play_music("wizards")
|
||||
$Button.connect("button_down", self, "_on_button_press")
|
||||
$"/root/NetworkManager".connect("error_occured", self, "_on_error")
|
||||
$"/root/NetworkManager".connect("logged_in", self, "_on_login")
|
||||
|
||||
func _on_error():
|
||||
$ErrorDialog/ErrorLabel.text = $"/root/NetworkManager".error_info
|
||||
$ErrorDialog.popup_centered()
|
||||
|
||||
func _on_button_press():
|
||||
if($"/root/NetworkManager".connected):
|
||||
$"/root/NetworkManager".disconnect_from_server()
|
||||
else:
|
||||
$"/root/NetworkManager".connect_as_user($LineEdit.text)
|
||||
|
||||
func _on_login():
|
||||
get_tree().change_scene("res://scenes/game.scn")
|
49
client/scripts/systems/WorldManager.gd
Normal file
@ -0,0 +1,49 @@
|
||||
extends Node
|
||||
|
||||
|
||||
func _ready():
|
||||
$Tiles.clear()
|
||||
$"/root/NetworkManager".connect("world_data_recieved", self, "_on_world_update")
|
||||
$"/root/NetworkManager".request_world_map()
|
||||
|
||||
func _on_world_update():
|
||||
var data = $"/root/NetworkManager".world_data.split('\n')
|
||||
for tileUpdate in data:
|
||||
if len(tileUpdate) > 3:
|
||||
if ',' in tileUpdate:
|
||||
var tile_data = tileUpdate.split(',')
|
||||
if ':' in tile_data[2]:
|
||||
var pos : Vector2 = $Tiles.map_to_world(Vector2(int(tile_data[0]), int(tile_data[1])))
|
||||
if 'player:' in tile_data[2]:
|
||||
print(tile_data)
|
||||
var player_name = tile_data[2].substr(len('player:'))
|
||||
print(player_name)
|
||||
if $"/root/NetworkManager".username == player_name:
|
||||
$Player.position = pos
|
||||
else:
|
||||
update_entity(player_name, pos, "player")
|
||||
else:
|
||||
var entity_data = tile_data[2].split(':')
|
||||
update_entity(entity_data[1], pos, entity_data[0])
|
||||
|
||||
else:
|
||||
$Tiles.set_cell(int(tile_data[0]), int(tile_data[1]), int(tile_data[2]))
|
||||
if $Loading != null:
|
||||
$Loading.queue_free()
|
||||
|
||||
func display_error(error):
|
||||
print("Error " + error)
|
||||
|
||||
func update_entity(entity_id : String, pos : Vector2, type : String):
|
||||
var entity : Node2D = get_node_or_null( str(type + "-" + entity_id))
|
||||
if not entity:
|
||||
var entity_location = "res://nodes/entities/" + type + ".tscn"
|
||||
if File.new().file_exists(entity_location):
|
||||
var gobj = load(entity_location)
|
||||
entity = gobj.instance()
|
||||
add_child(entity, true)
|
||||
entity.set_name(str(type + "-" + entity_id))
|
||||
else:
|
||||
display_error("Trying to load entity of type: " + type + ", but failed.")
|
||||
if entity:
|
||||
entity.position = pos
|
28
client/tilesets/floor_tileset.tres
Normal file
@ -0,0 +1,28 @@
|
||||
[gd_resource type="TileSet" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://assets/images/tiles/floor/stone_floor.png" type="Texture" id=1]
|
||||
|
||||
[resource]
|
||||
0/name = "stone_floor.png 0"
|
||||
0/texture = ExtResource( 1 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
0/modulate = Color( 1, 1, 1, 1 )
|
||||
0/region = Rect2( 0, 0, 16, 16 )
|
||||
0/tile_mode = 1
|
||||
0/autotile/bitmask_mode = 0
|
||||
0/autotile/bitmask_flags = [ ]
|
||||
0/autotile/icon_coordinate = Vector2( 0, 0 )
|
||||
0/autotile/tile_size = Vector2( 16, 16 )
|
||||
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
|
62
client/tilesets/wall_tileset.tres
Normal file
@ -0,0 +1,62 @@
|
||||
[gd_resource type="TileSet" load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://assets/images/tiles/wall/stone_wall.png" type="Texture" id=1]
|
||||
[ext_resource path="res://assets/images/tiles/floor/stone_floor.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=1]
|
||||
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
|
||||
|
||||
[resource]
|
||||
0/name = "stone_wall.png 0"
|
||||
0/texture = ExtResource( 1 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
0/modulate = Color( 1, 1, 1, 1 )
|
||||
0/region = Rect2( 0, 0, 16, 16 )
|
||||
0/tile_mode = 1
|
||||
0/autotile/bitmask_mode = 0
|
||||
0/autotile/bitmask_flags = [ ]
|
||||
0/autotile/icon_coordinate = Vector2( 0, 0 )
|
||||
0/autotile/tile_size = Vector2( 16, 16 )
|
||||
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 = SubResource( 1 )
|
||||
0/shape_one_way = false
|
||||
0/shape_one_way_margin = 1.0
|
||||
0/shapes = [ {
|
||||
"autotile_coord": Vector2( 0, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 1 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
} ]
|
||||
0/z_index = 0
|
||||
1/name = "stone_floor.png 1"
|
||||
1/texture = ExtResource( 2 )
|
||||
1/tex_offset = Vector2( 0, 0 )
|
||||
1/modulate = Color( 1, 1, 1, 1 )
|
||||
1/region = Rect2( 0, 0, 16, 16 )
|
||||
1/tile_mode = 1
|
||||
1/autotile/bitmask_mode = 0
|
||||
1/autotile/bitmask_flags = [ ]
|
||||
1/autotile/icon_coordinate = Vector2( 0, 0 )
|
||||
1/autotile/tile_size = Vector2( 16, 16 )
|
||||
1/autotile/spacing = 0
|
||||
1/autotile/occluder_map = [ ]
|
||||
1/autotile/navpoly_map = [ ]
|
||||
1/autotile/priority_map = [ ]
|
||||
1/autotile/z_index_map = [ ]
|
||||
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
|