Skip to content

Commit

Permalink
Merge pull request #9 from TheSecondReal0/main
Browse files Browse the repository at this point in the history
Syncing with main
  • Loading branch information
TheSecondReal0 authored Oct 19, 2020
2 parents cd8bb04 + d8372fa commit e4e600e
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 17 deletions.
12 changes: 6 additions & 6 deletions src/assets/autoload/network.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ func ready() -> void:
# give the server access to puppet functions and variables
set_network_master(1)

func client_server(port: int, player_name: String) -> void:
func client_server(port: int, playerName: String) -> void:
print("Starting server on port ", port, " with host player name ", player_name)
connection = Connection.CLIENT_SERVER
self.player_name = player_name
print("Starting server on port ", port)
player_name = playerName
server = WebSocketServer.new()
server.listen(port, PoolStringArray(), true) #3rd input must be true to use Godot's high level networking API
get_tree().set_network_peer(server)
connect_signals()
get_tree().change_scene("res://assets/main/main.tscn")

func client(hostName: String, port: int, player_name: String) -> void:
func client(hostName: String, port: int, playerName: String) -> void:
print("Connecting to server ", hostName, " on port ", port, " with host player name ", player_name)
connection = Connection.CLIENT
self.player_name = player_name
print("Connecting to ", hostName, " on port ", port)
player_name = playerName
client = WebSocketClient.new()
#use "ws://" at the beginning of address for websocket connections
var url: String = "ws://" + hostName + ":" + str(port)
Expand Down
1 change: 1 addition & 0 deletions src/assets/main/main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ __meta__ = {
script = ExtResource( 2 )

[node name="test" parent="maps" instance=ExtResource( 6 )]
light_mask = 2
[connection signal="clientstartgame" from="." to="players/Player/Camera2D/CanvasLayer/Button" method="_on_Node2D_clientstartgame"]
[connection signal="pressed" from="players/Player/Camera2D/CanvasLayer/Button" to="players/Player/Camera2D/CanvasLayer/chatbox" method="popup"]
[connection signal="gamestartpressed" from="players/Player/Camera2D/CanvasLayer/startgamebutton" to="." method="_on_startgamebutton_gamestartpressed"]
Expand Down
14 changes: 11 additions & 3 deletions src/assets/maps/test/test.tscn
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=4 format=2]

[ext_resource path="res://assets/common/textures/icons/icon.png" type="Texture" id=1]

[sub_resource type="RectangleShape2D" id=1]
[sub_resource type="OccluderPolygon2D" id=1]
polygon = PoolVector2Array( 338.558, 76.2244, 431.056, -205.476, 401.625, -428.313, 271.286, -579.675, 52.6532, -663.764, 115.72, -705.809, -6.20956, -764.672, 77.8801, -794.103, 23.2217, -873.989, 14.8128, -937.056, -44.05, -970.692, -94.5037, -882.398, -44.05, -844.557, -6.20956, -844.557, -111.322, -756.263, -2.00516, -722.627, -90.2992, -676.378, -363.591, -512.403, -451.884, -276.952, -414.044, 8.95264, -346.772, 114.065, -519.156, 420.992, -535.974, 589.171, -414.044, 639.625, -313.137, 601.785, -334.159, 854.054, -229.047, 929.734, -77.6858, 711.101, 6.40381, 639.625, 69.471, 854.054, 124.129, 950.757, 250.264, 938.143, 321.74, 807.804, 338.558, 593.376, 380.603, 631.216, 544.577, 593.376, 527.76, 450.423 )

[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 420.733, 180.052 )

[node name="test" type="Node2D"]

[node name="StaticBody2D" type="StaticBody2D" parent="."]
z_index = -1

[node name="LightOccluder2D" type="LightOccluder2D" parent="StaticBody2D"]
scale = Vector2( 0.05, 0.05 )
occluder = SubResource( 1 )

