Initial character select implementation

This commit is contained in:
2023-09-03 15:06:39 -07:00
parent a15973a621
commit f7417d0afd
26 changed files with 269 additions and 154 deletions

View File

@@ -1,27 +1,16 @@
[gd_scene load_steps=6 format=3 uid="uid://cxj6yeddshy16"]
[gd_scene load_steps=5 format=3 uid="uid://cxj6yeddshy16"]
[ext_resource type="PackedScene" uid="uid://b38hcomu4tpm5" path="res://Scenes/TestCharacter.tscn" id="1_6lmun"]
[ext_resource type="PackedScene" uid="uid://si4byubqnng4" path="res://Scenes/TestBullet.tscn" id="2_nt6in"]
[ext_resource type="PackedScene" uid="uid://bq40xbqibrk1y" path="res://Scenes/ShotgunBullet.tscn" id="3_ienc8"]
[ext_resource type="Script" path="res://Scripts/Player2.cs" id="4_ff7nl"]
[ext_resource type="PackedScene" uid="uid://b38hcomu4tpm5" path="res://Scenes/PiscesWitch.tscn" id="1_6lmun"]
[ext_resource type="Script" path="res://Scripts/GameManager.cs" id="1_ya2kt"]
[ext_resource type="PackedScene" uid="uid://dq1gtd55p04do" path="res://Scenes/StageGUI.tscn" id="5_gsh7q"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="7_4n1rc"]
[node name="GameManager" type="Node"]
[node name="Player1" parent="." groups=["Player1"] instance=ExtResource("1_6lmun")]
transform = Transform3D(0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, -2.05794, 0, 5.4546)
collision_layer = 17
collision_mask = 17
_fireProjectile = ExtResource("2_nt6in")
_altFireProjectile = ExtResource("3_ienc8")
[node name="Player2" parent="." groups=["Player2"] instance=ExtResource("1_6lmun")]
transform = Transform3D(0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0.915219, 0, 5.4546)
collision_layer = 17
collision_mask = 17
script = ExtResource("4_ff7nl")
_fireProjectile = ExtResource("2_nt6in")
_altFireProjectile = ExtResource("3_ienc8")
[node name="GameManager" type="Node" node_paths=PackedStringArray("_p1SelectedCharacter", "_p2SelectedCharacter")]
script = ExtResource("1_ya2kt")
_p1Characters = [ExtResource("1_6lmun"), ExtResource("1_6lmun")]
_p2Characters = [ExtResource("1_6lmun"), ExtResource("1_6lmun")]
_p1SelectedCharacter = NodePath("Pisces")
_p2SelectedCharacter = NodePath("Pisces2")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.929007, 0.136193, 0.34409, 0.369825, 0.375014, 0.850055, -0.0132668, 0.91696, -0.398758, -3.58319, 11.9025, 0.163277)
@@ -39,3 +28,20 @@ offset_right = 0.0
offset_bottom = 0.0
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="P1SpawnPoint" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.58707, 0, 0)
script = ExtResource("7_4n1rc")
[node name="P2SpawnPoint" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.651031, 0, 0)
script = ExtResource("7_4n1rc")
[node name="Pisces" parent="." instance=ExtResource("1_6lmun")]
visible = false
[node name="Pisces2" parent="." instance=ExtResource("1_6lmun")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.67345, 0, 0)
visible = false
[connection signal="OnCharacterSelectionMade" from="StageGUI" to="." method="OnP1CharacterSelected"]

View File

@@ -1,3 +0,0 @@
[gd_scene format=3 uid="uid://gvvqybsmsj1w"]
[node name="Level2" type="Node3D"]

View File

