mirror of
https://github.com/kristoferssolo/FuncIt.git
synced 2025-10-21 19:30:35 +00:00
[Medium] Alena f'up.
This commit is contained in:
parent
5785200818
commit
be143754be
@ -2,22 +2,45 @@ extends Control
|
||||
|
||||
var player = load("res://source/entities/player/player_node.tscn")
|
||||
|
||||
func _ready():
|
||||
Global.alive_players.append(self)
|
||||
Network.current_player_username = "You"
|
||||
Network.create_server()
|
||||
instance_player(get_tree().get_network_unique_id())
|
||||
rpc("switch_to_game")
|
||||
onready var username_text_edit = $popup_screen/panel/username_text_edit
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
username_text_edit.call_deferred("grab_focus")
|
||||
|
||||
|
||||
func _process(_delta) -> void:
|
||||
if Input.is_action_just_pressed("esc"):
|
||||
# warning-ignore:return_value_discarded
|
||||
get_tree().change_scene("res://source/scenes/GUI/main_menu.tscn")
|
||||
if Input.is_action_just_pressed("enter") and username_text_edit.is_visible_in_tree():
|
||||
_on_confirm_pressed()
|
||||
|
||||
func _on_confirm_pressed():
|
||||
if username_text_edit.text != "":
|
||||
Global.alive_players.append(self)
|
||||
Network.current_player_username = username_text_edit.text
|
||||
Network.create_server()
|
||||
instance_player(get_tree().get_network_unique_id())
|
||||
rpc("switch_to_game")
|
||||
|
||||
|
||||
func instance_player(id) -> void:
|
||||
var player_instance = Global.instance_node_at_location(player, PersistentNodes, Vector2())
|
||||
player_instance.name = str(id)
|
||||
player_instance.set_network_master(id)
|
||||
player_instance.username = "You"
|
||||
player_instance.username = username_text_edit.text
|
||||
|
||||
|
||||
sync func switch_to_game() -> void:
|
||||
for child in PersistentNodes.get_children():
|
||||
if child.is_in_group("Player"):
|
||||
child.update_shoot_mode(true)
|
||||
get_tree().change_scene("res://source/scenes/GAME/game_tutorial.tscn")
|
||||
|
||||
# warning-ignore:return_value_discarded
|
||||
get_tree().change_scene("res://source/levels/trinity_site/trinity_site_level_playground.tscn")
|
||||
|
||||
|
||||
func _on_return_pressed():
|
||||
# warning-ignore:return_value_discarded
|
||||
get_tree().change_scene("res://source/scenes/GUI/main_menu.tscn")
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
extends Control
|
||||
|
||||
var player = load("res://source/entities/player/player_node.tscn")
|
||||
|
||||
func _ready():
|
||||
Global.alive_players.append(self)
|
||||
Network.current_player_username = "You"
|
||||
Network.create_server()
|
||||
instance_player(get_tree().get_network_unique_id())
|
||||
rpc("switch_to_game")
|
||||
|
||||
|
||||
func instance_player(id) -> void:
|
||||
var player_instance = Global.instance_node_at_location(player, PersistentNodes, Vector2())
|
||||
player_instance.name = str(id)
|
||||
player_instance.set_network_master(id)
|
||||
player_instance.username = "You"
|
||||
|
||||
sync func switch_to_game() -> void:
|
||||
for child in PersistentNodes.get_children():
|
||||
if child.is_in_group("Player"):
|
||||
child.update_shoot_mode(true)
|
||||
get_tree().change_scene("res://source/scenes/GAME/game_tutorial.tscn")
|
||||
@ -5,18 +5,8 @@ var current_player_location_instance_number = null
|
||||
|
||||
var globalActivePhase = null
|
||||
|
||||
var timer = 0
|
||||
var finishedMovementZone = false
|
||||
var finishedJumpZone = false
|
||||
var finishedAiming = false
|
||||
var botCount = 0
|
||||
|
||||
var ts_bot = preload("res://source/entities/ts_bot/ts_bot.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
$controls/timer/phase.text = "Tutorial"
|
||||
# warning-ignore:return_value_discarded
|
||||
$controls.modulate[3] = 0
|
||||
get_tree().connect("network_peer_disconnected", self, "_player_disconnected")
|
||||
if get_tree().is_network_server():
|
||||
setup_player_positions()
|
||||
@ -36,41 +26,3 @@ func _player_disconnected(id) -> void:
|
||||
PersistentNodes.get_node(str(id)).username_text_instance.queue_free()
|
||||
PersistentNodes.get_node(str(id)).health_bar_instance.queue_free()
|
||||
PersistentNodes.get_node(str(id)).queue_free()
|
||||
|
||||
func _process(delta):
|
||||
timer += delta
|
||||
begin_tutorial()
|
||||
|
||||
func begin_tutorial():
|
||||
# Reset initial setup
|
||||
if timer < 2:
|
||||
finishedJumpZone = false
|
||||
finishedMovementZone = false
|
||||
# Request to start tutorial.
|
||||
# Show a movement target to test ( A / D / SHIFT )
|
||||
if not finishedMovementZone: $simpleTargetZone_basic.show()
|
||||
else: $simpleTargetZone_basic.hide()
|
||||
if not finishedJumpZone and finishedMovementZone: $simpleTargetZone_jump.show()
|
||||
else: $simpleTargetZone_jump.hide()
|
||||
if finishedJumpZone and finishedMovementZone and $controls.modulate[3] < 1:
|
||||
$controls.modulate[3] += 0.1
|
||||
$weaponInstruction.show()
|
||||
if botCount < 6:
|
||||
var bot = ts_bot.instance()
|
||||
add_child(bot)
|
||||
bot.global_position = $bot_spawn_locations.get_child(botCount).global_position
|
||||
botCount += 1
|
||||
# After target destroyed request permission to move on to menu.
|
||||
# Remove player before moving on. !!!!!!!!!!!
|
||||
|
||||
if finishedMovementZone and finishedJumpZone and finishedAiming and timer > 2:
|
||||
Network._server_leave()
|
||||
get_tree().change_scene("res://source/scenes/GUI/main_menu.tscn")
|
||||
|
||||
|
||||
func _on_simpleTargetZone_jump_zone_entered():
|
||||
finishedJumpZone = true
|
||||
|
||||
|
||||
func _on_simpleTargetZone_basic_zone_entered():
|
||||
finishedMovementZone = true
|
||||
|
||||
@ -0,0 +1,76 @@
|
||||
extends Node2D
|
||||
|
||||
var current_spawn_location_instance_number = 1
|
||||
var current_player_location_instance_number = null
|
||||
|
||||
var globalActivePhase = null
|
||||
|
||||
var timer = 0
|
||||
var finishedMovementZone = false
|
||||
var finishedJumpZone = false
|
||||
var finishedAiming = false
|
||||
var botCount = 0
|
||||
|
||||
var ts_bot = preload("res://source/entities/ts_bot/ts_bot.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
$controls/timer/phase.text = "Tutorial"
|
||||
# warning-ignore:return_value_discarded
|
||||
$controls.modulate[3] = 0
|
||||
get_tree().connect("network_peer_disconnected", self, "_player_disconnected")
|
||||
if get_tree().is_network_server():
|
||||
setup_player_positions()
|
||||
|
||||
func setup_player_positions() -> void:
|
||||
for player in PersistentNodes.get_children():
|
||||
if player.is_in_group("Player"):
|
||||
for spawn_location in $spawn_locations.get_children():
|
||||
if int(spawn_location.name) == current_spawn_location_instance_number and current_player_location_instance_number != player:
|
||||
player.rpc("update_position", spawn_location.global_position)
|
||||
current_spawn_location_instance_number += 1
|
||||
current_player_location_instance_number = player
|
||||
|
||||
|
||||
func _player_disconnected(id) -> void:
|
||||
if PersistentNodes.has_node(str(id)):
|
||||
PersistentNodes.get_node(str(id)).username_text_instance.queue_free()
|
||||
PersistentNodes.get_node(str(id)).health_bar_instance.queue_free()
|
||||
PersistentNodes.get_node(str(id)).queue_free()
|
||||
|
||||
func _process(delta):
|
||||
timer += delta
|
||||
begin_tutorial()
|
||||
|
||||
func begin_tutorial():
|
||||
# Reset initial setup
|
||||
if timer < 2:
|
||||
finishedJumpZone = false
|
||||
finishedMovementZone = false
|
||||
# Request to start tutorial.
|
||||
# Show a movement target to test ( A / D / SHIFT )
|
||||
if not finishedMovementZone: $simpleTargetZone_basic.show()
|
||||
else: $simpleTargetZone_basic.hide()
|
||||
if not finishedJumpZone and finishedMovementZone: $simpleTargetZone_jump.show()
|
||||
else: $simpleTargetZone_jump.hide()
|
||||
if finishedJumpZone and finishedMovementZone and $controls.modulate[3] < 1:
|
||||
$controls.modulate[3] += 0.1
|
||||
$weaponInstruction.show()
|
||||
if botCount < 6:
|
||||
var bot = ts_bot.instance()
|
||||
add_child(bot)
|
||||
bot.global_position = $bot_spawn_locations.get_child(botCount).global_position
|
||||
botCount += 1
|
||||
# After target destroyed request permission to move on to menu.
|
||||
# Remove player before moving on. !!!!!!!!!!!
|
||||
|
||||
if finishedMovementZone and finishedJumpZone and finishedAiming and timer > 2:
|
||||
Network._server_leave()
|
||||
get_tree().change_scene("res://source/scenes/GUI/main_menu.tscn")
|
||||
|
||||
|
||||
func _on_simpleTargetZone_jump_zone_entered():
|
||||
finishedJumpZone = true
|
||||
|
||||
|
||||
func _on_simpleTargetZone_basic_zone_entered():
|
||||
finishedMovementZone = true
|
||||
@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://source/assets/scripts/server_handlers/trinity_site_level_playground.gd" type="Script" id=1]
|
||||
[ext_resource path="res://source/assets/scripts/server_handlers/trinity_site_level_tutorial.gd" type="Script" id=1]
|
||||
[ext_resource path="res://source/assets/scripts/ui_element_handlers/UI.gd" type="Script" id=2]
|
||||
[ext_resource path="res://source/assets/sprites/GUI/background_server.svg" type="Texture" id=3]
|
||||
[ext_resource path="res://source/levels/tutorial/elements/simpleTargetZone.tscn" type="PackedScene" id=4]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://source/assets/scripts/server_handlers/network_processors/singleplayer_setup.gd" type="Script" id=1]
|
||||
[ext_resource path="res://source/assets/scripts/server_handlers/network_processors/singleplayer_setup_tutorial.gd" type="Script" id=1]
|
||||
[ext_resource path="res://source/fonts/oxygen/Oxygen-Regular.ttf" type="DynamicFontData" id=2]
|
||||
[ext_resource path="res://source/assets/sprites/GUI/in_game/buttons/server_title.svg" type="Texture" id=3]
|
||||
[ext_resource path="res://source/scenes/GUI/background.tscn" type="PackedScene" id=5]
|
||||
|
||||
@ -12,16 +12,16 @@ use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=2]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=3]
|
||||
|
||||
[sub_resource type="DynamicFont" id=4]
|
||||
size = 36
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=2]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=3]
|
||||
|
||||
[sub_resource type="DynamicFont" id=5]
|
||||
size = 36
|
||||
use_mipmaps = true
|
||||
@ -61,8 +61,8 @@ margin_left = -225.0
|
||||
margin_top = -25.0
|
||||
margin_right = -225.0
|
||||
margin_bottom = -25.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Enter your username"
|
||||
align = 1
|
||||
valign = 1
|
||||
@ -93,10 +93,10 @@ margin_left = -175.0
|
||||
margin_top = -28.0
|
||||
margin_right = 175.0
|
||||
margin_bottom = 28.0
|
||||
custom_colors/selection_color = Color( 0.8, 0.8, 0.8, 1 )
|
||||
custom_fonts/font = SubResource( 4 )
|
||||
custom_styles/focus = SubResource( 2 )
|
||||
custom_styles/normal = SubResource( 3 )
|
||||
custom_fonts/font = SubResource( 4 )
|
||||
custom_colors/selection_color = Color( 0.8, 0.8, 0.8, 1 )
|
||||
align = 1
|
||||
placeholder_text = "username"
|
||||
__meta__ = {
|
||||
@ -117,8 +117,8 @@ margin_bottom = 97.0
|
||||
[node name="Label" type="Label" parent="popup_screen/panel/confirm"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "CONFIRM"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user