Tutorial added

This commit is contained in:
Paul Black 2023-03-19 01:35:35 -06:00
parent 62491e8cd8
commit 880a0304c3
20 changed files with 660 additions and 27 deletions

BIN
2DArt/tutorial/WASD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://8di4e215lc26"
path="res://.godot/imported/WASD.png-3f78d0146d5fae29d75be26970a18b35.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://2DArt/tutorial/WASD.png"
dest_files=["res://.godot/imported/WASD.png-3f78d0146d5fae29d75be26970a18b35.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
2DArt/tutorial/arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dovolduibqou2"
path="res://.godot/imported/arrow.png-4e123d90f2c9d032d0019c3cb4c52a2b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://2DArt/tutorial/arrow.png"
dest_files=["res://.godot/imported/arrow.png-4e123d90f2c9d032d0019c3cb4c52a2b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://xkjlrphq3msn"
path="res://.godot/imported/arrow_filled.png-79a4f1017e0d5b7dbe91016cb8611da9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://2DArt/tutorial/arrow_filled.png"
dest_files=["res://.godot/imported/arrow_filled.png-79a4f1017e0d5b7dbe91016cb8611da9.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
2DArt/tutorial/enterKey.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bewpfvcbye4mp"
path="res://.godot/imported/enterKey.png-d7a25ffe28b2171b77be81ace0cfe6c4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://2DArt/tutorial/enterKey.png"
dest_files=["res://.godot/imported/enterKey.png-d7a25ffe28b2171b77be81ace0cfe6c4.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cn6je1h0mj8du"
path="res://.godot/imported/left-click.png-3370e59a98cb27560d0a03d6206257df.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://2DArt/tutorial/left-click.png"
dest_files=["res://.godot/imported/left-click.png-3370e59a98cb27560d0a03d6206257df.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
2DArt/tutorial/mouse.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b8yep31eeor2o"
path="res://.godot/imported/mouse.png-62c96742756b6ef9e59aefd86eebe560.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://2DArt/tutorial/mouse.png"
dest_files=["res://.godot/imported/mouse.png-62c96742756b6ef9e59aefd86eebe560.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -151,7 +151,7 @@ func _physics_process(delta):
if Global.playerDead: if Global.playerDead:
velocity.x = 0 velocity.x = 0
velocity.z = 0 velocity.z = 0
if Input.is_action_just_pressed("shoot") and Global.roundInSession: if Input.is_action_just_pressed("shoot") and Global.roundInSession and menuScene.visible == false:
if menuOpen == false: if menuOpen == false:
if Global.multiplayerCurrent == true: if Global.multiplayerCurrent == true:
rpc("shoot_bullet") rpc("shoot_bullet")

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://y3fffh5cdbks"] [gd_scene load_steps=5 format=3 uid="uid://y3fffh5cdbks"]
[ext_resource type="Script" path="res://scripts/AI.gd" id="1_1d27o"] [ext_resource type="Script" path="res://scripts/AI.gd" id="1_1d27o"]
[ext_resource type="PackedScene" uid="uid://b3l10agcjfgdx" path="res://characters/teddy/model_glb/teddy.glb" id="2_0yvds"]
[sub_resource type="BoxShape3D" id="BoxShape3D_7vhwh"] [sub_resource type="BoxShape3D" id="BoxShape3D_7vhwh"]
size = Vector3(1, 1.99126, 1) size = Vector3(1, 1.99126, 1)
@ -19,7 +20,11 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.859224, 0)
[node name="BulletGenerator" type="Marker3D" parent="CollisionShape3D/Neck"] [node name="BulletGenerator" type="Marker3D" parent="CollisionShape3D/Neck"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.104801, -0.858231) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.104801, -0.858231)
[node name="Teddy" parent="CollisionShape3D/Neck" instance=ExtResource("2_0yvds")]
transform = Transform3D(-0.307416, 0, -2.68751e-08, 0, 0.307416, 0, 2.68751e-08, 0, -0.307416, 0, -1.87988, 0)
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"] [node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
visible = false
mesh = SubResource("CapsuleMesh_ucocb") mesh = SubResource("CapsuleMesh_ucocb")
skeleton = NodePath("") skeleton = NodePath("")

View file

@ -1,8 +1,17 @@
[gd_scene load_steps=4 format=3 uid="uid://ytbacsuahxie"] [gd_scene load_steps=11 format=3 uid="uid://ytbacsuahxie"]
[ext_resource type="Script" path="res://scripts/HUD.gd" id="1_mqiiw"] [ext_resource type="Script" path="res://scripts/HUD.gd" id="1_mqiiw"]
[ext_resource type="Texture2D" uid="uid://tjvdle3jlb6g" path="res://textures/crosshair1.png" id="2_5dvrx"] [ext_resource type="Texture2D" uid="uid://tjvdle3jlb6g" path="res://textures/crosshair1.png" id="2_5dvrx"]
[ext_resource type="FontFile" uid="uid://dvvqq2hluaa3o" path="res://fonts/League.otf" id="3_x1wqt"] [ext_resource type="FontFile" uid="uid://dvvqq2hluaa3o" path="res://fonts/League.otf" id="3_x1wqt"]
[ext_resource type="Texture2D" uid="uid://8di4e215lc26" path="res://2DArt/tutorial/WASD.png" id="4_wdsme"]
[ext_resource type="Texture2D" uid="uid://b8yep31eeor2o" path="res://2DArt/tutorial/mouse.png" id="5_p1l0s"]
[ext_resource type="Texture2D" uid="uid://dovolduibqou2" path="res://2DArt/tutorial/arrow.png" id="6_lxmr7"]
[ext_resource type="Texture2D" uid="uid://xkjlrphq3msn" path="res://2DArt/tutorial/arrow_filled.png" id="7_klqcg"]
[ext_resource type="Texture2D" uid="uid://cn6je1h0mj8du" path="res://2DArt/tutorial/left-click.png" id="8_i5jmt"]
[ext_resource type="Texture2D" uid="uid://bewpfvcbye4mp" path="res://2DArt/tutorial/enterKey.png" id="9_j1om3"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ir016"]
bg_color = Color(1, 0, 0, 1)
[node name="HUD" type="Control"] [node name="HUD" type="Control"]
layout_mode = 3 layout_mode = 3
@ -138,9 +147,9 @@ layout_mode = 1
anchors_preset = 5 anchors_preset = 5
anchor_left = 0.5 anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
offset_left = -106.0 offset_left = -98.0
offset_top = 52.0 offset_top = 52.0
offset_right = 106.0 offset_right = 114.0
offset_bottom = 105.0 offset_bottom = 105.0
grow_horizontal = 2 grow_horizontal = 2
theme_override_fonts/font = ExtResource("3_x1wqt") theme_override_fonts/font = ExtResource("3_x1wqt")
@ -215,3 +224,222 @@ offset_top = 130.0
offset_right = 769.0 offset_right = 769.0
offset_bottom = 156.0 offset_bottom = 156.0
horizontal_alignment = 1 horizontal_alignment = 1
[node name="TutorialPanel" type="Panel" parent="."]
visible = false
layout_mode = 0
offset_left = 403.0
offset_top = 127.0
offset_right = 754.0
offset_bottom = 290.0
[node name="W" type="Panel" parent="TutorialPanel"]
visible = false
layout_mode = 0
offset_left = 159.0
offset_top = 80.0
offset_right = 189.0
offset_bottom = 110.0
theme_override_styles/panel = SubResource("StyleBoxFlat_ir016")
[node name="A" type="Panel" parent="TutorialPanel"]
visible = false
offset_left = 119.0
offset_top = 120.0
offset_right = 149.0
offset_bottom = 150.0
theme_override_styles/panel = SubResource("StyleBoxFlat_ir016")
[node name="S" type="Panel" parent="TutorialPanel"]
visible = false
offset_left = 159.0
offset_top = 120.0
offset_right = 189.0
offset_bottom = 150.0
theme_override_styles/panel = SubResource("StyleBoxFlat_ir016")
[node name="D" type="Panel" parent="TutorialPanel"]
visible = false
offset_left = 199.0
offset_top = 120.0
offset_right = 229.0
offset_bottom = 150.0
theme_override_styles/panel = SubResource("StyleBoxFlat_ir016")
[node name="welcome" type="Label" parent="TutorialPanel"]
visible = false
layout_mode = 0
offset_left = 5.0
offset_top = 19.0
offset_right = 350.0
offset_bottom = 45.0
text = "Welcome to Project Teddy!!!"
horizontal_alignment = 1
[node name="move" type="Label" parent="TutorialPanel"]
visible = false
offset_left = 4.0
offset_top = 49.0
offset_right = 346.0
offset_bottom = 75.0
text = "Use WASD to move the character"
horizontal_alignment = 1
[node name="Wasd" type="Sprite2D" parent="TutorialPanel"]
visible = false
position = Vector2(174, 115)
scale = Vector2(0.226562, 0.226562)
texture = ExtResource("4_wdsme")
[node name="camera" type="Label" parent="TutorialPanel"]
visible = false
offset_left = 4.0
offset_top = 12.0
offset_right = 346.0
offset_bottom = 38.0
text = "Move your mouse to move your camera"
horizontal_alignment = 1
[node name="Mouse" type="Sprite2D" parent="TutorialPanel"]
visible = false
position = Vector2(173, 101)
scale = Vector2(0.0742188, 0.0742188)
texture = ExtResource("5_p1l0s")
[node name="Arrow_up" type="Sprite2D" parent="TutorialPanel"]
visible = false
position = Vector2(173, 56)
scale = Vector2(0.133159, 0.133159)
texture = ExtResource("6_lxmr7")
[node name="Arrow_left" type="Sprite2D" parent="TutorialPanel"]
visible = false
position = Vector2(129, 107)
rotation = -1.5708
scale = Vector2(0.133159, 0.133159)
texture = ExtResource("6_lxmr7")
[node name="Arrow_right" type="Sprite2D" parent="TutorialPanel"]
visible = false
position = Vector2(221, 107)
rotation = 1.5708
scale = Vector2(0.133159, 0.133159)
texture = ExtResource("6_lxmr7")
[node name="Arrow_down" type="Sprite2D" parent="TutorialPanel"]
visible = false
position = Vector2(173, 146)
rotation = 3.14159
scale = Vector2(0.133159, 0.133159)
texture = ExtResource("6_lxmr7")
[node name="ArrowFilled_up" type="Sprite2D" parent="TutorialPanel"]
visible = false
position = Vector2(173, 56)
scale = Vector2(0.133, 0.133)
texture = ExtResource("7_klqcg")
[node name="ArrowFilled_left" type="Sprite2D" parent="TutorialPanel"]
visible = false
position = Vector2(129, 107)
rotation = -1.5708
scale = Vector2(0.133, 0.133)
texture = ExtResource("7_klqcg")
[node name="ArrowFilled_right" type="Sprite2D" parent="TutorialPanel"]
visible = false
position = Vector2(221, 107)
rotation = 1.5708
scale = Vector2(0.133, 0.133)
texture = ExtResource("7_klqcg")
[node name="ArrowFilled_down" type="Sprite2D" parent="TutorialPanel"]
visible = false
position = Vector2(173, 146)
rotation = 3.14159
scale = Vector2(0.133, 0.133)
texture = ExtResource("7_klqcg")
[node name="start" type="Label" parent="TutorialPanel"]
visible = false
offset_left = 4.0
offset_top = 12.0
offset_right = 346.0
offset_bottom = 38.0
text = "Press Enter to start the round"
horizontal_alignment = 1
[node name="enter" type="Label" parent="TutorialPanel"]
visible = false
offset_left = 4.0
offset_top = 37.0
offset_right = 346.0
offset_bottom = 63.0
text = "An AI player will automatically be created"
horizontal_alignment = 1
[node name="EnterKey" type="Sprite2D" parent="TutorialPanel"]
visible = false
position = Vector2(174, 113)
scale = Vector2(0.0461607, 0.0461607)
texture = ExtResource("9_j1om3")
[node name="shoot" type="Label" parent="TutorialPanel"]
visible = false
offset_left = 4.0
offset_top = 12.0
offset_right = 346.0
offset_bottom = 38.0
text = "Use your left click button to shoot bullets"
horizontal_alignment = 1
[node name="Leftmouse" type="Sprite2D" parent="TutorialPanel"]
visible = false
position = Vector2(174, 97)
scale = Vector2(0.43543, 0.43543)
texture = ExtResource("8_i5jmt")
[node name="learning" type="Label" parent="TutorialPanel"]
visible = false
offset_left = 4.0
offset_top = 12.0
offset_right = 346.0
offset_bottom = 38.0
text = "Great, using everything you learned"
horizontal_alignment = 1
[node name="aim" type="Label" parent="TutorialPanel"]
visible = false
offset_left = 4.0
offset_top = 39.0
offset_right = 346.0
offset_bottom = 65.0
text = "Aim at the enemy AI and shoot at them"
horizontal_alignment = 1
[node name="timer" type="Label" parent="TutorialPanel"]
visible = false
offset_left = 4.0
offset_top = 68.0
offset_right = 346.0
offset_bottom = 94.0
text = "You have a timer on the top of your screen"
horizontal_alignment = 1
[node name="zero" type="Label" parent="TutorialPanel"]
visible = false
offset_left = 4.0
offset_top = 97.0
offset_right = 346.0
offset_bottom = 123.0
text = "When it gets to 0, the game ends"
horizontal_alignment = 1
[node name="done" type="Label" parent="TutorialPanel"]
visible = false
offset_left = 4.0
offset_top = 129.0
offset_right = 346.0
offset_bottom = 155.0
text = "That's it for the tutorial! Good luck!"
horizontal_alignment = 1

View file

@ -31,11 +31,11 @@ transform = Transform3D(-0.866025, -0.433013, 0.25, 0, 0.5, 0.866025, -0.5, 0.75
shadow_enabled = true shadow_enabled = true
[node name="Teddy" parent="." instance=ExtResource("1_081si")] [node name="Teddy" parent="." instance=ExtResource("1_081si")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.08165e-12, 1.039, 2.08165e-12) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.17483, 1.039, 2.08165e-12)
[node name="HUD" parent="." instance=ExtResource("2_s3v8n")] [node name="HUD" parent="." instance=ExtResource("2_s3v8n")]
[node name="AI" parent="." instance=ExtResource("4_fttoe")] [node name="AI" parent="." instance=ExtResource("4_fttoe")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.27149, 1.04845, -4.64617) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.21775, 1.22338, -28.4151)
[node name="Farmland" parent="." instance=ExtResource("5_imhi6")] [node name="Farmland" parent="." instance=ExtResource("5_imhi6")]

View file

@ -14,6 +14,10 @@ var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
var player var player
@export var Bullet = preload("res://objects/Bullet/Bullet.tscn") @export var Bullet = preload("res://objects/Bullet/Bullet.tscn")
func _ready():
self.visible = false
$CollisionShape3D.disabled = true
func _physics_process(delta): func _physics_process(delta):
if Global.selfTeddy: if Global.selfTeddy:
player = get_node(Global.selfTeddy) player = get_node(Global.selfTeddy)
@ -21,21 +25,31 @@ func _physics_process(delta):
if not is_on_floor(): if not is_on_floor():
velocity.y -= gravity * delta velocity.y -= gravity * delta
if Global.roundInSession:
if player and Global.playerAlive: self.visible = true
bullettimer = bullettimer - 10 * delta $CollisionShape3D.disabled = false
if bullettimer < 0 and bulletshot == false: if $CollisionShape3D/Neck/Teddy/AnimationPlayer.is_playing() == false and not Global.tutorialComplete:
bulletshot = true $CollisionShape3D/Neck/Teddy/AnimationPlayer.play("idle")
var b = Bullet.instantiate() if player and Global.playerAlive and Global.tutorialComplete:
owner.add_child(b) if $CollisionShape3D/Neck/Teddy/AnimationPlayer.is_playing():
b.transform = $CollisionShape3D/Neck/BulletGenerator.global_transform var animation = $CollisionShape3D/Neck/Teddy/AnimationPlayer.get_current_animation()
b.velocity = -b.global_transform.basis.z * b.muzzle_velocity if animation == "idle":
$sound.stream = load("res://sounds/pistol_shoot.wav") $CollisionShape3D/Neck/Teddy/AnimationPlayer.play("walk")
$sound.play() if $CollisionShape3D/Neck/Teddy/AnimationPlayer.is_playing() == false:
elif bulletshot == true: $CollisionShape3D/Neck/Teddy/AnimationPlayer.play("walk")
bulletshot = false bullettimer = bullettimer - 10 * delta
bulletrandom = randf_range(1.0, 50.0) if bullettimer < 0 and bulletshot == false:
bullettimer = bulletrandom bulletshot = true
velocity = (player.transform.origin - transform.origin).normalized() * SPEED var b = Bullet.instantiate()
$CollisionShape3D.look_at(Vector3(player.global_transform.origin.x, global_transform.origin.y, player.global_transform.origin.z), Vector3(0,1,0)) owner.add_child(b)
move_and_slide() b.transform = $CollisionShape3D/Neck/BulletGenerator.global_transform
b.velocity = -b.global_transform.basis.z * b.muzzle_velocity
$sound.stream = load("res://sounds/pistol_shoot.wav")
$sound.play()
elif bulletshot == true:
bulletshot = false
bulletrandom = randf_range(1.0, 50.0)
bullettimer = bulletrandom
velocity = (player.transform.origin - transform.origin).normalized() * SPEED
$CollisionShape3D.look_at(Vector3(player.global_transform.origin.x, global_transform.origin.y, player.global_transform.origin.z), Vector3(0,1,0))
move_and_slide()

View file

@ -1,6 +1,6 @@
extends Control extends Control
var roundTimer := 300.0 var roundTimer = Global.roundTimer
var minutes var minutes
var seconds var seconds
@ -9,6 +9,8 @@ var scoresInitalized = false
var runnerSelected = false var runnerSelected = false
func _ready(): func _ready():
await get_tree().create_timer(0.1).timeout
roundTimer = Global.roundTimer
minutes = roundTimer / 60 minutes = roundTimer / 60
seconds = fmod(roundTimer, 60) seconds = fmod(roundTimer, 60)
$timer.text = "%02d:%02d" % [minutes, seconds] $timer.text = "%02d:%02d" % [minutes, seconds]
@ -18,6 +20,8 @@ func _process(delta):
$startLabel.text = Global.HUDStartLabelText $startLabel.text = Global.HUDStartLabelText
$Fatigue.value = Global.fatigue $Fatigue.value = Global.fatigue
$Health.value = Global.playerHealth $Health.value = Global.playerHealth
if Global.mapName == "Tutorial":
tutorial()
if Global.iAmRunner: if Global.iAmRunner:
rpc("sync_runner_hp", $Health.value) rpc("sync_runner_hp", $Health.value)
if Global.musicUpdated == true: if Global.musicUpdated == true:
@ -42,6 +46,8 @@ func _process(delta):
print("RUNNER IS DEAD") print("RUNNER IS DEAD")
rpc("runner_dead", Global.chosenRunner) rpc("runner_dead", Global.chosenRunner)
runner_dead(Global.chosenRunner) runner_dead(Global.chosenRunner)
if Global.mapName == "Tutorial":
pass
roundTimer -= delta roundTimer -= delta
minutes = roundTimer / 60 minutes = roundTimer / 60
seconds = fmod(roundTimer, 60) seconds = fmod(roundTimer, 60)
@ -124,4 +130,178 @@ func sync_runner_hp(value):
@rpc("any_peer", "reliable") @rpc("any_peer", "reliable")
func killed_text(killer, killed): func killed_text(killer, killed):
$killedLabel.text = killer + " killed " + killed $killedLabel.text = killer + " killed " + killed
### TUTORIAL STUFF ###
var w = false
var a = false
var s = false
var d = false
var ran_timer = false
var stage1 = false
func tutorial():
if not stage1:
stage1 = true
$TutorialPanel/camera.visible = false
$TutorialPanel/Mouse.visible = false
$TutorialPanel/Arrow_up.visible = false
$TutorialPanel/Arrow_left.visible = false
$TutorialPanel/Arrow_down.visible = false
$TutorialPanel/Arrow_right.visible = false
$TutorialPanel/shoot.visible = false
$TutorialPanel/Leftmouse.visible = false
$TutorialPanel/start.visible = false
$TutorialPanel/enter.visible = false
$TutorialPanel/EnterKey.visible = false
$TutorialPanel/learning.visible = false
$TutorialPanel/aim.visible = false
$TutorialPanel/timer.visible = false
$TutorialPanel/zero.visible = false
$TutorialPanel/done.visible = false
$TutorialPanel.visible = true
$TutorialPanel/welcome.visible = true
$TutorialPanel/move.visible = true
$TutorialPanel/Wasd.visible = true
$player1Label.text = Global.playerName
Global.HUDStartLabelText = " "
if not w:
if Input.is_action_just_pressed("player_forward"):
w = true
$TutorialPanel/W.visible = true
if not a:
if Input.is_action_just_pressed("player_left"):
a = true
$TutorialPanel/A.visible = true
if not s:
if Input.is_action_just_pressed("player_backward"):
s = true
$TutorialPanel/S.visible = true
if not d:
if Input.is_action_just_pressed("player_right"):
d = true
$TutorialPanel/D.visible = true
if w and a and s and d:
if not ran_timer:
await get_tree().create_timer(0.5).timeout
ran_timer = true
else:
tutorial_2()
var up = false
var left = false
var down = false
var right = false
var prev_mouse_pos = get_global_mouse_position()
var ran_timer2 = false
var ran_timer3 = false
var stage2 = false
func tutorial_2():
if not stage2:
stage2 = true
$TutorialPanel/W.visible = false
$TutorialPanel/A.visible = false
$TutorialPanel/S.visible = false
$TutorialPanel/D.visible = false
$TutorialPanel/Wasd.visible = false
$TutorialPanel/welcome.visible = false
$TutorialPanel/move.visible = false
$TutorialPanel/camera.visible = true
$TutorialPanel/Mouse.visible = true
$TutorialPanel/Arrow_up.visible = true
$TutorialPanel/Arrow_left.visible = true
$TutorialPanel/Arrow_down.visible = true
$TutorialPanel/Arrow_right.visible = true
if not ran_timer2:
await get_tree().create_timer(0.5).timeout
ran_timer2 = true
else:
var mouse_pos = get_global_mouse_position()
if not up:
if mouse_pos.y < prev_mouse_pos.y:
up = true
$TutorialPanel/ArrowFilled_up.visible = true
if not down:
if mouse_pos.y > prev_mouse_pos.y:
down = true
$TutorialPanel/ArrowFilled_down.visible = true
if not left:
if mouse_pos.x > prev_mouse_pos.x:
left = true
$TutorialPanel/ArrowFilled_left.visible = true
if not right:
if mouse_pos.x < prev_mouse_pos.x:
right = true
$TutorialPanel/ArrowFilled_right.visible = true
prev_mouse_pos = mouse_pos
if up and left and right and down:
if not ran_timer3:
await get_tree().create_timer(0.5).timeout
ran_timer3 = true
else:
tutorial_3()
var stage3_continue = false
var stage3 = false
func tutorial_3():
if not stage3:
stage3 = true
$TutorialPanel/camera.visible = false
$TutorialPanel/Mouse.visible = false
$TutorialPanel/Arrow_up.visible = false
$TutorialPanel/Arrow_left.visible = false
$TutorialPanel/Arrow_down.visible = false
$TutorialPanel/Arrow_right.visible = false
$TutorialPanel/ArrowFilled_up.visible = false
$TutorialPanel/ArrowFilled_left.visible = false
$TutorialPanel/ArrowFilled_down.visible = false
$TutorialPanel/ArrowFilled_right.visible = false
$TutorialPanel/start.visible = true
$TutorialPanel/enter.visible = true
$TutorialPanel/EnterKey.visible = true
Global.HUDStartLabelText = "PRESS ENTER/RETURN TO START THE ROUND"
if Input.is_action_just_pressed("start_game"):
stage3_continue = true
$player2Label.text = "AI"
if stage3_continue:
tutorial_4()
var stage4_continue = false
var stage4 = false
func tutorial_4():
if not stage4:
stage4 = true
$TutorialPanel/start.visible = false
$TutorialPanel/enter.visible = false
$TutorialPanel/EnterKey.visible = false
$TutorialPanel/shoot.visible = true
$TutorialPanel/Leftmouse.visible = true
if Input.is_action_just_pressed("shoot"):
stage4_continue = true
if stage4_continue:
tutorial_5()
var stage5 = false
func tutorial_5():
if not stage5:
stage5 = true
$TutorialPanel/shoot.visible = false
$TutorialPanel/Leftmouse.visible = false
$TutorialPanel/learning.visible = true
$TutorialPanel/aim.visible = true
$TutorialPanel/timer.visible = true
$TutorialPanel/zero.visible = true
$TutorialPanel/done.visible = true
await get_tree().create_timer(12).timeout
$TutorialPanel.visible = false
Global.tutorialComplete = true

View file

@ -42,6 +42,7 @@ var spawnCoords_y: Array[float] = [] # Used locally in spawn_locations() functio
var spawnCoords_z: Array[float] = [] # Used locally in spawn_locations() function var spawnCoords_z: Array[float] = [] # Used locally in spawn_locations() function
var spawnCoordsInitalized = false # Used locally var spawnCoordsInitalized = false # Used locally
var volumeModifer = 1 # Modifies volume level var volumeModifer = 1 # Modifies volume level
var tutorialComplete = false # Used only for tutorial
func _process(delta): func _process(delta):
#if not spawnCoordsInitalized: #if not spawnCoordsInitalized:

View file

@ -4,6 +4,7 @@ extends Node
func _ready(): func _ready():
Global.playerHealth = 100 Global.playerHealth = 100
Global.fatigue = 100 Global.fatigue = 100
Global.roundTimer = 90.0
func _process(delta): func _process(delta):