added some icons for UI

pull/32/head
Sascha 2024-01-24 17:14:20 +07:00
parent a3bfbab270
commit 6b91f6ded8
26 changed files with 505 additions and 50 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ddikd6m3t7prw"
path="res://.godot/imported/generic_arrow_3.png-604ef2420be555018c588cbcb3d8f7c6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/generic_arrow_3.png"
dest_files=["res://.godot/imported/generic_arrow_3.png-604ef2420be555018c588cbcb3d8f7c6.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: 278 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bffseflkbu88e"
path="res://.godot/imported/generic_arrow_long.png-9035723ea35dbcfc24e22a18910772a7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/generic_arrow_long.png"
dest_files=["res://.godot/imported/generic_arrow_long.png-9035723ea35dbcfc24e22a18910772a7.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: 398 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cm7ru4t8ka3jn"
path="res://.godot/imported/keyboard_a.png-55bc9c150629b9f0992abde27a16be9c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/keyboard_a.png"
dest_files=["res://.godot/imported/keyboard_a.png-55bc9c150629b9f0992abde27a16be9c.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: 233 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c4l1soqbo0rud"
path="res://.godot/imported/keyboard_arrows.png-3f6c0a61ced4c85ebba49ae5cc4a7159.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/keyboard_arrows.png"
dest_files=["res://.godot/imported/keyboard_arrows.png-3f6c0a61ced4c85ebba49ae5cc4a7159.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: 367 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://uy20bgblsk4x"
path="res://.godot/imported/keyboard_d.png-895bd164acd04c40e6c184d6e2572823.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/keyboard_d.png"
dest_files=["res://.godot/imported/keyboard_d.png-895bd164acd04c40e6c184d6e2572823.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: 398 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dojdjls5b310j"
path="res://.godot/imported/keyboard_enter.png-5856048a4e779616811153cc1f978fcb.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/keyboard_enter.png"
dest_files=["res://.godot/imported/keyboard_enter.png-5856048a4e779616811153cc1f978fcb.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: 385 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dh4l4vkgkjxup"
path="res://.godot/imported/keyboard_escape.png-dba48fc566cf07dae1d84ab68c431966.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/keyboard_escape.png"
dest_files=["res://.godot/imported/keyboard_escape.png-dba48fc566cf07dae1d84ab68c431966.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: 405 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c2n36lnm2f5he"
path="res://.godot/imported/keyboard_s.png-5dc221fc8896155dff9a7e0fe05624ee.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/keyboard_s.png"
dest_files=["res://.godot/imported/keyboard_s.png-5dc221fc8896155dff9a7e0fe05624ee.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: 415 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dkc2vx71bnhdh"
path="res://.godot/imported/keyboard_space.png-d31aec3c784ba7fccaaf4975d2bf5a49.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/keyboard_space.png"
dest_files=["res://.godot/imported/keyboard_space.png-d31aec3c784ba7fccaaf4975d2bf5a49.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: 401 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bnh0rcsf30nrm"
path="res://.godot/imported/keyboard_w.png-48cdec668906ea6e1ec6fa0e40447b2b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/keyboard_w.png"
dest_files=["res://.godot/imported/keyboard_w.png-48cdec668906ea6e1ec6fa0e40447b2b.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

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 100 125" enable-background="new 0 0 100 100" xml:space="preserve"><g><path d="M50.7,59.2c0.4,0,0.9-0.1,1.2-0.3l16.3-7.7c1.4-0.7,2-2.4,1.3-3.8l-0.7-1.5c-0.5-1-1.5-1.6-2.6-1.6c-0.4,0-0.9,0.1-1.3,0.3 l-12.2,5.7l-5.8-12.1c-0.5-1-1.5-1.6-2.6-1.6c-0.4,0-0.9,0.1-1.3,0.3l-1.5,0.7c-1.4,0.7-2,2.4-1.3,3.8L48,57.6 C48.5,58.5,49.6,59.2,50.7,59.2z"/><path d="M88.7,42.1C86.1,30,73.5,17.5,61.3,14.8c-2.7-0.6-5.4-0.9-8.1-0.9c-0.3,0-0.7,0-1,0c-17.7,0.5-32.8,14.1-34.9,31.8 l-0.1,0.4h-4.5c-0.8,0-1.3,0.5-1.5,1c-0.3,0.6-0.5,1.6,0,2.6l8,9.4c0.9,1,2.1,1.6,3.3,1.6c1.2,0,2.4-0.6,3.3-1.6l7.7-9.2 c0,0,0.1-0.1,0.1-0.1c0.1-0.1,0.1-0.1,0.2-0.2c0,0,0.1-0.1,0.1-0.1c0.5-0.9,0.3-1.9,0-2.5c-0.4-0.7-1-1.1-1.6-1.1h-4.9l0.1-0.6 c2.2-12.2,12.3-21,24.7-21.4c0.3,0,0.6,0,1,0h0.4c14,0.2,25.6,11.8,25.8,25.8c0.1,7-2.6,13.7-7.5,18.7c-5,5-11.6,7.8-18.7,7.8h-2.3 c-1.4,0-2.6,1.2-2.6,2.6v5.1c0,1.4,1.2,2.6,2.6,2.6h2.5c11,0,21.3-4.9,28.2-13.4C88.5,64.4,91.1,53.2,88.7,42.1z"/></g><text x="0" y="115" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">Created by Luis Rodrigues</text><text x="0" y="120" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">from the Noun Project</text></svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

@ -1,4 +1,4 @@
[gd_scene load_steps=22 format=3 uid="uid://det8556rpxhbv"]
[gd_scene load_steps=32 format=3 uid="uid://det8556rpxhbv"]
[ext_resource type="PackedScene" uid="uid://tlr55u0gn20l" path="res://Packed-Scenes/PlayerShip.tscn" id="1_njb5h"]
[ext_resource type="Texture2D" uid="uid://cg6n1hh3lj7rn" path="res://Textures/tile_nebula_green_dff.png" id="2_43vix"]
@ -16,6 +16,16 @@
[ext_resource type="Script" path="res://Scripts/GameArea.cs" id="11_p0rh7"]
[ext_resource type="Script" path="res://Scripts/InputManager.cs" id="15_uovst"]
[ext_resource type="Script" path="res://Scripts/Ui.cs" id="15_xl7yx"]
[ext_resource type="Texture2D" uid="uid://ddikd6m3t7prw" path="res://Images/generic_arrow_3.png" id="17_1t6sc"]
[ext_resource type="Texture2D" uid="uid://bffseflkbu88e" path="res://Images/generic_arrow_long.png" id="18_b2vca"]
[ext_resource type="Texture2D" uid="uid://c4l1soqbo0rud" path="res://Images/keyboard_arrows.png" id="19_dpw4m"]
[ext_resource type="Texture2D" uid="uid://bnh0rcsf30nrm" path="res://Images/keyboard_w.png" id="20_3aqu5"]
[ext_resource type="Texture2D" uid="uid://cm7ru4t8ka3jn" path="res://Images/keyboard_a.png" id="21_of2rn"]
[ext_resource type="Texture2D" uid="uid://c2n36lnm2f5he" path="res://Images/keyboard_s.png" id="22_1rcux"]
[ext_resource type="Texture2D" uid="uid://uy20bgblsk4x" path="res://Images/keyboard_d.png" id="23_o81a8"]
[ext_resource type="Texture2D" uid="uid://dkc2vx71bnhdh" path="res://Images/keyboard_space.png" id="24_cuten"]
[ext_resource type="Texture2D" uid="uid://dojdjls5b310j" path="res://Images/keyboard_enter.png" id="25_u4r31"]
[ext_resource type="Texture2D" uid="uid://dh4l4vkgkjxup" path="res://Images/keyboard_escape.png" id="26_oxfmw"]
[sub_resource type="BoxShape3D" id="BoxShape3D_bw288"]
@ -153,7 +163,7 @@ rtlNextLevel = NodePath("VBoxLabels/rtlNextLevel")
rtlPoints = NodePath("VBoxLabels/rtlPoints")
labelGameOver = NodePath("VBoxGameOver/LabelGameOver")
buttonRestart = NodePath("VBoxGameOver/RestartButton")
rtlReachedPoints = NodePath("VBoxGameOver/rtlReachedPoints")
rtlReachedPoints = NodePath("")
healthBar = NodePath("VBoxHealth/HealthBar")
vBoxPause = NodePath("VBoxPause")
buttonResume = NodePath("VBoxPause/ButtonResume")
@ -210,10 +220,10 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 197.0
offset_top = 556.0
offset_right = 605.0
offset_bottom = 854.0
offset_left = 201.0
offset_top = 451.0
offset_right = 609.0
offset_bottom = 749.0
grow_horizontal = 2
grow_vertical = 2
@ -224,25 +234,36 @@ label_settings = SubResource("LabelSettings_dqsad")
horizontal_alignment = 1
vertical_alignment = 1
[node name="rtlReachedPoints" type="RichTextLabel" parent="Ui/VBoxGameOver"]
[node name="lblReachedPoints" type="Label" parent="Ui/VBoxGameOver"]
custom_minimum_size = Vector2(0, 100)
layout_mode = 2
size_flags_vertical = 3
bbcode_enabled = true
text = "[center]You have reached level 1 and 0 points![/center]"
text = "You have reached level 1 and 0 points!"
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 3
[node name="RestartButton" type="Button" parent="Ui/VBoxGameOver"]
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 6
button_mask = 5
shortcut = SubResource("Shortcut_soxs4")
text = "Restart"
icon = ExtResource("17_1t6sc")
[node name="VBoxPause" type="VBoxContainer" parent="Ui"]
offset_left = 195.5
offset_top = 647.0
offset_right = 603.5
offset_bottom = 788.0
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 205.0
offset_top = 451.0
offset_right = 613.0
offset_bottom = 672.0
grow_horizontal = 2
grow_vertical = 2
[node name="LabelPause" type="Label" parent="Ui/VBoxPause"]
layout_mode = 2
@ -252,20 +273,24 @@ horizontal_alignment = 1
vertical_alignment = 1
[node name="ButtonResume" type="Button" parent="Ui/VBoxPause"]
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 6
button_mask = 5
text = "Resume
"
icon = ExtResource("18_b2vca")
[node name="PauseRestartButton" type="Button" parent="Ui/VBoxPause"]
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 6
button_mask = 5
shortcut = SubResource("Shortcut_soxs4")
text = "Restart"
icon = ExtResource("17_1t6sc")
[node name="VBoxHealth" type="VBoxContainer" parent="Ui"]
offset_left = 330.0
@ -280,3 +305,75 @@ max_value = 10.0
value = 7.0
rounded = true
show_percentage = false
[node name="BoxHelp" type="BoxContainer" parent="Ui"]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = 635.0
offset_top = 12.0
offset_right = 787.0
offset_bottom = 212.0
grow_horizontal = 0
[node name="VBoxHelp" type="VBoxContainer" parent="Ui/BoxHelp"]
layout_mode = 2
[node name="HBoxMovement" type="HBoxContainer" parent="Ui/BoxHelp/VBoxHelp"]
layout_mode = 2
[node name="TextureArrowKeys" type="TextureRect" parent="Ui/BoxHelp/VBoxHelp/HBoxMovement"]
layout_mode = 2
texture = ExtResource("19_dpw4m")
[node name="TextureW" type="TextureRect" parent="Ui/BoxHelp/VBoxHelp/HBoxMovement"]
visible = false
layout_mode = 2
texture = ExtResource("20_3aqu5")
[node name="TextureA" type="TextureRect" parent="Ui/BoxHelp/VBoxHelp/HBoxMovement"]
visible = false
layout_mode = 2
texture = ExtResource("21_of2rn")
[node name="TextureS" type="TextureRect" parent="Ui/BoxHelp/VBoxHelp/HBoxMovement"]
visible = false
layout_mode = 2
texture = ExtResource("22_1rcux")
[node name="TextureD" type="TextureRect" parent="Ui/BoxHelp/VBoxHelp/HBoxMovement"]
visible = false
layout_mode = 2
texture = ExtResource("23_o81a8")
[node name="lblMovement" type="Label" parent="Ui/BoxHelp/VBoxHelp/HBoxMovement"]
layout_mode = 2
text = "Movement
"
[node name="HBoxShooting" type="HBoxContainer" parent="Ui/BoxHelp/VBoxHelp"]
layout_mode = 2
[node name="TextureSpace" type="TextureRect" parent="Ui/BoxHelp/VBoxHelp/HBoxShooting"]
layout_mode = 2
texture = ExtResource("24_cuten")
[node name="TextureEnter" type="TextureRect" parent="Ui/BoxHelp/VBoxHelp/HBoxShooting"]
visible = false
layout_mode = 2
texture = ExtResource("25_u4r31")
[node name="lblShooting" type="Label" parent="Ui/BoxHelp/VBoxHelp/HBoxShooting"]
layout_mode = 2
text = "Shooting"
[node name="HBoxPause" type="HBoxContainer" parent="Ui/BoxHelp/VBoxHelp"]
layout_mode = 2
[node name="TexturePause" type="TextureRect" parent="Ui/BoxHelp/VBoxHelp/HBoxPause"]
layout_mode = 2
texture = ExtResource("26_oxfmw")
[node name="lblPause" type="Label" parent="Ui/BoxHelp/VBoxHelp/HBoxPause"]
layout_mode = 2
text = "Pause"

@ -5,8 +5,41 @@ namespace GodotspaceShooter.Scripts;
public partial class InputManager : Node
{
private const string GAME_PAUSE = "Game_Pause";
private const string PLAYER_MOVE_FORWARD = "Player_Move_Forward";
private const string PLAYER_MOVE_BACKWARDS = "Player_Move_Backwards";
private const string PLAYER_MOVE_LEFT = "Player_Move_Left";
private const string PLAYER_MOVE_RIGHT = "Player_Move_Right";
private const string PLAYER_FIRE = "Player_Fire";
private Vector3 moveDirection;
private Vector3 rotationDirection;
public override void _UnhandledInput(InputEvent @event) {
//Pause
if (Input.IsActionJustReleased(GAME_PAUSE)) GameManager.Instance.GamePaused = GameManager.Instance.GamePaused switch { true => false, false => true };
//Movement
float moveVelocity = PlayerShip.Instance.MoveVelocity;
float rotVelocity = PlayerShip.Instance.RotationVelocity;
moveDirection = Vector3.Zero;
rotationDirection = Vector3.Zero;
if (Input.IsActionPressed(PLAYER_MOVE_FORWARD)) moveDirection = moveDirection with { Z = moveVelocity };
if (Input.IsActionJustPressed(PLAYER_MOVE_FORWARD)) rotationDirection = rotationDirection with { X = -rotVelocity };
if (Input.IsActionPressed(PLAYER_MOVE_BACKWARDS)) moveDirection = moveDirection with { Z = moveVelocity };
if (Input.IsActionJustPressed(PLAYER_MOVE_BACKWARDS)) rotationDirection = rotationDirection with { X = +rotVelocity };
if (Input.IsActionPressed(PLAYER_MOVE_LEFT)) moveDirection = moveDirection with { X = moveVelocity };
if (Input.IsActionJustPressed(PLAYER_MOVE_LEFT)) rotationDirection = rotationDirection with { Z = -rotVelocity * 2 };
if (Input.IsActionPressed(PLAYER_MOVE_RIGHT)) moveDirection = moveDirection with { X = moveVelocity };
if (Input.IsActionJustPressed(PLAYER_MOVE_RIGHT)) rotationDirection = rotationDirection with { Z = +rotVelocity * 2 };
if (Input.IsActionJustReleased(PLAYER_MOVE_LEFT) || Input.IsActionJustReleased(PLAYER_MOVE_RIGHT)) rotationDirection = Vector3.Zero;
PlayerShip.Instance.MoveDirection = moveDirection;
PlayerShip.Instance.RotationDirection = rotationDirection;
//Shooting
if (Input.IsActionJustPressed(PLAYER_FIRE)) PlayerShip.Instance.Shooting = true;
if (Input.IsActionJustReleased(PLAYER_FIRE)) PlayerShip.Instance.Shooting = false;
}
}

@ -4,14 +4,8 @@ namespace GodotspaceShooter.Scripts;
public partial class PlayerShip : Node3D {
private const float jetTimerMax = 0.5f;
private const float laserTimerMax = 1f;
private const string PLAYER_MOVE_FORWARD = "Player_Move_Forward";
private const string PLAYER_MOVE_BACKWARDS = "Player_Move_Backwards";
private const string PLAYER_MOVE_LEFT = "Player_Move_Left";
private const string PLAYER_MOVE_RIGHT = "Player_Move_Right";
private const string PLAYER_FIRE = "Player_Fire";
[Export] private CpuParticles3D cpulaser;
[Export] private PackedScene explosion;
[Export] private GpuParticles3D gpulaser;
@ -20,14 +14,17 @@ public partial class PlayerShip : Node3D {
[Export] private PackedScene laser;
private float laserTimer = laserTimerMax;
private Vector3 moveDir;
[Export] private float moveVelocity = 10f;
public float MoveVelocity => moveVelocity;
[Export] private float rotationVelocity = 15f;
public float RotationVelocity => rotationVelocity;
[Export] public RigidBody3D PlayerRb;
private Vector3 rotDir;
[Export] private float rotVelocity = 15f;
private bool shooting;
[Export] private Node3D shots;
public Vector3 MoveDirection { get; set; }
public Vector3 RotationDirection { get; set; }
public bool Shooting { get; set; }
public static PlayerShip Instance { get; private set; }
@ -37,24 +34,7 @@ public partial class PlayerShip : Node3D {
}
public override void _Process(double delta) {
if (GameManager.Instance.GameOver) return;
moveDir = Vector3.Zero;
rotDir = Vector3.Zero;
//Movement
if (Input.IsActionPressed(PLAYER_MOVE_FORWARD)) moveDir.Z -= moveVelocity;
if (Input.IsActionJustPressed(PLAYER_MOVE_FORWARD)) rotDir.X = -rotVelocity;
if (Input.IsActionPressed(PLAYER_MOVE_BACKWARDS)) moveDir.Z += moveVelocity;
if (Input.IsActionJustPressed(PLAYER_MOVE_BACKWARDS)) rotDir.X = +rotVelocity;
if (Input.IsActionPressed(PLAYER_MOVE_LEFT)) moveDir.X -= moveVelocity;
if (Input.IsActionJustPressed(PLAYER_MOVE_LEFT)) rotDir.Z = -rotVelocity * 2;
if (Input.IsActionPressed(PLAYER_MOVE_RIGHT)) moveDir.X += moveVelocity;
if (Input.IsActionJustPressed(PLAYER_MOVE_RIGHT)) rotDir.Z = +rotVelocity * 2;
if (Input.IsActionJustReleased(PLAYER_MOVE_LEFT) || Input.IsActionJustReleased(PLAYER_MOVE_RIGHT)) rotDir = Vector3.Zero;
//Fire
if (Input.IsActionJustPressed(PLAYER_FIRE))
if (Shooting)
if (laser.Instantiate() is Node3D shot) {
shot.Position = PlayerRb.Position + new Vector3(0f, 0f, 0.74f);
shots.AddChild(shot);
@ -64,9 +44,9 @@ public partial class PlayerShip : Node3D {
public override void _PhysicsProcess(double delta) {
//Movement
if (moveDir != Vector3.Zero) {
if (MoveDirection != Vector3.Zero) {
jet.Visible = true;
KinematicCollision3D collision = PlayerRb.MoveAndCollide(moveDir * (float)delta);
KinematicCollision3D collision = PlayerRb.MoveAndCollide(MoveDirection * (float)delta);
if (collision?.GetCollider() is Node3D collider) {
Node3D parent = collider.GetParent<Node3D>();
Vector3 collisionPosition = collision.GetPosition();
@ -86,7 +66,7 @@ public partial class PlayerShip : Node3D {
}
//Rotation
PlayerRb.RotationDegrees = rotDir;
PlayerRb.RotationDegrees = RotationDirection;
}
public void Explode(Vector3 collisionPosition) {

@ -0,0 +1,6 @@
<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<g>
<path stroke="none" fill="#FFFFFF" d="M12.6 18.1 L20.6 28.8 Q21.05 29.45 21 30.2 L20.35 31.45 Q19.75 32 19 32 L14 32 Q14 39.45 19.3 44.75 24.55 50 32 50 39.45 50 44.75 44.75 50 39.45 50 32 50 24.55 44.75 19.3 39.45 14 32 14 24.7 14 19.5 19.05 L15.85 14.25 Q22.65 8 32 8 41.95 8 49 15.05 56 22.05 56 32 56 41.95 49 49 41.95 56 32 56 22.05 56 15.05 49 8 41.95 8 32 L3 32 Q2.25 32 1.65 31.45 1.1 30.95 1 30.2 0.95 29.45 1.4 28.8 L9.4 18.1 Q9.8 17.6 10.4 17.4 11 17.25 11.6 17.4 12.2 17.6 12.6 18.1"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 638 B

@ -2,16 +2,16 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://b8gy1u2i0jkyd"
path="res://.godot/imported/restart.svg-98c792bd948b9b683b245e78c0930bfc.ctex"
uid="uid://d3tkfqng4erhj"
path="res://.godot/imported/generic_arrow_3.svg-b4290a859159fb8c7b12bda0e7002f2e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/restart.svg"
dest_files=["res://.godot/imported/restart.svg-98c792bd948b9b683b245e78c0930bfc.ctex"]
source_file="res://Scripts/generic_arrow_3.svg"
dest_files=["res://.godot/imported/generic_arrow_3.svg-b4290a859159fb8c7b12bda0e7002f2e.ctex"]
[params]