Compare commits
5 Commits
9aae6f7ca7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2bb5ec656 | ||
| f15e1031bd | |||
| 86b8ddc3f0 | |||
|
|
036651f2d3 | ||
|
|
622fb527a7 |
BIN
Models/Cookie.blend
Normal file
BIN
Models/Cookie.blend
Normal file
Binary file not shown.
48
Models/Cookie.blend.import
Normal file
48
Models/Cookie.blend.import
Normal file
@@ -0,0 +1,48 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://c4fnm4wmn7n83"
|
||||
path="res://.godot/imported/Cookie.blend-390d13d3a707da248d8fffd5b357a4cb.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Models/Cookie.blend"
|
||||
dest_files=["res://.godot/imported/Cookie.blend-390d13d3a707da248d8fffd5b357a4cb.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type="Node3D"
|
||||
nodes/root_name="Scene Root"
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/embedded_image_handling=1
|
||||
blender/nodes/visible=0
|
||||
blender/nodes/punctual_lights=true
|
||||
blender/nodes/cameras=true
|
||||
blender/nodes/custom_properties=true
|
||||
blender/nodes/modifiers=1
|
||||
blender/meshes/colors=false
|
||||
blender/meshes/uvs=true
|
||||
blender/meshes/normals=true
|
||||
blender/meshes/tangents=true
|
||||
blender/meshes/skins=2
|
||||
blender/meshes/export_bones_deforming_mesh_only=false
|
||||
blender/materials/unpack_enabled=true
|
||||
blender/materials/export_materials=1
|
||||
blender/animation/limit_playback=true
|
||||
blender/animation/always_sample=true
|
||||
blender/animation/group_tracks=true
|
||||
35
Models/Cookie.mtl
Normal file
35
Models/Cookie.mtl
Normal file
@@ -0,0 +1,35 @@
|
||||
# Blender MTL File: 'None'
|
||||
# Material Count: 3
|
||||
|
||||
newmtl Dress
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.800000 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd Dress.png
|
||||
|
||||
newmtl Nose
|
||||
Ns 442.408052
|
||||
Ka 0.486239 0.486239 0.486239
|
||||
Kd 0.800000 0.800000 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 3
|
||||
map_Kd Nose.png
|
||||
|
||||
newmtl Skin
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.800000 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd Face.png
|
||||
21
Models/Cookie.obj.import
Normal file
21
Models/Cookie.obj.import
Normal file
@@ -0,0 +1,21 @@
|
||||
[remap]
|
||||
|
||||
importer="wavefront_obj"
|
||||
importer_version=1
|
||||
type="Mesh"
|
||||
uid="uid://35saq7eyk446"
|
||||
path="res://.godot/imported/Cookie.obj-662f85ea2a0cd47351e12fab4abf9238.mesh"
|
||||
|
||||
[deps]
|
||||
|
||||
files=["res://.godot/imported/Cookie.obj-662f85ea2a0cd47351e12fab4abf9238.mesh"]
|
||||
|
||||
source_file="res://Models/Cookie.obj"
|
||||
dest_files=["res://.godot/imported/Cookie.obj-662f85ea2a0cd47351e12fab4abf9238.mesh", "res://.godot/imported/Cookie.obj-662f85ea2a0cd47351e12fab4abf9238.mesh"]
|
||||
|
||||
[params]
|
||||
|
||||
generate_tangents=true
|
||||
scale_mesh=Vector3(1, 1, 1)
|
||||
offset_mesh=Vector3(0, 0, 0)
|
||||
optimize_mesh=true
|
||||
BIN
Models/Dress Normal.png
Normal file
BIN
Models/Dress Normal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
34
Models/Dress Normal.png.import
Normal file
34
Models/Dress Normal.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://brk7dapt02cdp"
|
||||
path="res://.godot/imported/Dress Normal.png-fcd352e253c0095ddde3bced2677acc8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Models/Dress Normal.png"
|
||||
dest_files=["res://.godot/imported/Dress Normal.png-fcd352e253c0095ddde3bced2677acc8.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
Models/Dress.png
Normal file
BIN
Models/Dress.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
35
Models/Dress.png.import
Normal file
35
Models/Dress.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dkoq8pk0yalja"
|
||||
path.s3tc="res://.godot/imported/Dress.png-639684eb0ba0642d69cf79167b81396d.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Models/Dress.png"
|
||||
dest_files=["res://.godot/imported/Dress.png-639684eb0ba0642d69cf79167b81396d.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
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=0
|
||||
BIN
Models/Face.png
Normal file
BIN
Models/Face.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
35
Models/Face.png.import
Normal file
35
Models/Face.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dm1exmpufnv0n"
|
||||
path.s3tc="res://.godot/imported/Face.png-4e5b33e0b8d1173122b5b96cf5f1ee35.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Models/Face.png"
|
||||
dest_files=["res://.godot/imported/Face.png-4e5b33e0b8d1173122b5b96cf5f1ee35.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
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=0
|
||||
BIN
Models/Nose.png
Normal file
BIN
Models/Nose.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 117 B |
35
Models/Nose.png.import
Normal file
35
Models/Nose.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cbmo7tkrhbcu1"
|
||||
path.s3tc="res://.godot/imported/Nose.png-36a51257fe1234e1ddfcc686efd5ee83.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Models/Nose.png"
|
||||
dest_files=["res://.godot/imported/Nose.png-36a51257fe1234e1ddfcc686efd5ee83.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
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=0
|
||||
11
Models/Read Me.txt
Normal file
11
Models/Read Me.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
NJP here, here's is my C.Blair model! I made a more accurate model close to the game.
|
||||
|
||||
This Cookie Blair custom model is credited to me.
|
||||
|
||||
1. Do not use this model unless you ask for permission if it's a picture, video, etc.
|
||||
2. If you do use the model, please give credit to NJP.
|
||||
3. Fuck you Bradon White and your false DMCA's.
|
||||
|
||||
I'll have this rigged with more expression and clothes when I update this.
|
||||
|
||||
6/23/2023
|
||||
@@ -6,4 +6,9 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="Scenes\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Chickensoft.AutoInject" Version="1.3.0" />
|
||||
<PackageReference Include="Chickensoft.SuperNodes" Version="1.2.1" />
|
||||
<PackageReference Include="Chickensoft.SuperNodes.Types" Version="1.2.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,9 +0,0 @@
|
||||
<Project Sdk="Godot.NET.Sdk/4.1.0">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Scenes\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://ds2y8l8onrs4f"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://ds2y8l8onrs4f"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Blizzard.cs" id="1_rqtsv"]
|
||||
|
||||
@@ -9,11 +9,24 @@ albedo_color = Color(0.137255, 0.447059, 0.796078, 1)
|
||||
radial_segments = 4
|
||||
rings = 1
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_xe0sc"]
|
||||
|
||||
[node name="Blizzard" type="Node3D"]
|
||||
script = ExtResource("1_rqtsv")
|
||||
_projectileSpeed = 10.0
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
[node name="RigidBody3D" type="RigidBody3D" parent="."]
|
||||
collision_layer = 0
|
||||
collision_mask = 16
|
||||
mass = 0.01
|
||||
gravity_scale = 0.0
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.11373, 0)
|
||||
material_override = SubResource("StandardMaterial3D_pd0mo")
|
||||
mesh = SubResource("SphereMesh_g0pbs")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.11958, 0)
|
||||
shape = SubResource("SphereShape3D_xe0sc")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=15 format=3 uid="uid://bcsgd8vxy43g2"]
|
||||
[gd_scene load_steps=19 format=3 uid="uid://bcsgd8vxy43g2"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Player.cs" id="1_8dc05"]
|
||||
[ext_resource type="PackedScene" uid="uid://d20uxkpid4ynd" path="res://Models/vivi1.gltf" id="1_mqt2m"]
|
||||
@@ -7,6 +7,9 @@
|
||||
[ext_resource type="Script" path="res://Scripts/CameraSystem.cs" id="3_5ecw2"]
|
||||
[ext_resource type="PackedScene" uid="uid://c13g5orvyhy1p" path="res://Models/moogle.gltf" id="4_dckjs"]
|
||||
[ext_resource type="Script" path="res://Scripts/NPCFollow.cs" id="4_o5mpp"]
|
||||
[ext_resource type="Script" path="res://Scripts/DebugText.cs" id="8_ksx3s"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://35saq7eyk446" path="res://Models/Cookie.obj" id="8_p45nj"]
|
||||
[ext_resource type="Script" path="res://Scripts/Enemy.cs" id="9_0gfg2"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_8verc"]
|
||||
size = Vector3(100, 2, 100)
|
||||
@@ -31,6 +34,10 @@ albedo_color = Color(0.509804, 0.584314, 1, 1)
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ultw4"]
|
||||
albedo_color = Color(1, 1, 0, 1)
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_y33ih"]
|
||||
radius = 1.4
|
||||
height = 6.94546
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="."]
|
||||
@@ -109,3 +116,28 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.54678, 0.383205, 4.07192)
|
||||
material_override = SubResource("StandardMaterial3D_ultw4")
|
||||
use_collision = true
|
||||
size = Vector3(15.0266, 4.74018, 1)
|
||||
|
||||
[node name="DebugUI" type="Node2D" parent="."]
|
||||
|
||||
[node name="TextEdit" type="TextEdit" parent="DebugUI"]
|
||||
offset_right = 3468.0
|
||||
offset_bottom = 777.0
|
||||
script = ExtResource("8_ksx3s")
|
||||
|
||||
[node name="RigidBody3D" type="RigidBody3D" parent="."]
|
||||
collision_layer = 0
|
||||
collision_mask = 17
|
||||
max_contacts_reported = 10
|
||||
contact_monitor = true
|
||||
script = ExtResource("9_0gfg2")
|
||||
|
||||
[node name="Cookie" type="MeshInstance3D" parent="RigidBody3D"]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, -8.04457, -0.130408, -1.66095)
|
||||
mesh = ExtResource("8_p45nj")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, -8.04457, 0.690081, -1.66095)
|
||||
shape = SubResource("CapsuleShape3D_y33ih")
|
||||
|
||||
[connection signal="body_entered" from="RigidBody3D" to="RigidBody3D" method="OnHit"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dg7731nx22ewp"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dg7731nx22ewp"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Fireball.cs" id="1_4ipg4"]
|
||||
|
||||
@@ -7,12 +7,26 @@ albedo_color = Color(0.666667, 0, 0.239216, 1)
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_6bhr7"]
|
||||
|
||||
[node name="Fireball" type="Node3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.916843, 0)
|
||||
script = ExtResource("1_4ipg4")
|
||||
_projectileSpeed = 20.0
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_64t08"]
|
||||
radius = 0.51754
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.00392, 0)
|
||||
[node name="RigidBody3D" type="RigidBody3D"]
|
||||
collision_layer = 16
|
||||
gravity_scale = 0.0
|
||||
max_contacts_reported = 5
|
||||
contact_monitor = true
|
||||
script = ExtResource("1_4ipg4")
|
||||
_projectileSpeed = 10.0
|
||||
|
||||
[node name="Fireball" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.916843, 0)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Fireball"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0870771, 0)
|
||||
material_override = SubResource("StandardMaterial3D_jxwqo")
|
||||
mesh = SubResource("SphereMesh_6bhr7")
|
||||
skeleton = NodePath("../../..")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.00448, 0.081282)
|
||||
shape = SubResource("SphereShape3D_64t08")
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Blizzard : Projectile
|
||||
{
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Translate(new Godot.Vector3(0, 0, Speed * (float)delta));
|
||||
}
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Translate(new Vector3(0, 0, Speed * (float)delta));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,49 +2,49 @@ using Godot;
|
||||
|
||||
public partial class CameraSystem : SpringArm3D
|
||||
{
|
||||
[Export]
|
||||
private float _sensitivityHorizontal = 0.05f;
|
||||
[Export]
|
||||
private float _sensitivityVertical = 0.05f;
|
||||
[Export]
|
||||
private float _joystickDeadZone = 0.5f;
|
||||
[Export]
|
||||
private float _sensitivityHorizontal = 0.05f;
|
||||
[Export]
|
||||
private float _sensitivityVertical = 0.05f;
|
||||
[Export]
|
||||
private float _joystickDeadZone = 0.5f;
|
||||
|
||||
private Node3D _pivot;
|
||||
private CharacterBody3D _characterBody;
|
||||
private Node3D _pivot;
|
||||
private CharacterBody3D _characterBody;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_pivot = GetNode<Node3D>("/root/Main/Player/Pivot");
|
||||
_characterBody = GetNode<CharacterBody3D>("/root/Main/Player");
|
||||
}
|
||||
public override void _Ready()
|
||||
{
|
||||
_pivot = GetNode<Node3D>("/root/Main/Player/Pivot");
|
||||
_characterBody = GetNode<CharacterBody3D>("/root/Main/Player");
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
var joyRightX = Input.GetJoyAxis(0, JoyAxis.RightX);
|
||||
var joyRightY = Input.GetJoyAxis(0, JoyAxis.RightY);
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
var joyRightX = Input.GetJoyAxis(0, JoyAxis.RightX);
|
||||
var joyRightY = Input.GetJoyAxis(0, JoyAxis.RightY);
|
||||
|
||||
if (Mathf.Abs(joyRightX) > _joystickDeadZone)
|
||||
{
|
||||
var rotateAmount = joyRightX * _sensitivityHorizontal;
|
||||
_characterBody.RotateY(-rotateAmount);
|
||||
_pivot.RotateY(rotateAmount);
|
||||
}
|
||||
if (Mathf.Abs(joyRightX) > _joystickDeadZone)
|
||||
{
|
||||
var rotateAmount = joyRightX * _sensitivityHorizontal;
|
||||
_characterBody.RotateY(-rotateAmount);
|
||||
_pivot.RotateY(rotateAmount);
|
||||
}
|
||||
|
||||
if (Mathf.Abs(joyRightY) > _joystickDeadZone)
|
||||
{
|
||||
RotateX(joyRightY * _sensitivityVertical);
|
||||
Rotation = new Vector3(Mathf.Clamp(Rotation.X, -0.7f, 0.7f), Rotation.Y, Rotation.Z);
|
||||
}
|
||||
}
|
||||
if (Mathf.Abs(joyRightY) > _joystickDeadZone)
|
||||
{
|
||||
RotateX(joyRightY * _sensitivityVertical);
|
||||
Rotation = new Vector3(Mathf.Clamp(Rotation.X, -0.7f, 0.7f), Rotation.Y, Rotation.Z);
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (@event is InputEventMouseMotion mouseMotion)
|
||||
{
|
||||
_characterBody.RotateY(Mathf.DegToRad(-mouseMotion.Relative.X * _sensitivityHorizontal));
|
||||
_pivot.RotateY(Mathf.DegToRad(mouseMotion.Relative.X * _sensitivityHorizontal));
|
||||
RotateX(Mathf.DegToRad(mouseMotion.Relative.Y * _sensitivityVertical));
|
||||
Rotation = new Vector3(Mathf.Clamp(Rotation.X, -0.7f, 0.7f), Rotation.Y, Rotation.Z);
|
||||
}
|
||||
}
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (@event is InputEventMouseMotion mouseMotion)
|
||||
{
|
||||
_characterBody.RotateY(Mathf.DegToRad(-mouseMotion.Relative.X * _sensitivityHorizontal));
|
||||
_pivot.RotateY(Mathf.DegToRad(mouseMotion.Relative.X * _sensitivityHorizontal));
|
||||
RotateX(Mathf.DegToRad(mouseMotion.Relative.Y * _sensitivityVertical));
|
||||
Rotation = new Vector3(Mathf.Clamp(Rotation.X, -0.7f, 0.7f), Rotation.Y, Rotation.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
15
Scripts/DebugText.cs
Normal file
15
Scripts/DebugText.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Godot;
|
||||
|
||||
public partial class DebugText : TextEdit
|
||||
{
|
||||
private Player _playerNode;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_playerNode = GetNode<Player>("/root/Main/Player");
|
||||
}
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Text = $"Can Shoot: {_playerNode.CanShoot}";
|
||||
}
|
||||
}
|
||||
13
Scripts/Enemy.cs
Normal file
13
Scripts/Enemy.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Enemy : Node
|
||||
{
|
||||
public void OnHit(Variant body)
|
||||
{
|
||||
if (body.Obj is Projectile)
|
||||
{
|
||||
GD.Print("Hit");
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Fireball : Projectile
|
||||
{
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Translate(new Godot.Vector3(0, 0, Speed * (float)delta));
|
||||
Translate(new Vector3(0, 0, Speed * (float)delta));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ public partial class Player : CharacterBody3D
|
||||
[Export]
|
||||
private Array<PackedScene> _projectiles;
|
||||
|
||||
public bool CanShoot { get; private set; }
|
||||
|
||||
private Node3D _cameraMount;
|
||||
private Node3D _pivot;
|
||||
private Node3D _camera;
|
||||
@@ -32,19 +34,20 @@ public partial class Player : CharacterBody3D
|
||||
_camera = GetNode<Node3D>("/root/Main/Player/CameraMount/Camera");
|
||||
_pivot = GetNode<Node3D>("/root/Main/Player/Pivot");
|
||||
_weaponType = _projectiles.First();
|
||||
CanShoot = true;
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Input.IsActionJustPressed("quit"))
|
||||
GetTree().Quit();
|
||||
if (Input.IsActionJustPressed("shoot"))
|
||||
if (Input.IsActionJustPressed("shoot") && CanShoot)
|
||||
Shoot();
|
||||
if (Input.IsActionJustPressed("switch"))
|
||||
SwitchWeaponType();
|
||||
}
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
var gravityDelta = _gravity * (float)delta;
|
||||
var velocity = CalculateMovement(Velocity, Transform, gravityDelta);
|
||||
@@ -53,19 +56,25 @@ public partial class Player : CharacterBody3D
|
||||
MoveAndSlide();
|
||||
}
|
||||
|
||||
private void Shoot()
|
||||
private async void Shoot()
|
||||
{
|
||||
GD.Print("Shoot");
|
||||
var projectile = _weaponType.Instantiate<Node3D>();
|
||||
var projectile = _weaponType.Instantiate<Projectile>();
|
||||
projectile.Position = Position;
|
||||
projectile.Rotation = Rotation;
|
||||
GetParent().AddChild(projectile);
|
||||
CanShoot = false;
|
||||
await ToSignal(GetTree().CreateTimer(projectile.Cooldown), "timeout");
|
||||
CanShoot = true;
|
||||
}
|
||||
|
||||
private void SwitchWeaponType()
|
||||
private async void SwitchWeaponType()
|
||||
{
|
||||
var index = _projectiles.IndexOf(_weaponType);
|
||||
_weaponType = _projectiles[(index + 1) % _projectiles.Count];
|
||||
CanShoot = false;
|
||||
await ToSignal(GetTree().CreateTimer(.5), "timeout");
|
||||
CanShoot = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
public partial class Projectile : Node3D
|
||||
{
|
||||
[Export]
|
||||
private float _projectileSpeed = 0.1f;
|
||||
public double Cooldown { get; protected set; }
|
||||
|
||||
[Export]
|
||||
private float _projectileSpeed = 100f;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
@@ -11,4 +14,9 @@ public partial class Projectile : Node3D
|
||||
}
|
||||
|
||||
public float Speed { get; private set; }
|
||||
|
||||
public void OnTimeToLiveTimeout()
|
||||
{
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Sandbox.Scripts
|
||||
{
|
||||
internal enum WeaponType
|
||||
{
|
||||
Fire = 0,
|
||||
Blizzard = 1
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ config_version=5
|
||||
|
||||
config/name="Sandbox"
|
||||
run/main_scene="res://Scenes/Main.tscn"
|
||||
config/features=PackedStringArray("4.0", "C#", "Forward Plus")
|
||||
config/features=PackedStringArray("4.1", "C#", "Forward Plus")
|
||||
|
||||
[dotnet]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user