mirror of
https://github.com/kristoferssolo/FuncIt.git
synced 2025-10-21 19:30:35 +00:00
[Medium] Small fixes to loading and tutorial
This commit is contained in:
parent
2ca2428d67
commit
f8b5449a4d
@ -6,20 +6,29 @@ var current_player_location_instance_number = null
|
||||
var globalActivePhase = null
|
||||
|
||||
var timer = 0
|
||||
var begunTutorial = false
|
||||
var finishedMovementZone = false
|
||||
var finishedJumpZone = false
|
||||
var finishedAiming = false
|
||||
var botCount = 0
|
||||
var botsActivated = false
|
||||
var finishedTutorial = false
|
||||
|
||||
var ts_bot = preload("res://source/entities/ts_bot/ts_bot.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
$controls/user_input/controls/ready_button.hide()
|
||||
$controls/user_input/controls/skip_button.hide()
|
||||
$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()
|
||||
$win_lose_screen.show()
|
||||
$win_lose_screen/Panel/Label.text = "Tutorial"
|
||||
$win_lose_screen/Panel/Label2.show()
|
||||
$win_lose_screen/Panel/Label2.text = "Press ENTER to begin or ESC to skip"
|
||||
|
||||
func setup_player_positions() -> void:
|
||||
for player in PersistentNodes.get_children():
|
||||
@ -40,6 +49,14 @@ func _player_disconnected(id) -> void:
|
||||
func _process(delta):
|
||||
timer += delta
|
||||
begin_tutorial()
|
||||
if Input.is_action_pressed("esc") and not begunTutorial:
|
||||
Network._server_leave()
|
||||
get_tree().change_scene("res://source/scenes/GUI/main_menu.tscn")
|
||||
if Input.is_action_pressed("enter") and not begunTutorial:
|
||||
$win_lose_screen.modulate[3] = 0
|
||||
begunTutorial = true
|
||||
if Input.is_action_pressed("enter") and finishedAiming:
|
||||
finishedTutorial = true
|
||||
|
||||
func begin_tutorial():
|
||||
# Reset initial setup
|
||||
@ -48,22 +65,29 @@ func begin_tutorial():
|
||||
finishedMovementZone = false
|
||||
# Request to start tutorial.
|
||||
# Show a movement target to test ( A / D / SHIFT )
|
||||
if not finishedMovementZone: $simpleTargetZone_basic.show()
|
||||
if not finishedMovementZone and begunTutorial: $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:
|
||||
if finishedJumpZone and finishedMovementZone and $controls.modulate[3] < 1 and not finishedAiming:
|
||||
$controls.modulate[3] += 0.1
|
||||
$weaponInstruction.show()
|
||||
if botCount < 6:
|
||||
var bot = ts_bot.instance()
|
||||
add_child(bot)
|
||||
connect("bot_died", bot, "bot_died")
|
||||
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:
|
||||
botsActivated = true
|
||||
if botsActivated and botCount == 0:
|
||||
finishedAiming = true
|
||||
if finishedAiming:
|
||||
if $controls.modulate[3] > 0: $controls.modulate[3] -= 0.1
|
||||
$win_lose_screen/Panel/Label.text = "Complete"
|
||||
$win_lose_screen/Panel/Label2.show()
|
||||
$win_lose_screen/Panel/Label2.text = "Press ENTER to continue"
|
||||
if $win_lose_screen.modulate[3] < 1: $win_lose_screen.modulate[3] += 0.1
|
||||
if finishedTutorial:
|
||||
Network._server_leave()
|
||||
get_tree().change_scene("res://source/scenes/GUI/main_menu.tscn")
|
||||
|
||||
@ -74,3 +98,7 @@ func _on_simpleTargetZone_jump_zone_entered():
|
||||
|
||||
func _on_simpleTargetZone_basic_zone_entered():
|
||||
finishedMovementZone = true
|
||||
|
||||
|
||||
func bot_died():
|
||||
if botsActivated: botCount -= 1
|
||||
|
||||
@ -7,8 +7,6 @@ var accelerationSpeed = 2
|
||||
var deccelerationSpeed = 20
|
||||
var maxSpeed = 250
|
||||
|
||||
signal bot_died
|
||||
|
||||
var worldSpace2d = null
|
||||
var coreRay = {}
|
||||
|
||||
@ -112,4 +110,4 @@ func hit_by_damager(damage, b_rotation, b_velocity):
|
||||
Mode = 2
|
||||
if hp <= 0:
|
||||
queue_free()
|
||||
emit_signal("bot_died")
|
||||
get_tree().call_group("bot_listener", "bot_died")
|
||||
|
||||
@ -17,16 +17,16 @@ height = 46.0
|
||||
|
||||
[sub_resource type="SpriteFrames" id=3]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 1 ) ],
|
||||
"loop": true,
|
||||
"name": "agressive_idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 4 ) ],
|
||||
"loop": true,
|
||||
"name": "friendly_idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 1 ) ],
|
||||
"loop": true,
|
||||
"name": "agressive_idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "passive_idle",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[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]
|
||||
@ -6,11 +6,12 @@
|
||||
[ext_resource path="res://source/levels/tutorial/elements/simpleTargetZone.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://source/assets/sprites/GUI/tutorial/trinity_site_level_layout_level_design_z_index_4.svg" type="Texture" id=5]
|
||||
[ext_resource path="res://source/fonts/oxygen/oxygen_bold.tres" type="DynamicFont" id=6]
|
||||
[ext_resource path="res://source/scenes/OVERLAY/elements/win_lose_screen.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://source/scenes/OVERLAY/elements/user_input.tscn" type="PackedScene" id=15]
|
||||
[ext_resource path="res://source/scenes/OVERLAY/elements/timer.tscn" type="PackedScene" id=17]
|
||||
[ext_resource path="res://source/scenes/OVERLAY/elements/trajectory_control.tscn" type="PackedScene" id=18]
|
||||
|
||||
[node name="trinity-site-playground" type="Node2D"]
|
||||
[node name="trinity-site-playground" type="Node2D" groups=["bot_listener"]]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="simpleTargetZone_basic" parent="." instance=ExtResource( 4 )]
|
||||
@ -114,6 +115,7 @@ margin_top = -150.0
|
||||
margin_bottom = 0.0
|
||||
|
||||
[node name="timer" parent="controls" instance=ExtResource( 17 )]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
margin_left = -225.0
|
||||
@ -156,5 +158,8 @@ position = Vector2( 1584, 600 )
|
||||
[node name="6" type="Position2D" parent="bot_spawn_locations"]
|
||||
position = Vector2( 1762, 600 )
|
||||
|
||||
[node name="win_lose_screen" parent="." instance=ExtResource( 7 )]
|
||||
position = Vector2( 0, 350 )
|
||||
|
||||
[connection signal="zone_entered" from="simpleTargetZone_basic" to="." method="_on_simpleTargetZone_basic_zone_entered"]
|
||||
[connection signal="zone_entered" from="simpleTargetZone_jump" to="." method="_on_simpleTargetZone_jump_zone_entered"]
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://source/fonts/oxygen/Oxygen-Bold.ttf" type="DynamicFontData" id=1]
|
||||
[ext_resource path="res://source/fonts/oxygen/oxygen_bold.tres" type="DynamicFont" id=2]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 0, 0, 0, 0.588235 )
|
||||
@ -23,13 +24,10 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="Panel"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -492.5
|
||||
margin_top = -91.0
|
||||
margin_right = 492.5
|
||||
margin_bottom = 91.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
text = "null"
|
||||
@ -39,3 +37,20 @@ uppercase = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label2" type="Label" parent="Panel"]
|
||||
visible = false
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -1.99776
|
||||
margin_top = 105.0
|
||||
margin_right = -1.9978
|
||||
margin_bottom = 151.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "NULL"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user