@@ -3,8 +3,8 @@
[ext_resource type="Script" path="res://Scripts/AreaExit.cs" id="1_owv8t"]
[ext_resource type="PackedScene" uid="uid://c0lv8ovqkl3a6" path="res://Levels/Models/STAGE 1.blend" id="1_pwpof"]
[ext_resource type="PackedScene" uid="uid://jgf7k1r35km1" path="res://Scenes/ExitPortal.tscn" id="6_gegi6"]
[ext_resource type="Script" path="res://Scripts/P1SpawnPoint.cs" id="8_43upo"]
[ext_resource type="Script" path="res://Scripts/P2SpawnPoint.cs" id="9_8v1uu"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="8_43upo"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="9_8v1uu"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_kv6vl"]
radius = 0.957319

View File

@@ -3,8 +3,8 @@
[ext_resource type="PackedScene" uid="uid://dmi76rb317oou" path="res://Levels/Models/STAGE 2.blend" id="1_5pcmj"]
[ext_resource type="Script" path="res://Scripts/AreaExit.cs" id="1_u04pt"]
[ext_resource type="PackedScene" uid="uid://jgf7k1r35km1" path="res://Scenes/ExitPortal.tscn" id="2_sq8bv"]
[ext_resource type="Script" path="res://Scripts/P1SpawnPoint.cs" id="4_1ryhf"]
[ext_resource type="Script" path="res://Scripts/P2SpawnPoint.cs" id="5_dg8k3"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="4_1ryhf"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="5_dg8k3"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_tux5n"]
radius = 0.957319

View File

@@ -3,8 +3,8 @@
[ext_resource type="Script" path="res://Scripts/AreaExit.cs" id="1_1tnw5"]
[ext_resource type="PackedScene" uid="uid://dwd2hlxhkcfpp" path="res://Levels/Models/STAGE 3.blend" id="1_blsh8"]
[ext_resource type="PackedScene" uid="uid://jgf7k1r35km1" path="res://Scenes/ExitPortal.tscn" id="3_2t766"]
[ext_resource type="Script" path="res://Scripts/P1SpawnPoint.cs" id="4_t5mi5"]
[ext_resource type="Script" path="res://Scripts/P2SpawnPoint.cs" id="5_kc2wt"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="4_t5mi5"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="5_kc2wt"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_j26hn"]
radius = 0.957319

View File

@@ -3,8 +3,8 @@
[ext_resource type="PackedScene" uid="uid://c33ymduovqqw" path="res://Levels/Models/STAGE 4.blend" id="1_qu6ym"]
[ext_resource type="Script" path="res://Scripts/AreaExit.cs" id="1_sqfsi"]
[ext_resource type="PackedScene" uid="uid://jgf7k1r35km1" path="res://Scenes/ExitPortal.tscn" id="3_wflo5"]
[ext_resource type="Script" path="res://Scripts/P1SpawnPoint.cs" id="4_hoql1"]
[ext_resource type="Script" path="res://Scripts/P2SpawnPoint.cs" id="5_tx78o"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="4_hoql1"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="5_tx78o"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_8lqmd"]
radius = 0.957319

View File

@@ -3,8 +3,8 @@
[ext_resource type="PackedScene" uid="uid://cthfld06b4dng" path="res://Levels/Models/STAGE 5.blend" id="1_fagdb"]
[ext_resource type="Script" path="res://Scripts/AreaExit.cs" id="1_qbafj"]
[ext_resource type="PackedScene" uid="uid://jgf7k1r35km1" path="res://Scenes/ExitPortal.tscn" id="3_ehcts"]
[ext_resource type="Script" path="res://Scripts/P1SpawnPoint.cs" id="4_a5c54"]
[ext_resource type="Script" path="res://Scripts/P2SpawnPoint.cs" id="5_2mfmm"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="4_a5c54"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="5_2mfmm"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_a8pxa"]
radius = 0.957319

View File

@@ -3,8 +3,8 @@
[ext_resource type="PackedScene" uid="uid://bc3wjl3ibs5q7" path="res://Levels/Models/STAGE 6.blend" id="1_q1cka"]
[ext_resource type="Script" path="res://Scripts/AreaExit.cs" id="1_qlv44"]
[ext_resource type="PackedScene" uid="uid://jgf7k1r35km1" path="res://Scenes/ExitPortal.tscn" id="3_0wdh0"]
[ext_resource type="Script" path="res://Scripts/P1SpawnPoint.cs" id="4_awoco"]
[ext_resource type="Script" path="res://Scripts/P2SpawnPoint.cs" id="5_tba4e"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="4_awoco"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="5_tba4e"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_wu0in"]
radius = 0.957319

View File

@@ -3,8 +3,8 @@
[ext_resource type="PackedScene" uid="uid://biurk21cl5wxw" path="res://Levels/Models/STAGE 7.blend" id="1_dc67b"]
[ext_resource type="Script" path="res://Scripts/AreaExit.cs" id="1_fio4n"]
[ext_resource type="PackedScene" uid="uid://jgf7k1r35km1" path="res://Scenes/ExitPortal.tscn" id="3_sjnhq"]
[ext_resource type="Script" path="res://Scripts/P1SpawnPoint.cs" id="4_kxyoc"]
[ext_resource type="Script" path="res://Scripts/P2SpawnPoint.cs" id="5_5gfi0"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="4_kxyoc"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="5_5gfi0"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_a56hv"]
radius = 0.957319

View File

@@ -3,8 +3,8 @@
[ext_resource type="Script" path="res://Scripts/AreaExit.cs" id="1_mo03n"]
[ext_resource type="PackedScene" uid="uid://dibismvgu8151" path="res://Levels/Models/STAGE 8.blend" id="1_wd00s"]
[ext_resource type="PackedScene" uid="uid://jgf7k1r35km1" path="res://Scenes/ExitPortal.tscn" id="3_44edv"]
[ext_resource type="Script" path="res://Scripts/P1SpawnPoint.cs" id="4_rdu0b"]
[ext_resource type="Script" path="res://Scripts/P2SpawnPoint.cs" id="5_76jfi"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="4_rdu0b"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="5_76jfi"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_3ne7n"]
radius = 0.957319

View File

@@ -2,8 +2,8 @@
[ext_resource type="PackedScene" uid="uid://bs8iqbayeqqm" path="res://Levels/Models/STAGE 9.blend" id="1_ley6w"]
[ext_resource type="Script" path="res://Scripts/HealthbarProgress.cs" id="2_53ar2"]
[ext_resource type="Script" path="res://Scripts/P1SpawnPoint.cs" id="2_hr1h4"]
[ext_resource type="Script" path="res://Scripts/P2SpawnPoint.cs" id="3_xr71f"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="2_hr1h4"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="3_xr71f"]
[ext_resource type="PackedScene" uid="uid://brbshysbgd47q" path="res://Scenes/god_circuit.tscn" id="4_vmhpd"]
[ext_resource type="Texture2D" uid="uid://ccnmmyvs53gni" path="res://Textures/Style_1.png" id="5_jjg8p"]
[ext_resource type="PackedScene" uid="uid://b1j0g6ikmnibm" path="res://Scenes/HPComponent.tscn" id="7_nvq88"]

View File

@@ -1,17 +1,7 @@
[gd_scene load_steps=7 format=3 uid="uid://b12gq4yqc3d8i"]
[gd_scene load_steps=3 format=3 uid="uid://b12gq4yqc3d8i"]
[ext_resource type="Script" path="res://Scripts/MainMenu.cs" id="1_6aikc"]
[ext_resource type="PackedScene" uid="uid://cjl20bs56430j" path="res://UI/Animations/UIAnimations.tscn" id="2_erh7e"]
[ext_resource type="Texture2D" uid="uid://haxbuoepqn2b" path="res://UI/LEVEL DROP 1.png" id="3_g1vq2"]
[ext_resource type="Texture2D" uid="uid://dieoh0r7a5try" path="res://Textures/Portraits/Pisces.jpg" id="4_sm8v0"]
[sub_resource type="Animation" id="Animation_ptfpl"]
resource_name = "Rollover"
[sub_resource type="AnimationLibrary" id="AnimationLibrary_05shj"]
_data = {
"Rollover": SubResource("Animation_ptfpl")
}
[node name="MainMenu" type="Node2D"]
script = ExtResource("1_6aikc")
@@ -34,57 +24,7 @@ offset_bottom = 645.0
text = "Play"
[node name="UIAnimations" parent="." instance=ExtResource("2_erh7e")]
[node name="CharacterSelect" type="Control" parent="."]
visible = false
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="BG" type="TextureRect" parent="CharacterSelect"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = ExtResource("3_g1vq2")
[node name="P1_Portrait" type="TextureRect" parent="CharacterSelect"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 24.0
offset_top = 312.0
offset_right = 1565.0
offset_bottom = 1841.0
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(0.3, 0.3)
texture = ExtResource("4_sm8v0")
flip_h = true
[node name="P2_Portrait" type="TextureRect" parent="CharacterSelect"]
layout_mode = 1
anchors_preset = 6
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = 1444.0
offset_top = 324.0
offset_right = 2985.0
offset_bottom = 1853.0
grow_horizontal = 0
grow_vertical = 2
scale = Vector2(0.3, 0.3)
texture = ExtResource("4_sm8v0")
[node name="AnimationPlayer" type="AnimationPlayer" parent="CharacterSelect"]
libraries = {
"": SubResource("AnimationLibrary_05shj")
}
[connection signal="IntroAnimationsCompleted" from="." to="." method="OnAllAnimationsFinished"]
[connection signal="pressed" from="NewGame/Button" to="." method="OnStartButtonPressed"]

View File

@@ -1,6 +1,8 @@
[gd_scene load_steps=5 format=3 uid="uid://b38hcomu4tpm5"]
[gd_scene load_steps=7 format=3 uid="uid://b38hcomu4tpm5"]
[ext_resource type="Script" path="res://Scripts/TestCharacter.cs" id="1_hddqi"]
[ext_resource type="Script" path="res://Scripts/Player1.cs" id="1_tinf8"]
[ext_resource type="PackedScene" uid="uid://si4byubqnng4" path="res://Scenes/TestBullet.tscn" id="2_ciujd"]
[ext_resource type="PackedScene" uid="uid://bq40xbqibrk1y" path="res://Scenes/ShotgunBullet.tscn" id="3_0of1i"]
[ext_resource type="PackedScene" uid="uid://yosw0j58nvrf" path="res://Models/Characters/fwitch.gltf" id="4_n3637"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ayco3"]
@@ -11,8 +13,10 @@ height = 3.77708
radius = 0.704872
height = 1.67894
[node name="Character" type="CharacterBody3D"]
script = ExtResource("1_hddqi")
[node name="Pisces" type="CharacterBody3D"]
script = ExtResource("1_tinf8")
_fireProjectile = ExtResource("2_ciujd")
_altFireProjectile = ExtResource("3_0of1i")
[node name="Pivot" type="Node3D" parent="."]

View File

@@ -1,6 +1,16 @@
[gd_scene load_steps=2 format=3 uid="uid://dq1gtd55p04do"]
[gd_scene load_steps=6 format=3 uid="uid://dq1gtd55p04do"]
[ext_resource type="Texture2D" uid="uid://dieoh0r7a5try" path="res://Textures/Portraits/Pisces.jpg" id="1_id5nf"]
[ext_resource type="Script" path="res://Scripts/StageGUI.cs" id="1_wr2m0"]
[ext_resource type="Texture2D" uid="uid://2vog2nty4qrj" path="res://Textures/wheel.png" id="4_3jyfi"]
[sub_resource type="Animation" id="Animation_ptfpl"]
resource_name = "Rollover"
[sub_resource type="AnimationLibrary" id="AnimationLibrary_05shj"]
_data = {
"Rollover": SubResource("Animation_ptfpl")
}
[node name="StageGUI" type="Control"]
layout_mode = 3
@@ -13,6 +23,7 @@ offset_right = -59.0
offset_bottom = -36.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_wr2m0")
[node name="Placeholder1" type="ColorRect" parent="."]
custom_minimum_size = Vector2(410, 1080)
@@ -41,15 +52,48 @@ grow_horizontal = 0
grow_vertical = 2
color = Color(1, 0.447059, 1, 1)
[node name="P1_Portrait" type="TextureRect" parent="."]
[node name="CharacterSelect" type="Control" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="AnimationPlayer" type="AnimationPlayer" parent="CharacterSelect"]
libraries = {
"": SubResource("AnimationLibrary_05shj")
}
[node name="Wheel" type="TextureRect" parent="CharacterSelect"]
visible = false
layout_mode = 0
offset_left = 48.0
offset_top = 71.0
offset_right = 349.0
offset_bottom = 386.0
texture = ExtResource("4_3jyfi")
expand_mode = 1
[node name="Wheel2" type="TextureRect" parent="CharacterSelect"]
visible = false
layout_mode = 0
offset_left = 1570.0
offset_top = 84.0
offset_right = 1871.0
offset_bottom = 399.0
texture = ExtResource("4_3jyfi")
expand_mode = 1
[node name="P1_Portrait" type="TextureRect" parent="CharacterSelect"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 30.0
offset_top = 378.0
offset_top = 400.0
offset_right = -722.0
offset_bottom = 378.0
offset_bottom = 400.0
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(0.3, 0.3)
@@ -57,17 +101,27 @@ texture = ExtResource("1_id5nf")
expand_mode = 1
flip_h = true
[node name="P2_Portrait" type="TextureRect" parent="."]
[node name="P2_Portrait" type="TextureRect" parent="CharacterSelect"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 1545.0
offset_top = 404.0
offset_top = 400.0
offset_right = 793.0
offset_bottom = 404.0
offset_bottom = 400.0
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(0.3, 0.3)
texture = ExtResource("1_id5nf")
expand_mode = 1
[node name="Button" type="Button" parent="CharacterSelect"]
layout_mode = 0
offset_left = 64.0
offset_top = 774.0
offset_right = 336.0
offset_bottom = 889.0
text = "Character select"
[connection signal="pressed" from="CharacterSelect/Button" to="." method="OnCharacterSelect"]

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=14 format=3 uid="uid://dy3d4e6qegyjg"]
[ext_resource type="Script" path="res://Scripts/TestLevel.cs" id="1_blhn0"]
[ext_resource type="PackedScene" uid="uid://b38hcomu4tpm5" path="res://Scenes/TestCharacter.tscn" id="1_fwf6c"]
[ext_resource type="PackedScene" uid="uid://b38hcomu4tpm5" path="res://Scenes/PiscesWitch.tscn" id="1_fwf6c"]
[ext_resource type="PackedScene" uid="uid://bckd04543occ5" path="res://Levels/levelTEST.gltf" id="2_afl3s"]
[ext_resource type="PackedScene" uid="uid://dkjdt7uq3a4j3" path="res://Scenes/TestEnemy.tscn" id="3_ds7vi"]
[ext_resource type="PackedScene" uid="uid://si4byubqnng4" path="res://Scenes/TestBullet.tscn" id="3_lmb02"]

43
Scripts/GameManager.cs Normal file
View File

@@ -0,0 +1,43 @@
using Godot;
using Godot.Collections;
using System.Linq;
public partial class GameManager : Node
{
public bool IsP1SelectingCharacter = true;
public bool IsP2SelectingCharacter = true;
[Export]
private Array<PackedScene> _p1Characters;
[Export]
private Array<PackedScene> _p2Characters;
[Export]
public Character _p1SelectedCharacter;
[Export]
public Character _p2SelectedCharacter;
private int _p1CharacterIndex = 0;
private int _p2CharacterIndex = 0;
public void SetP1ToNextCharacter() => _p1CharacterIndex = (++_p1CharacterIndex) % _p1Characters.Count();
public void SetP1ToPreviousCharacter() => _p1CharacterIndex = _p1CharacterIndex == 0 ? _p1Characters.Count() : --_p1CharacterIndex;
public void OnP1CharacterSelected()
{
if (_p1SelectedCharacter != null)
_p1SelectedCharacter.QueueFree();
var selectedPlayer = _p1Characters[_p1CharacterIndex].Instantiate();
_p1SelectedCharacter = selectedPlayer as Character;
GetTree().Root.AddChild(_p1SelectedCharacter);
var playerSpawnPoint = GetNode<SpawnPoint>("P1SpawnPoint");
playerSpawnPoint.SetPlayerPosition(_p1SelectedCharacter);
}
}
public partial class Character : CharacterBody3D
{
}

View File

@@ -1,15 +0,0 @@
using Godot;
using System.Linq;
public partial class P1SpawnPoint : Marker3D
{
public override void _Ready()
{
var players = GetTree().GetNodesInGroup("Player1");
if (players.Any())
{
var player = (TestCharacter)players.First();
player.Position = Position;
}
}
}

View File

@@ -1,15 +0,0 @@
using Godot;
using System.Linq;
public partial class P2SpawnPoint : Marker3D
{
public override void _Ready()
{
var players = GetTree().GetNodesInGroup("Player2");
if (players.Any())
{
var player = (Player2)players.First();
player.Position = Position;
}
}
}

View File

@@ -1,6 +1,6 @@
using Godot;
public partial class TestCharacter : CharacterBody3D
public partial class Player1 : Character
{
[Export]
private float _speed = 5.0f;
@@ -9,29 +9,38 @@ public partial class TestCharacter : CharacterBody3D
[Export]
private PackedScene _altFireProjectile;
private GameManager _gameManager;
public bool CanShoot { get; private set; }
public override void _Ready()
{
CanShoot = true;
_gameManager = GetTree().Root.GetNode<GameManager>("Main/GameManager");
}
public override void _PhysicsProcess(double delta)
{
if (!_gameManager.IsP1SelectingCharacter)
{
Velocity = CalculateCharacterMovement(delta);
MoveAndSlide();
}
}
public override void _UnhandledInput(InputEvent @event)
{
if (Input.IsActionJustPressed("exit"))
GetTree().Quit();
if (!_gameManager.IsP1SelectingCharacter)
{
if (Input.IsActionJustPressed("p1_fire") && CanShoot)
Fire();
if (Input.IsActionJustPressed("p1_altfire") && CanShoot)
AltFire();
}
}
private Vector3 CalculateCharacterMovement(double delta)
{

10
Scripts/SpawnPoint.cs Normal file
View File

@@ -0,0 +1,10 @@
using Godot;
public partial class SpawnPoint : Marker3D
{
public void SetPlayerPosition(Character character)
{
GD.Print("Moving character to spawn point");
character.Position = Position;
}
}

47
Scripts/StageGUI.cs Normal file
View File

@@ -0,0 +1,47 @@
using Godot;
public partial class StageGUI : Control
{
[Signal]
public delegate void OnCharacterSelectionMadeEventHandler();
private GameManager _gameManager;
public override void _Ready()
{
_gameManager = GetTree().Root.GetNode<GameManager>("Main/GameManager");
}
public void OnCharacterSelect()
{
var wheel1 = GetNode<TextureRect>("CharacterSelect/Wheel");
var wheel2 = GetNode<TextureRect>("CharacterSelect/Wheel2");
wheel1.FocusMode = FocusModeEnum.All;
wheel1.GrabFocus();
wheel1.Visible = true;
_gameManager.IsP1SelectingCharacter = true;
}
public override void _Process(double delta)
{
var wheel1 = GetNode<TextureRect>("CharacterSelect/Wheel");
if (wheel1.HasFocus())
{
if (Input.IsActionJustPressed("p1_right"))
_gameManager.SetP1ToNextCharacter();
if (Input.IsActionJustPressed("p1_left"))
_gameManager.SetP1ToPreviousCharacter();
if (Input.IsActionJustPressed("p1_fire"))
{
GD.Print("Selected character");
wheel1.ReleaseFocus();
wheel1.Hide();
_gameManager.IsP1SelectingCharacter = false;
EmitSignal(SignalName.OnCharacterSelectionMade);
}
}
}
}

View File

@@ -9,7 +9,7 @@ public partial class TestEnemy : RigidBody3D
public override void _Process(double delta)
{
var player = GetTree().GetFirstNodeInGroup("Player") as TestCharacter;
var player = GetTree().GetFirstNodeInGroup("Player") as Player1;
if (player != null)
LookAt(player.Position);
}

View File

@@ -8,7 +8,7 @@ public partial class TestLevel : Node3D
public override void _Ready()
{
var players = GetTree().GetNodesInGroup("Player");
foreach (TestCharacter player in players)
foreach (Player1 player in players)
player.Transform = _spawnPoint.Transform;
}

BIN
Textures/wheel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

34
Textures/wheel.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://2vog2nty4qrj"
path="res://.godot/imported/wheel.png-792fa1e83a3b6c36b3fc88601a9fd08f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Textures/wheel.png"
dest_files=["res://.godot/imported/wheel.png-792fa1e83a3b6c36b3fc88601a9fd08f.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

@@ -198,6 +198,7 @@ mouse_filter = 2
color = Color(0, 0, 0, 1)
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
speed_scale = 64.0
libraries = {
"": SubResource("AnimationLibrary_iabf8")
}