[node name="Sprite2" type="Sprite" parent="StaticBody2D"]
light_mask = 2
scale = Vector2( 0.05, 0.05 )
texture = ExtResource( 1 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
position = Vector2( 0, 40 )
scale = Vector2( 0.05, 0.05 )
shape = SubResource( 1 )
shape = SubResource( 2 )
4 changes: 3 additions & 1 deletion src/assets/player/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ func _ready():
if "--server" in OS.get_cmdline_args():
main_player = false
if main_player:
$VisibleArea.enabled = true
$Dark.enabled = true
ourname = Network.get_player_name()
print(ourname)
print("ourname: ", ourname)
$Label.text = ourname
# Only called when main_player is true
func get_input():
Expand Down
30 changes: 23 additions & 7 deletions src/assets/player/player.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=2]
[gd_scene load_steps=19 format=2]

[ext_resource path="res://assets/player/player.gd" type="Script" id=1]
[ext_resource path="res://assets/player/textures/characters/black/walk-h/black-r-walk-4-4.png" type="Texture" id=2]
Expand All @@ -14,6 +14,8 @@
[ext_resource path="res://assets/player/textures/characters/black/walk-v/black-up2-1-4.png" type="Texture" id=12]
[ext_resource path="res://assets/player/textures/characters/black/walk-v/black-up2-4-4.png" type="Texture" id=13]
[ext_resource path="res://assets/player/textures/characters/black/walk-v/black-up2-3-4.png" type="Texture" id=14]
[ext_resource path="res://assets/player/textures/light.png" type="Texture" id=15]
[ext_resource path="res://assets/player/textures/dark.png" type="Texture" id=16]

[sub_resource type="CapsuleShape2D" id=1]
radius = 15.0
Expand All @@ -25,11 +27,6 @@ animations = [ {
"name": "idle",
"speed": 5.0
}, {
"frames": [ ExtResource( 12 ), ExtResource( 11 ), ExtResource( 14 ), ExtResource( 13 ) ],
"loop": true,
"name": "walk-up",
"speed": 8.0
}, {
"frames": [ ExtResource( 9 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 10 ) ],
"loop": true,
"name": "walk-down",
Expand All @@ -39,6 +36,11 @@ animations = [ {
"loop": true,
"name": "walk-h",
"speed": 5.0
}, {
"frames": [ ExtResource( 12 ), ExtResource( 11 ), ExtResource( 14 ), ExtResource( 13 ) ],
"loop": true,
"name": "walk-up",
"speed": 8.0
} ]

[node name="Player" type="KinematicBody2D"]
Expand All @@ -53,7 +55,7 @@ shape = SubResource( 1 )
[node name="Sprite" type="AnimatedSprite" parent="."]
frames = SubResource( 2 )
animation = "walk-h"
frame = 2
frame = 3
playing = true

[node name="Label" type="Label" parent="."]
Expand All @@ -66,3 +68,17 @@ align = 1
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Dark" type="Light2D" parent="."]
scale = Vector2( 2065.42, -2756.44 )
enabled = false
texture = ExtResource( 16 )
color = Color( 1, 1, 1, 0 )
mode = 3
shadow_item_cull_mask = -2147483647

[node name="VisibleArea" type="Light2D" parent="."]
enabled = false
texture = ExtResource( 15 )
mode = 2
shadow_item_cull_mask = -2147483647
3 changes: 3 additions & 0 deletions src/assets/player/textures/dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions src/assets/player/textures/dark.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/dark.png-0d8a4d94fb4aa551e475ab5ca4b5cd6f.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/player/textures/dark.png"
dest_files=[ "res://.import/dark.png-0d8a4d94fb4aa551e475ab5ca4b5cd6f.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
3 changes: 3 additions & 0 deletions src/assets/player/textures/light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions src/assets/player/textures/light.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/light.png-e3f6775575ebd4572b84d7be136234d9.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/player/textures/light.png"
dest_files=[ "res://.import/light.png-e3f6775575ebd4572b84d7be136234d9.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

0 comments on commit e4e600e

Please sign in to comment.