Skip to content

Commit

Permalink
Fix #1 and #2
Browse files Browse the repository at this point in the history
  • Loading branch information
elenakrittik committed Jul 13, 2022
1 parent 4bdb836 commit f328ff9
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 17 deletions.
Binary file added assets/dino4x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/dino4x.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

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

[deps]

source_file="res://assets/dino4x.png"
dest_files=[ "res://.import/dino4x.png-a484b5f8c966ac9f70804f22df26731e.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
2 changes: 1 addition & 1 deletion export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ custom_features=""
export_filter="all_resources"
include_filter="*json"
exclude_filter=""
export_path="../Builds/FluxEdge v1.0.6.exe"
export_path="../Builds/FluxEdge v0.1.1.exe"
script_export_mode=1
script_encryption_key=""

Expand Down
7 changes: 6 additions & 1 deletion scenes/Levels/LevelLoader.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func loader():
file.close();

xxx_player_startpoint = Vector2(data['startpoint']['x'] * 32, data['startpoint']['y'] * 32);
poss[1] = xxx_player_startpoint;

if data.get("p2startpoint"):
poss[2] = Vector2(data['p2startpoint']['x'] * 32, data['p2startpoint']['y'] * 32);
Expand Down Expand Up @@ -72,4 +73,8 @@ func get_player_position(player):
#var aa = Vector2(xxx_player_startpoint.x + (32 * player), xxx_player_startpoint.y);
#print(aa)
#return aa;
return poss[player];
#return poss[player];
if GlobalVars.HOST:
return poss[2];
else:
return poss[1];
46 changes: 46 additions & 0 deletions scenes/MultiplayerLobby.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[gd_scene load_steps=8 format=2]

[ext_resource path="res://assets/BackgroundEarth.png" type="Texture" id=1]
[ext_resource path="res://assets/dino4x.png" type="Texture" id=2]

[sub_resource type="AtlasTexture" id=1]
flags = 4
atlas = ExtResource( 2 )
region = Rect2( 1920, 0, 96, 96 )

[sub_resource type="AtlasTexture" id=2]
flags = 4
atlas = ExtResource( 2 )
region = Rect2( 2016, 0, 96, 96 )

[sub_resource type="AtlasTexture" id=3]
flags = 4
atlas = ExtResource( 2 )
region = Rect2( 2112, 0, 96, 96 )

[sub_resource type="AtlasTexture" id=4]
flags = 4
atlas = ExtResource( 2 )
region = Rect2( 2208, 0, 96, 96 )

[sub_resource type="SpriteFrames" id=5]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]

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

[node name="Camera2D" type="Camera2D" parent="."]
current = true

[node name="Sprite" type="Sprite" parent="Camera2D"]
texture = ExtResource( 1 )

[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
scale = Vector2( 2.22917, 2.22917 )
frames = SubResource( 5 )
frame = 2
playing = true
6 changes: 3 additions & 3 deletions scripts/ExplosiveCan.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ func xxx_process_destroy():
get_tree().root.get_child(1).get_child(1).add_child(instance);

for player in ps_high:
player.health -= 50;
player.deal_damage(50);

for player in ps_medium:
player.health -= 25;
player.deal_damage(25);

for player in ps_small:
player.health -= 10;
player.deal_damage(10);

var camera: Camera2D = get_parent().xxx_player.get_node("Camera2D");

Expand Down
18 changes: 9 additions & 9 deletions scripts/MupltiplayerGame.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ func gather_lvl_data():
func _ready():
get_tree().set_pause(true);
if GlobalVars.HOST:
print("HOST")
var peer = NetworkedMultiplayerENet.new();
peer.create_server(GlobalVars.SERVER_PORT, GlobalVars.MAX_PLAYERS);
get_tree().network_peer = peer;
else:
print("NOT HOST")
var peer = NetworkedMultiplayerENet.new();
peer.create_client(GlobalVars.SERVER_IP, GlobalVars.SERVER_PORT);
get_tree().network_peer = peer;
Expand All @@ -25,33 +23,35 @@ func _ready():
get_tree().connect("network_peer_disconnected", self, "_player_disconnected");

func _player_connected(id):
print("CONNECTED")
get_tree().set_pause(false);
# Called on both clients and server when a peer connects. Send my info to it.
rpc_id(id, "register_player");

func _player_disconnected(id):
print("DISCONNECTED")
get_tree().set_pause(true);
get_tree().set_refuse_new_network_connections(false);
player_count -= 1;
remove_child(get_node("RemotePlayer_%s" % id));

remote func register_player():
print("REGPLAYER")
var id = get_tree().get_rpc_sender_id();
var rp = remote_player.instance();

player_count += 1;

rp.position = $Level.get_player_position(player_count);
#rp.position = $Level.get_player_position(player_count);

if id == 1:
rp.position = $Level.poss[1];
else:
rp.position = $Level.poss[2];
rp.name = "RemotePlayer_%s" % id;

add_child(rp);

if player_count == 2:
get_tree().set_refuse_new_network_connections(true);
get_tree().set_pause(false);
#if player_count == GlobalVars.MAX_PLAYERS:
# get_tree().set_refuse_new_network_connections(true);
# get_tree().set_pause(false);

func do_map_sync():
rpc("sync_map", $Level);
Expand Down
6 changes: 3 additions & 3 deletions scripts/ToxicCan.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ func xxx_process_destroy():
get_tree().root.get_child(1).get_child(1).add_child(instance);

for player in ps_high:
player.health -= 50;
player.deal_damage(50);

for player in ps_medium:
player.health -= 25;
player.deal_damage(25);

for player in ps_small:
player.health -= 10;
player.deal_damage(10);

var camera: Camera2D = get_parent().xxx_player.get_node("Camera2D");

Expand Down

0 comments on commit f328ff9

Please sign in to comment.