restore
parent
efb6492b1c
commit
d439e799ea
@ -1,2 +1,17 @@
|
||||
# ---> Godot
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
|
||||
# Godot-specific ignores
|
||||
.import/
|
||||
export.cfg
|
||||
export_presets.cfg
|
||||
|
||||
# Imported translations (automatically generated from CSV files)
|
||||
*.translation
|
||||
|
||||
# Mono-specific ignores
|
||||
.mono/
|
||||
data_*/
|
||||
mono_crash.*.json
|
||||
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Godot.NET.Sdk/4.3.0-dev.2">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net7.0</TargetFramework>
|
||||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'ios' ">net8.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
<RootNamespace>DRPGActionGame</RootNamespace>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@ -0,0 +1,19 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "3D RPG Action Game", "3D RPG Action Game.csproj", "{923D1DFA-79CB-4C22-A426-54548B47EBA8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
ExportDebug|Any CPU = ExportDebug|Any CPU
|
||||
ExportRelease|Any CPU = ExportRelease|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{923D1DFA-79CB-4C22-A426-54548B47EBA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{923D1DFA-79CB-4C22-A426-54548B47EBA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{923D1DFA-79CB-4C22-A426-54548B47EBA8}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
|
||||
{923D1DFA-79CB-4C22-A426-54548B47EBA8}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
|
||||
{923D1DFA-79CB-4C22-A426-54548B47EBA8}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
|
||||
{923D1DFA-79CB-4C22-A426-54548B47EBA8}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@ -0,0 +1,42 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Player : CharacterBody3D
|
||||
{
|
||||
public const float Speed = 5.0f;
|
||||
public const float JumpVelocity = 4.5f;
|
||||
|
||||
// Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||
public float gravity = ProjectSettings.GetSetting("physics/3d/default_gravity").AsSingle();
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Vector3 velocity = Velocity;
|
||||
|
||||
// Add the gravity.
|
||||
if (!IsOnFloor())
|
||||
velocity.Y -= gravity * (float)delta;
|
||||
|
||||
// Handle Jump.
|
||||
if (Input.IsActionJustPressed("ui_accept") && IsOnFloor())
|
||||
velocity.Y = JumpVelocity;
|
||||
|
||||
// Get the input direction and handle the movement/deceleration.
|
||||
// As good practice, you should replace UI actions with custom gameplay actions.
|
||||
Vector2 inputDir = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down");
|
||||
Vector3 direction = (Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y)).Normalized();
|
||||
if (direction != Vector3.Zero)
|
||||
{
|
||||
velocity.X = direction.X * Speed;
|
||||
velocity.Z = direction.Z * Speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
velocity.X = Mathf.MoveToward(Velocity.X, 0, Speed);
|
||||
velocity.Z = Mathf.MoveToward(Velocity.Z, 0, Speed);
|
||||
}
|
||||
|
||||
Velocity = velocity;
|
||||
MoveAndSlide();
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@
|
||||
# 3D_RPG_Action_Game
|
||||
|
||||
Tutorial by freeCodeCamp.org
|
||||
https://www.youtube.com/watch?v=F2TL525KkiM
|
||||
@ -0,0 +1,42 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dfy2rn0ryl0gw"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://Player/Player.tscn" id="1_ks6w4"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_lcthy"]
|
||||
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
|
||||
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
|
||||
|
||||
[sub_resource type="Sky" id="Sky_sl70d"]
|
||||
sky_material = SubResource("ProceduralSkyMaterial_lcthy")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_a428g"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_sl70d")
|
||||
tonemap_mode = 2
|
||||
glow_enabled = true
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_fdw8w"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_aivjm"]
|
||||
size = Vector3(50, 1, 50)
|
||||
|
||||
[node name="World" type="Node3D"]
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_a428g")
|
||||
|
||||
[node name="Sun" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(-0.866025, -0.433013, 0.25, 0, 0.5, 0.866025, -0.5, 0.75, -0.433013, 0, 0, 0)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("1_ks6w4")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.71919, 2.07103, 0)
|
||||
|
||||
[node name="Floor" type="StaticBody3D" parent="."]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Floor"]
|
||||
transform = Transform3D(50, 0, 0, 0, 1, 0, 0, 0, 50, 0, 0, 0)
|
||||
mesh = SubResource("BoxMesh_fdw8w")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor"]
|
||||
shape = SubResource("BoxShape3D_aivjm")
|
||||
Loading…
Reference in New Issue