2.5D Demo Project for Mono C#
Co-authored-by: Stephen Agbete (Steph155) <bgsteph15@mail.com>
66
mono/2.5d/2.5D Demo (Mono C#).csproj
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{5CA791DB-5050-44D0-989B-41D559AB1D50}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<OutputPath>.mono/temp/bin/$(Configuration)</OutputPath>
|
||||
<RootNamespace>Empty.DMono</RootNamespace>
|
||||
<AssemblyName>2.5D Demo (Mono C#)</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<BaseIntermediateOutputPath>.mono/temp/obj</BaseIntermediateOutputPath>
|
||||
<IntermediateOutputPath>$(BaseIntermediateOutputPath)/$(Configuration)</IntermediateOutputPath>
|
||||
<ApiConfiguration Condition=" '$(Configuration)' != 'Release' ">Debug</ApiConfiguration>
|
||||
<ApiConfiguration Condition=" '$(Configuration)' == 'Release' ">Release</ApiConfiguration>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineConstants>$(GodotDefineConstants);GODOT;DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>$(GodotDefineConstants);GODOT;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Tools|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineConstants>$(GodotDefineConstants);GODOT;DEBUG;TOOLS;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="GodotSharp">
|
||||
<Private>False</Private>
|
||||
<HintPath>$(ProjectDir)/.mono/assemblies/$(ApiConfiguration)/GodotSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GodotSharpEditor" Condition=" '$(Configuration)' == 'Tools' ">
|
||||
<Private>False</Private>
|
||||
<HintPath>$(ProjectDir)/.mono/assemblies/$(ApiConfiguration)/GodotSharpEditor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="addons\node25d-cs\Basis25D.cs" />
|
||||
<Compile Include="addons\node25d-cs\Node25D.cs" />
|
||||
<Compile Include="addons\node25d-cs\ShadowMath25D.cs" />
|
||||
<Compile Include="addons\node25d-cs\Transform25D.cs" />
|
||||
<Compile Include="addons\node25d-cs\YSort25D.cs" />
|
||||
<Compile Include="assets\cube\CubeMath.cs" />
|
||||
<Compile Include="assets\player\PlayerMath25D.cs" />
|
||||
<Compile Include="assets\player\PlayerSprite.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
19
mono/2.5d/2.5D Demo (Mono C#).sln
Normal file
@@ -0,0 +1,19 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "2.5D Demo (Mono C#)", "2.5D Demo (Mono C#).csproj", "{5CA791DB-5050-44D0-989B-41D559AB1D50}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Tools|Any CPU = Tools|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5CA791DB-5050-44D0-989B-41D559AB1D50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5CA791DB-5050-44D0-989B-41D559AB1D50}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5CA791DB-5050-44D0-989B-41D559AB1D50}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5CA791DB-5050-44D0-989B-41D559AB1D50}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5CA791DB-5050-44D0-989B-41D559AB1D50}.Tools|Any CPU.ActiveCfg = Tools|Any CPU
|
||||
{5CA791DB-5050-44D0-989B-41D559AB1D50}.Tools|Any CPU.Build.0 = Tools|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
25
mono/2.5d/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Reflection;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("2.5D Demo (Mono C#)")]
|
||||
[assembly: AssemblyDescription("2.5D demo project for Godot, Mono C# version.")]
|
||||
[assembly: AssemblyConfiguration("Debug")]
|
||||
[assembly: AssemblyCompany("Godot")]
|
||||
[assembly: AssemblyProduct("Godot Demo Projects")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020 Aaron Franke, Godot Engine contributors")]
|
||||
[assembly: AssemblyTrademark("Godot Engine")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
19
mono/2.5d/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# 2.5D Demo Project (Mono C#)
|
||||
|
||||
This demo project is an example of how a 2.5D game could be created in Godot.
|
||||
|
||||
Controls: WASD to move, Space to jump, R to reset, and UIOPKL to change view modes.
|
||||
|
||||
Note: There is a GDScript version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/misc/2.5d).
|
||||
|
||||
## How does it work?
|
||||
|
||||
Custom node types are added in a Godot plugin to allow 2.5D objects. Node25D serves as the base for all 2.5D objects; its first child must be a Spatial, which is used to calculate its position. It also adds YSort25D to sort Node25D nodes, and ShadowMath25D for calculating a shadow.
|
||||
|
||||
It uses structs called Basis25D and Transform25D to calculate 2D positions from 3D ones. For getting a 3D position, this project uses KinematicBody and StaticBody (3D), but these only exist for math - the camera is 2D and all sprites are 2D. You are able to use any Spatial node for math.
|
||||
|
||||
To display the objects, add a Sprite or any other Node2D-derived children to your Node25D objects. Some nodes are unsuitable, such as 2D physics nodes. Keep in mind that the first child must be Spatial-derived for math purposes.
|
||||
|
||||
Several view modes are implemented, including top down, front side, 45 degree, isometric, and two oblique modes. To implement a different view angle, all you need to do is create a new Basis25D, use it in all your Node25D transforms, and of course create textures to display that object in 2D.
|
||||
|
||||
## Screenshots
|
||||
207
mono/2.5d/addons/node25d-cs/Basis25D.cs
Normal file
@@ -0,0 +1,207 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if GODOT_REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
using real_t = System.Single;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Basis25D structure for performing 2.5D transform math.
|
||||
/// Note: All code assumes that Y is UP in 3D, and DOWN in 2D.
|
||||
/// A top-down view has a Y axis component of (0, 0), with a Z axis component of (0, 1).
|
||||
/// For a front side view, Y is (0, -1) and Z is (0, 0).
|
||||
/// Remember that Godot's 2D mode has the Y axis pointing DOWN on the screen.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Basis25D : IEquatable<Basis25D>
|
||||
{
|
||||
// Also matrix columns, the directions to move on screen for each unit change in 3D.
|
||||
public Vector2 x;
|
||||
public Vector2 y;
|
||||
public Vector2 z;
|
||||
|
||||
// Also matrix rows, the parts of each vector that contribute to moving in a screen direction.
|
||||
// Setting a row to zero means no movement in that direction.
|
||||
public Vector3 Row0
|
||||
{
|
||||
get { return new Vector3(x.x, y.x, z.x); }
|
||||
set
|
||||
{
|
||||
x.x = value.x;
|
||||
y.x = value.y;
|
||||
z.x = value.z;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 Row1
|
||||
{
|
||||
get { return new Vector3(x.y, y.y, z.y); }
|
||||
set
|
||||
{
|
||||
x.y = value.x;
|
||||
y.y = value.y;
|
||||
z.y = value.z;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 this[int columnIndex]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (columnIndex)
|
||||
{
|
||||
case 0: return x;
|
||||
case 1: return y;
|
||||
case 2: return z;
|
||||
default: throw new IndexOutOfRangeException();
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (columnIndex)
|
||||
{
|
||||
case 0: x = value; return;
|
||||
case 1: y = value; return;
|
||||
case 2: z = value; return;
|
||||
default: throw new IndexOutOfRangeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public real_t this[int columnIndex, int rowIndex]
|
||||
{
|
||||
get
|
||||
{
|
||||
return this[columnIndex][rowIndex];
|
||||
}
|
||||
set
|
||||
{
|
||||
Vector2 v = this[columnIndex];
|
||||
v[rowIndex] = value;
|
||||
this[columnIndex] = v;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Basis25D _topDown = new Basis25D(1, 0, 0, 0, 0, 1);
|
||||
private static readonly Basis25D _frontSide = new Basis25D(1, 0, 0, -1, 0, 0);
|
||||
private static readonly Basis25D _fortyFive = new Basis25D(1, 0, 0, -0.70710678118f, 0, 0.70710678118f);
|
||||
private static readonly Basis25D _isometric = new Basis25D(0.86602540378f, 0.5f, 0, -1, -0.86602540378f, 0.5f);
|
||||
private static readonly Basis25D _obliqueY = new Basis25D(1, 0, -0.70710678118f, -0.70710678118f, 0, 1);
|
||||
private static readonly Basis25D _obliqueZ = new Basis25D(1, 0, 0, -1, -0.70710678118f, 0.70710678118f);
|
||||
|
||||
public static Basis25D TopDown { get { return _topDown; } }
|
||||
public static Basis25D FrontSide { get { return _frontSide; } }
|
||||
public static Basis25D FortyFive { get { return _fortyFive; } }
|
||||
public static Basis25D Isometric { get { return _isometric; } }
|
||||
public static Basis25D ObliqueY { get { return _obliqueY; } }
|
||||
public static Basis25D ObliqueZ { get { return _obliqueZ; } }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a Dimetric Basis25D from the angle between the Y axis and the others.
|
||||
/// Dimetric(Tau/3) or Dimetric(2.09439510239) is the same as Isometric.
|
||||
/// Try to keep this number away from a multiple of Tau/4 (or Pi/2) radians.
|
||||
/// </summary>
|
||||
/// <param name="angle">The angle, in radians, between the Y axis and the X/Z axes.</param>
|
||||
public static Basis25D Dimetric(real_t angle)
|
||||
{
|
||||
real_t sin = Mathf.Sin(angle);
|
||||
real_t cos = Mathf.Cos(angle);
|
||||
return new Basis25D(sin, -cos, 0, -1, -sin, -cos);
|
||||
}
|
||||
|
||||
// Constructors
|
||||
public Basis25D(Basis25D b)
|
||||
{
|
||||
x = b.x;
|
||||
y = b.y;
|
||||
z = b.z;
|
||||
}
|
||||
public Basis25D(Vector2 xAxis, Vector2 yAxis, Vector2 zAxis)
|
||||
{
|
||||
x = xAxis;
|
||||
y = yAxis;
|
||||
z = zAxis;
|
||||
}
|
||||
public Basis25D(real_t xx, real_t xy, real_t yx, real_t yy, real_t zx, real_t zy)
|
||||
{
|
||||
x = new Vector2(xx, xy);
|
||||
y = new Vector2(yx, yy);
|
||||
z = new Vector2(zx, zy);
|
||||
}
|
||||
|
||||
public static Basis25D operator *(Basis25D b, real_t s)
|
||||
{
|
||||
b.x *= s;
|
||||
b.y *= s;
|
||||
b.z *= s;
|
||||
return b;
|
||||
}
|
||||
|
||||
public static Basis25D operator /(Basis25D b, real_t s)
|
||||
{
|
||||
b.x /= s;
|
||||
b.y /= s;
|
||||
b.z /= s;
|
||||
return b;
|
||||
}
|
||||
|
||||
public static bool operator ==(Basis25D left, Basis25D right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Basis25D left, Basis25D right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Basis25D)
|
||||
{
|
||||
return Equals((Basis25D)obj);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Equals(Basis25D other)
|
||||
{
|
||||
return x.Equals(other.x) && y.Equals(other.y) && z.Equals(other.z);
|
||||
}
|
||||
|
||||
public bool IsEqualApprox(Basis25D other)
|
||||
{
|
||||
return x.IsEqualApprox(other.x) && y.IsEqualApprox(other.y) && z.IsEqualApprox(other.z);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return y.GetHashCode() ^ x.GetHashCode() ^ z.GetHashCode();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string s = String.Format("({0}, {1}, {2})", new object[]
|
||||
{
|
||||
x.ToString(),
|
||||
y.ToString(),
|
||||
z.ToString()
|
||||
});
|
||||
return s;
|
||||
}
|
||||
|
||||
public string ToString(string format)
|
||||
{
|
||||
string s = String.Format("({0}, {1}, {2})", new object[]
|
||||
{
|
||||
x.ToString(format),
|
||||
y.ToString(format),
|
||||
z.ToString(format)
|
||||
});
|
||||
return s;
|
||||
}
|
||||
}
|
||||
151
mono/2.5d/addons/node25d-cs/Node25D.cs
Normal file
@@ -0,0 +1,151 @@
|
||||
using Godot;
|
||||
using System;
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
using real_t = System.Single;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// This node converts a 3D position to 2D using a 2.5D transformation matrix.
|
||||
/// The transformation of its 2D form is controlled by its 3D child.
|
||||
/// </summary>
|
||||
[Tool]
|
||||
public class Node25D : Node2D, IComparable<Node25D>
|
||||
{
|
||||
/// <summary>
|
||||
/// The number of 2D units in one 3D unit. Ideally, but not necessarily, an integer.
|
||||
/// </summary>
|
||||
public const int SCALE = 32;
|
||||
|
||||
[Export] public Vector3 spatialPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (spatialNode == null)
|
||||
{
|
||||
spatialNode = GetChild<Spatial>(0);
|
||||
}
|
||||
return spatialNode.Translation;
|
||||
}
|
||||
set
|
||||
{
|
||||
transform25D.spatialPosition = value;
|
||||
if (spatialNode != null)
|
||||
{
|
||||
spatialNode.Translation = value;
|
||||
}
|
||||
else if (GetChildCount() > 0)
|
||||
{
|
||||
spatialNode = GetChild<Spatial>(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Spatial spatialNode;
|
||||
private Transform25D transform25D;
|
||||
|
||||
public Basis25D Basis25D
|
||||
{
|
||||
get { return transform25D.basis; }
|
||||
}
|
||||
|
||||
public Transform25D Transform25D
|
||||
{
|
||||
get { return transform25D; }
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Node25DReady();
|
||||
}
|
||||
|
||||
public override void _Process(real_t delta)
|
||||
{
|
||||
Node25DProcess();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this method in _Ready, or before Node25DProcess is run.
|
||||
/// </summary>
|
||||
protected void Node25DReady()
|
||||
{
|
||||
if (GetChildCount() > 0)
|
||||
{
|
||||
spatialNode = GetChild<Spatial>(0);
|
||||
}
|
||||
// Changing the basis here will change the default for all Node25D instances.
|
||||
transform25D = new Transform25D(Basis25D.FortyFive * SCALE);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this method in _Process, or whenever the position of this object changes.
|
||||
/// </summary>
|
||||
protected void Node25DProcess()
|
||||
{
|
||||
CheckViewMode();
|
||||
if (spatialNode != null)
|
||||
{
|
||||
transform25D.spatialPosition = spatialNode.Translation;
|
||||
}
|
||||
else if (GetChildCount() > 0)
|
||||
{
|
||||
spatialNode = GetChild<Spatial>(0);
|
||||
}
|
||||
GlobalPosition = transform25D.FlatPosition;
|
||||
}
|
||||
|
||||
private void CheckViewMode()
|
||||
{
|
||||
if (Input.IsActionJustPressed("top_down_mode"))
|
||||
{
|
||||
transform25D.basis = Basis25D.TopDown * SCALE;
|
||||
}
|
||||
else if (Input.IsActionJustPressed("front_side_mode"))
|
||||
{
|
||||
transform25D.basis = Basis25D.FrontSide * SCALE;
|
||||
}
|
||||
else if (Input.IsActionJustPressed("forty_five_mode"))
|
||||
{
|
||||
transform25D.basis = Basis25D.FortyFive * SCALE;
|
||||
}
|
||||
else if (Input.IsActionJustPressed("isometric_mode"))
|
||||
{
|
||||
transform25D.basis = Basis25D.Isometric * SCALE;
|
||||
}
|
||||
else if (Input.IsActionJustPressed("oblique_y_mode"))
|
||||
{
|
||||
transform25D.basis = Basis25D.ObliqueY * SCALE;
|
||||
}
|
||||
else if (Input.IsActionJustPressed("oblique_z_mode"))
|
||||
{
|
||||
transform25D.basis = Basis25D.ObliqueZ * SCALE;
|
||||
}
|
||||
}
|
||||
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
if (obj is Node25D)
|
||||
{
|
||||
return CompareTo((Node25D)obj);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int CompareTo(Node25D other)
|
||||
{
|
||||
real_t thisIndex = transform25D.spatialPosition.y + 0.001f * (transform25D.spatialPosition.x + transform25D.spatialPosition.z);
|
||||
real_t otherIndex = other.transform25D.spatialPosition.y + 0.001f * (other.transform25D.spatialPosition.x + other.transform25D.spatialPosition.z);
|
||||
real_t diff = thisIndex - otherIndex;
|
||||
if (diff > 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (diff < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
54
mono/2.5d/addons/node25d-cs/ShadowMath25D.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Godot;
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
using real_t = System.Single;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Adds a simple shadow below an object.
|
||||
/// Place this ShadowMath25D node as a child of a Shadow25D, which
|
||||
/// is below the target object in the scene tree (not as a child).
|
||||
/// </summary>
|
||||
[Tool]
|
||||
public class ShadowMath25D : KinematicBody
|
||||
{
|
||||
/// <summary>
|
||||
/// The maximum distance below objects that shadows will appear.
|
||||
/// </summary>
|
||||
public real_t shadowLength = 1000;
|
||||
private Node25D shadowRoot;
|
||||
private Spatial targetMath;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
shadowRoot = GetParent<Node25D>();
|
||||
int index = shadowRoot.GetPositionInParent();
|
||||
targetMath = shadowRoot.GetParent().GetChild<Node25D>(index - 1).GetChild<Spatial>(0);
|
||||
}
|
||||
|
||||
public override void _Process(real_t delta)
|
||||
{
|
||||
if (targetMath == null)
|
||||
{
|
||||
if (shadowRoot != null)
|
||||
{
|
||||
shadowRoot.Visible = false;
|
||||
}
|
||||
return; // Shadow is not in a valid place.
|
||||
}
|
||||
|
||||
Translation = targetMath.Translation;
|
||||
var k = MoveAndCollide(Vector3.Down * shadowLength);
|
||||
if (k == null)
|
||||
{
|
||||
shadowRoot.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
shadowRoot.Visible = true;
|
||||
GlobalTransform = Transform;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
131
mono/2.5d/addons/node25d-cs/Transform25D.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the 2D transformation from a 3D position and a Basis25D.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Transform25D : IEquatable<Transform25D>
|
||||
{
|
||||
// Public fields store information that is used to calculate the properties.
|
||||
|
||||
/// <summary>
|
||||
/// Controls how the 3D position is transformed into 2D.
|
||||
/// </summary>
|
||||
public Basis25D basis;
|
||||
|
||||
/// <summary>
|
||||
/// The 3D position of the object. Should be updated on every frame before everything else.
|
||||
/// </summary>
|
||||
public Vector3 spatialPosition;
|
||||
|
||||
// Public properties calculate on-the-fly.
|
||||
|
||||
/// <summary>
|
||||
/// The 2D transformation of this object. Slower than FlatPosition.
|
||||
/// </summary>
|
||||
public Transform2D FlatTransform
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Transform2D(0, FlatPosition);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The 2D position of this object.
|
||||
/// </summary>
|
||||
public Vector2 FlatPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
Vector2 pos = spatialPosition.x * basis.x;
|
||||
pos += spatialPosition.y * basis.y;
|
||||
pos += spatialPosition.z * basis.z;
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
|
||||
// Constructors
|
||||
public Transform25D(Transform25D transform25D)
|
||||
{
|
||||
basis = transform25D.basis;
|
||||
spatialPosition = transform25D.spatialPosition;
|
||||
}
|
||||
public Transform25D(Basis25D basis25D)
|
||||
{
|
||||
basis = basis25D;
|
||||
spatialPosition = Vector3.Zero;
|
||||
}
|
||||
public Transform25D(Basis25D basis25D, Vector3 position3D)
|
||||
{
|
||||
basis = basis25D;
|
||||
spatialPosition = position3D;
|
||||
}
|
||||
public Transform25D(Vector2 xAxis, Vector2 yAxis, Vector2 zAxis)
|
||||
{
|
||||
basis = new Basis25D(xAxis, yAxis, zAxis);
|
||||
spatialPosition = Vector3.Zero;
|
||||
}
|
||||
public Transform25D(Vector2 xAxis, Vector2 yAxis, Vector2 zAxis, Vector3 position3D)
|
||||
{
|
||||
basis = new Basis25D(xAxis, yAxis, zAxis);
|
||||
spatialPosition = position3D;
|
||||
}
|
||||
|
||||
public static bool operator ==(Transform25D left, Transform25D right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(Transform25D left, Transform25D right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Transform25D)
|
||||
{
|
||||
return Equals((Transform25D)obj);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Equals(Transform25D other)
|
||||
{
|
||||
return basis.Equals(other.basis) && spatialPosition.Equals(other.spatialPosition);
|
||||
}
|
||||
|
||||
public bool IsEqualApprox(Transform25D other)
|
||||
{
|
||||
return basis.IsEqualApprox(other.basis) && spatialPosition.IsEqualApprox(other.spatialPosition);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return basis.GetHashCode() ^ spatialPosition.GetHashCode();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string s = String.Format("({0}, {1})", new object[]
|
||||
{
|
||||
basis.ToString(),
|
||||
spatialPosition.ToString()
|
||||
});
|
||||
return s;
|
||||
}
|
||||
|
||||
public string ToString(string format)
|
||||
{
|
||||
string s = String.Format("({0}, {1})", new object[]
|
||||
{
|
||||
basis.ToString(format),
|
||||
spatialPosition.ToString(format)
|
||||
});
|
||||
return s;
|
||||
}
|
||||
}
|
||||
60
mono/2.5d/addons/node25d-cs/YSort25D.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using Godot;
|
||||
using System.Collections.Generic;
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
using real_t = System.Single;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Assigns Z-index values to Node25D children.
|
||||
/// </summary>
|
||||
[Tool] // Commented out because it sometimes crashes the editor when running the game...
|
||||
public class YSort25D : Node // Note: NOT Node2D, Node25D, or YSort
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether or not to automatically call Sort() in _Process().
|
||||
/// </summary>
|
||||
[Export]
|
||||
public bool sortEnabled = true;
|
||||
|
||||
public override void _Process(real_t delta)
|
||||
{
|
||||
if (sortEnabled)
|
||||
{
|
||||
Sort();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this method in _Process, or whenever you want to sort children.
|
||||
/// </summary>
|
||||
public void Sort()
|
||||
{
|
||||
var children = GetParent().GetChildren();
|
||||
if (children.Count > 4000)
|
||||
{
|
||||
GD.PrintErr("Sorting failed: Max number of YSort25D nodes is 4000.");
|
||||
}
|
||||
List<Node25D> node25dChildren = new List<Node25D>();
|
||||
|
||||
foreach (Node n in children)
|
||||
{
|
||||
if (n is Node25D node25d)
|
||||
{
|
||||
node25dChildren.Add(node25d);
|
||||
}
|
||||
}
|
||||
|
||||
node25dChildren.Sort();
|
||||
|
||||
int zIndex = -4000;
|
||||
for (int i = 0; i < node25dChildren.Count; i++)
|
||||
{
|
||||
node25dChildren[i].ZIndex = zIndex;
|
||||
// Increment by 2 each time, to allow for shadows in-between.
|
||||
// This does mean that we have a limit of 4000 total sorted Node25Ds.
|
||||
zIndex += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
mono/2.5d/addons/node25d-cs/icons/kinematic_body_25d.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/kinematic_body_25d.png-791432e863e44720a1390f5b1fbf09be.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/node25d-cs/icons/kinematic_body_25d.png"
|
||||
dest_files=[ "res://.import/kinematic_body_25d.png-791432e863e44720a1390f5b1fbf09be.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/addons/node25d-cs/icons/node_25d.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
34
mono/2.5d/addons/node25d-cs/icons/node_25d.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/node_25d.png-ecf0b5959e83c044c288582c27f3f4c9.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/node25d-cs/icons/node_25d.png"
|
||||
dest_files=[ "res://.import/node_25d.png-ecf0b5959e83c044c288582c27f3f4c9.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/addons/node25d-cs/icons/node_25d_icon.png
Normal file
|
After Width: | Height: | Size: 293 B |
34
mono/2.5d/addons/node25d-cs/icons/node_25d_icon.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/node_25d_icon.png-c9b692824a2a2a3ddca2c0df67f60add.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/node25d-cs/icons/node_25d_icon.png"
|
||||
dest_files=[ "res://.import/node_25d_icon.png-c9b692824a2a2a3ddca2c0df67f60add.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/addons/node25d-cs/icons/shadow_math_25d.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
34
mono/2.5d/addons/node25d-cs/icons/shadow_math_25d.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/shadow_math_25d.png-0cd88127f233ec7b6b2959e12e9f275a.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/node25d-cs/icons/shadow_math_25d.png"
|
||||
dest_files=[ "res://.import/shadow_math_25d.png-0cd88127f233ec7b6b2959e12e9f275a.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/addons/node25d-cs/icons/shadow_math_25d_icon.png
Normal file
|
After Width: | Height: | Size: 473 B |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/shadow_math_25d_icon.png-4dbc225f4d5f7ef06072b06e2f163301.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/node25d-cs/icons/shadow_math_25d_icon.png"
|
||||
dest_files=[ "res://.import/shadow_math_25d_icon.png-4dbc225f4d5f7ef06072b06e2f163301.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/addons/node25d-cs/icons/y_sort_25d.png
Normal file
|
After Width: | Height: | Size: 366 B |
34
mono/2.5d/addons/node25d-cs/icons/y_sort_25d.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/y_sort_25d.png-d7ffa1c0d05a9139ab514ec27ad8da9d.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/node25d-cs/icons/y_sort_25d.png"
|
||||
dest_files=[ "res://.import/y_sort_25d.png-d7ffa1c0d05a9139ab514ec27ad8da9d.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/addons/node25d-cs/icons/y_sort_25d_icon.png
Normal file
|
After Width: | Height: | Size: 241 B |
34
mono/2.5d/addons/node25d-cs/icons/y_sort_25d_icon.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/y_sort_25d_icon.png-852bb2b2c54661e1957a46372d9a6d8f.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/node25d-cs/icons/y_sort_25d_icon.png"
|
||||
dest_files=[ "res://.import/y_sort_25d_icon.png-852bb2b2c54661e1957a46372d9a6d8f.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
14
mono/2.5d/addons/node25d-cs/node25d_plugin.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
func _enter_tree():
|
||||
# When this plugin node enters tree, add the custom types
|
||||
add_custom_type("Node25D", "Node2D", preload("Node25D.cs"), preload("icons/node_25d_icon.png"))
|
||||
add_custom_type("YSort25D", "Node", preload("YSort25D.cs"), preload("icons/y_sort_25d_icon.png"))
|
||||
add_custom_type("ShadowMath25D", "KinematicBody", preload("ShadowMath25D.cs"), preload("icons/shadow_math_25d_icon.png"))
|
||||
|
||||
func _exit_tree():
|
||||
# When the plugin node exits the tree, remove the custom types
|
||||
remove_custom_type("ShadowMath25D")
|
||||
remove_custom_type("YSort25D")
|
||||
remove_custom_type("Node25D")
|
||||
7
mono/2.5d/addons/node25d-cs/plugin.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
[plugin]
|
||||
|
||||
name="Node25D (C#)"
|
||||
description="Adds Node25D"
|
||||
author="Aaron Franke"
|
||||
version="1.0"
|
||||
script="node25d_plugin.gd"
|
||||
72
mono/2.5d/assets/cube/CubeMath.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using Godot;
|
||||
|
||||
public class CubeMath : Spatial
|
||||
{
|
||||
private static PackedScene cubePointScene = ResourceLoader.Load<PackedScene>("res://assets/cube/cube_point.tscn");
|
||||
|
||||
private bool _isParentReady = false;
|
||||
private Node2D _parent;
|
||||
private Spatial[] _cubePointsMath = new Spatial[27]; // The math node of each 2.5D cube point
|
||||
private Spatial[] _cubeMathSpatials = new Spatial[27]; // The CubeMath children that find position.
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_parent = GetParent<Node2D>();
|
||||
|
||||
// Initialize the cube
|
||||
for (int i = 0; i < 27; i++)
|
||||
{
|
||||
int a = (i / 9) - 1;
|
||||
int b = (i / 3) % 3 - 1;
|
||||
int c = (i % 3) - 1;
|
||||
Vector3 spatialPosition = 5 * (a * Vector3.Right + b * Vector3.Up + c * Vector3.Back);
|
||||
|
||||
_cubeMathSpatials[i] = new Spatial();
|
||||
_cubeMathSpatials[i].Translation = spatialPosition;
|
||||
_cubeMathSpatials[i].Name = "CubeMath #" + i + ", " + a + " " + b + " " + c;
|
||||
AddChild(_cubeMathSpatials[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Process(float delta)
|
||||
{
|
||||
if (Input.IsActionPressed("exit"))
|
||||
{
|
||||
GetTree().Quit();
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed("view_cube_demo"))
|
||||
{
|
||||
GetTree().ChangeScene("res://assets/demo_scene.tscn");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_isParentReady)
|
||||
{
|
||||
RotateX(delta * (Input.GetActionStrength("move_back") - Input.GetActionStrength("move_forward")));
|
||||
RotateY(delta * (Input.GetActionStrength("move_right") - Input.GetActionStrength("move_left")));
|
||||
RotateZ(delta * (Input.GetActionStrength("move_counterclockwise") - Input.GetActionStrength("move_clockwise")));
|
||||
if (Input.IsActionJustPressed("reset_position"))
|
||||
{
|
||||
Transform = Transform.Identity;
|
||||
}
|
||||
for (int i = 0; i < 27; i++)
|
||||
{
|
||||
_cubePointsMath[i].GlobalTransform = _cubeMathSpatials[i].GlobalTransform;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// This code block will be run only once. It's not in _Ready() because the parent isn't set up there.
|
||||
for (int i = 0; i < 27; i++)
|
||||
{
|
||||
PackedScene myCubePointScene = cubePointScene.Duplicate(true) as PackedScene;
|
||||
Node25D cubePoint = myCubePointScene.Instance() as Node25D;
|
||||
cubePoint.Name = "CubePoint #" + i;
|
||||
_cubePointsMath[i] = cubePoint.GetChild<Spatial>(0);
|
||||
_parent.AddChild(cubePoint);
|
||||
}
|
||||
_isParentReady = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
mono/2.5d/assets/cube/cube.tscn
Normal file
@@ -0,0 +1,18 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/node25d-cs/YSort25D.cs" type="Script" id=1]
|
||||
[ext_resource path="res://assets/ui/overlay_cube.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://assets/cube/CubeMath.cs" type="Script" id=4]
|
||||
|
||||
[node name="Cube" type="Node2D"]
|
||||
|
||||
[node name="Overlay" parent="." instance=ExtResource( 3 )]
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
current = true
|
||||
|
||||
[node name="CubeMath" type="Spatial" parent="."]
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="YSort25D" type="Node" parent="."]
|
||||
script = ExtResource( 1 )
|
||||
17
mono/2.5d/assets/cube/cube_point.tscn
Normal file
@@ -0,0 +1,17 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/node25d-cs/Node25D.cs" type="Script" id=1]
|
||||
[ext_resource path="res://addons/node25d-cs/icons/node_25d_icon.png" type="Texture" id=2]
|
||||
[ext_resource path="res://assets/cube/godot.png" type="Texture" id=3]
|
||||
|
||||
[node name="CubePoint" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 2 )
|
||||
}
|
||||
spatialPosition = Vector3( 0, 0, 0 )
|
||||
|
||||
[node name="CubePointMath" type="Spatial" parent="."]
|
||||
|
||||
[node name="CubePointSprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 3 )
|
||||
BIN
mono/2.5d/assets/cube/godot.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
34
mono/2.5d/assets/cube/godot.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/godot.png-a942b208c71d1b44958f34d302d011ec.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/cube/godot.png"
|
||||
dest_files=[ "res://.import/godot.png-a942b208c71d1b44958f34d302d011ec.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
614
mono/2.5d/assets/demo_scene.tscn
Normal file
@@ -0,0 +1,614 @@
|
||||
[gd_scene load_steps=13 format=2]
|
||||
|
||||
[ext_resource path="res://addons/node25d-cs/YSort25D.cs" type="Script" id=1]
|
||||
[ext_resource path="res://assets/ui/overlay.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://assets/player/player_25d.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://assets/shadow/shadow_25d.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://addons/node25d-cs/Node25D.cs" type="Script" id=6]
|
||||
[ext_resource path="res://addons/node25d-cs/icons/node_25d_icon.png" type="Texture" id=7]
|
||||
[ext_resource path="res://assets/platform/textures/forty_five.png" type="Texture" id=8]
|
||||
[ext_resource path="res://assets/platform/platform_sprite.gd" type="Script" id=9]
|
||||
|
||||
[sub_resource type="BoxShape" id=1]
|
||||
extents = Vector3( 5, 0.5, 5 )
|
||||
|
||||
[sub_resource type="BoxShape" id=2]
|
||||
extents = Vector3( 5, 0.5, 5 )
|
||||
|
||||
[sub_resource type="BoxShape" id=3]
|
||||
extents = Vector3( 5, 0.5, 5 )
|
||||
|
||||
[sub_resource type="BoxShape" id=4]
|
||||
extents = Vector3( 5, 0.5, 5 )
|
||||
|
||||
[node name="DemoScene" type="Node2D"]
|
||||
|
||||
[node name="Overlay" parent="." instance=ExtResource( 3 )]
|
||||
|
||||
[node name="Player25D" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 0, -226.274 )
|
||||
z_index = -3952
|
||||
|
||||
[node name="Shadow25D" parent="." instance=ExtResource( 5 )]
|
||||
visible = true
|
||||
position = Vector2( 1.00261e-06, 11.2685 )
|
||||
z_index = -3958
|
||||
spatialPosition = Vector3( 3.13315e-08, -0.498, 3.13315e-08 )
|
||||
|
||||
[node name="Platform0" type="Node2D" parent="."]
|
||||
position = Vector2( -256, -113.137 )
|
||||
z_index = -3954
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( -8, 5, 0 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform0"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -8, 5, 0 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform0/PlatformMath"]
|
||||
shape = SubResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform0"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform1" type="Node2D" parent="."]
|
||||
position = Vector2( -256, -339.411 )
|
||||
z_index = -3956
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( -8, 5, -10 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform1"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -8, 5, -10 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform1/PlatformMath"]
|
||||
shape = SubResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform1"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform2" type="Node2D" parent="."]
|
||||
position = Vector2( 0, 22.6274 )
|
||||
z_index = -3962
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 0, -1, 0 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform2"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform2/PlatformMath"]
|
||||
shape = SubResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform2"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform3" type="Node2D" parent="."]
|
||||
position = Vector2( 320, 22.6274 )
|
||||
z_index = -3960
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 10, -1, 0 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform3"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10, -1, 0 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform3/PlatformMath"]
|
||||
shape = SubResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform3"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform4" type="Node2D" parent="."]
|
||||
position = Vector2( 0, -203.647 )
|
||||
z_index = -3966
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 0, -1, -10 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform4"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, -10 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform4/PlatformMath"]
|
||||
shape = SubResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform4"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform5" type="Node2D" parent="."]
|
||||
position = Vector2( 320, -113.137 )
|
||||
z_index = -3984
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 10, -5, -10 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform5"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10, -5, -10 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform5/PlatformMath"]
|
||||
shape = SubResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform5"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform6" type="Node2D" parent="."]
|
||||
position = Vector2( 320, 113.137 )
|
||||
z_index = -3980
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 10, -5, 0 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform6"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10, -5, 0 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform6/PlatformMath"]
|
||||
shape = SubResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform6"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform7" type="Node2D" parent="."]
|
||||
position = Vector2( 320, 339.411 )
|
||||
z_index = -3978
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 10, -5, 10 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform7"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10, -5, 10 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform7/PlatformMath"]
|
||||
shape = SubResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform7"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform8" type="Node2D" parent="."]
|
||||
position = Vector2( 320, 565.685 )
|
||||
z_index = -3976
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 10, -5, 20 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform8"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10, -5, 20 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform8/PlatformMath"]
|
||||
shape = SubResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform8"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform21" type="Node2D" parent="."]
|
||||
position = Vector2( 320, 791.96 )
|
||||
z_index = -3972
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 10, -5, 30 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform21"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10, -5, 30 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform21/PlatformMath"]
|
||||
shape = SubResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform21"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform22" type="Node2D" parent="."]
|
||||
position = Vector2( 320, 1018.23 )
|
||||
z_index = -3970
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 10, -5, 40 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform22"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10, -5, 40 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform22/PlatformMath"]
|
||||
shape = SubResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform22"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform9" type="Node2D" parent="."]
|
||||
position = Vector2( 640, 339.411 )
|
||||
z_index = -3974
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 20, -5, 10 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform9"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 20, -5, 10 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform9/PlatformMath"]
|
||||
shape = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform9"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform10" type="Node2D" parent="."]
|
||||
position = Vector2( 896, 294.156 )
|
||||
z_index = -3994
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 28, -10, 3 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform10"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 28, -10, 3 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform10/PlatformMath"]
|
||||
shape = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform10"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform11" type="Node2D" parent="."]
|
||||
position = Vector2( 896, 520.431 )
|
||||
z_index = -3990
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 28, -10, 13 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform11"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 28, -10, 13 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform11/PlatformMath"]
|
||||
shape = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform11"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform12" type="Node2D" parent="."]
|
||||
position = Vector2( 896, 746.705 )
|
||||
z_index = -3988
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 28, -10, 23 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform12"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 28, -10, 23 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform12/PlatformMath"]
|
||||
shape = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform12"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform13" type="Node2D" parent="."]
|
||||
position = Vector2( 576, 746.705 )
|
||||
z_index = -3992
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 18, -10, 23 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform13"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 18, -10, 23 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform13/PlatformMath"]
|
||||
shape = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform13"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform14" type="Node2D" parent="."]
|
||||
position = Vector2( 256, 746.705 )
|
||||
z_index = -3996
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( 8, -10, 23 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform14"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 8, -10, 23 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform14/PlatformMath"]
|
||||
shape = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform14"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform15" type="Node2D" parent="."]
|
||||
position = Vector2( -64, 746.705 )
|
||||
z_index = -3998
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( -2, -10, 23 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform15"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2, -10, 23 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform15/PlatformMath"]
|
||||
shape = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform15"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform23" type="Node2D" parent="."]
|
||||
position = Vector2( -384, 746.705 )
|
||||
z_index = -4000
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( -12, -10, 23 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform23"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -12, -10, 23 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform23/PlatformMath"]
|
||||
shape = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform23"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform16" type="Node2D" parent="."]
|
||||
position = Vector2( -320, 565.685 )
|
||||
z_index = -3982
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( -10, -5, 20 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform16"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -10, -5, 20 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform16/PlatformMath"]
|
||||
shape = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform16"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform19" type="Node2D" parent="."]
|
||||
position = Vector2( -320, 339.411 )
|
||||
z_index = -3986
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( -10, -5, 10 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform19"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -10, -5, 10 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform19/PlatformMath"]
|
||||
shape = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform19"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform17" type="Node2D" parent="."]
|
||||
position = Vector2( -480, 248.902 )
|
||||
z_index = -3964
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( -15, -1, 10 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform17"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -15, -1, 10 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform17/PlatformMath"]
|
||||
shape = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform17"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="Platform18" type="Node2D" parent="."]
|
||||
position = Vector2( -480, 22.6274 )
|
||||
z_index = -3968
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 7 )
|
||||
}
|
||||
spatialPosition = Vector3( -15, -1, 0 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="Platform18"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -15, -1, 0 )
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platform18/PlatformMath"]
|
||||
shape = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="Platform18"]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 8 )
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="YSort25D" type="Node" parent="."]
|
||||
script = ExtResource( 1 )
|
||||
32
mono/2.5d/assets/platform/platform.tscn
Normal file
@@ -0,0 +1,32 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://addons/node25d-cs/Node25D.cs" type="Script" id=1]
|
||||
[ext_resource path="res://addons/node25d-cs/icons/node_25d_icon.png" type="Texture" id=2]
|
||||
[ext_resource path="res://assets/platform/textures/forty_five.png" type="Texture" id=3]
|
||||
[ext_resource path="res://assets/platform/platform_sprite.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="BoxShape" id=1]
|
||||
extents = Vector3( 5, 0.5, 5 )
|
||||
|
||||
[node name="Platform" type="Node2D"]
|
||||
z_index = -3954
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 2 )
|
||||
}
|
||||
spatialPosition = Vector3( 0, 0, 0 )
|
||||
|
||||
[node name="PlatformMath" type="StaticBody" parent="."]
|
||||
collision_layer = 1048575
|
||||
collision_mask = 1048575
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="PlatformMath"]
|
||||
shape = SubResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlatformSprite" type="Sprite" parent="."]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 3 )
|
||||
script = ExtResource( 4 )
|
||||
39
mono/2.5d/assets/platform/platform_sprite.gd
Normal file
@@ -0,0 +1,39 @@
|
||||
tool
|
||||
extends Sprite
|
||||
|
||||
onready var _forty_five = preload("res://assets/platform/textures/forty_five.png")
|
||||
onready var _isometric = preload("res://assets/platform/textures/isometric.png")
|
||||
onready var _top_down = preload("res://assets/platform/textures/top_down.png")
|
||||
onready var _front_side = preload("res://assets/platform/textures/front_side.png")
|
||||
onready var _oblique_y = preload("res://assets/platform/textures/oblique_y.png")
|
||||
onready var _oblique_z = preload("res://assets/platform/textures/oblique_z.png")
|
||||
|
||||
func _process(_delta):
|
||||
if Input.is_action_pressed("forty_five_mode"):
|
||||
set_view_mode(0)
|
||||
elif Input.is_action_pressed("isometric_mode"):
|
||||
set_view_mode(1)
|
||||
elif Input.is_action_pressed("top_down_mode"):
|
||||
set_view_mode(2)
|
||||
elif Input.is_action_pressed("front_side_mode"):
|
||||
set_view_mode(3)
|
||||
elif Input.is_action_pressed("oblique_y_mode"):
|
||||
set_view_mode(4)
|
||||
elif Input.is_action_pressed("oblique_z_mode"):
|
||||
set_view_mode(5)
|
||||
|
||||
|
||||
func set_view_mode(view_mode_index):
|
||||
match view_mode_index:
|
||||
0: # 45 Degrees
|
||||
texture = _forty_five;
|
||||
1: # Isometric
|
||||
texture = _isometric
|
||||
2: # Top Down
|
||||
texture = _top_down
|
||||
3: # Front Side
|
||||
texture = _front_side
|
||||
4: # Oblique Y
|
||||
texture = _oblique_y
|
||||
5: # Oblique Z
|
||||
texture = _oblique_z
|
||||
BIN
mono/2.5d/assets/platform/textures/forty_five.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
34
mono/2.5d/assets/platform/textures/forty_five.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/forty_five.png-d90cd8ed1241c4a5270d87a83aafe24d.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/platform/textures/forty_five.png"
|
||||
dest_files=[ "res://.import/forty_five.png-d90cd8ed1241c4a5270d87a83aafe24d.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/assets/platform/textures/front_side.png
Normal file
|
After Width: | Height: | Size: 441 B |
34
mono/2.5d/assets/platform/textures/front_side.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/front_side.png-057b43bb7270572907c729580068368b.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/platform/textures/front_side.png"
|
||||
dest_files=[ "res://.import/front_side.png-057b43bb7270572907c729580068368b.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/assets/platform/textures/isometric.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
34
mono/2.5d/assets/platform/textures/isometric.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/isometric.png-364f65b60f600b10cfb048c20ea82124.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/platform/textures/isometric.png"
|
||||
dest_files=[ "res://.import/isometric.png-364f65b60f600b10cfb048c20ea82124.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/assets/platform/textures/oblique_y.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
34
mono/2.5d/assets/platform/textures/oblique_y.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/oblique_y.png-ed89b3ef35707993300443a84f7ebbd1.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/platform/textures/oblique_y.png"
|
||||
dest_files=[ "res://.import/oblique_y.png-ed89b3ef35707993300443a84f7ebbd1.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/assets/platform/textures/oblique_z.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
34
mono/2.5d/assets/platform/textures/oblique_z.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/oblique_z.png-270f041a55370c5ba68850a072597e97.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/platform/textures/oblique_z.png"
|
||||
dest_files=[ "res://.import/oblique_z.png-270f041a55370c5ba68850a072597e97.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/assets/platform/textures/top_down.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
34
mono/2.5d/assets/platform/textures/top_down.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/top_down.png-3df3f4c204d6337fdc9aa208196ed940.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/platform/textures/top_down.png"
|
||||
dest_files=[ "res://.import/top_down.png-3df3f4c204d6337fdc9aa208196ed940.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
96
mono/2.5d/assets/player/PlayerMath25D.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using Godot;
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
using real_t = System.Single;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Handles Player-specific behavior like moving. We calculate such things with KinematicBody.
|
||||
/// </summary>
|
||||
public class PlayerMath25D : KinematicBody
|
||||
{
|
||||
private Node25D _parent;
|
||||
public real_t verticalSpeed = 0;
|
||||
public bool isometricControls = true;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_parent = GetParent<Node25D>();
|
||||
}
|
||||
|
||||
public override void _Process(real_t delta)
|
||||
{
|
||||
if (Input.IsActionPressed("exit"))
|
||||
{
|
||||
GetTree().Quit();
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed("view_cube_demo"))
|
||||
{
|
||||
GetTree().ChangeScene("res://assets/cube/cube.tscn");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed("toggle_isometric_controls"))
|
||||
{
|
||||
isometricControls = !isometricControls;
|
||||
}
|
||||
|
||||
if (Input.IsActionPressed("reset_position"))
|
||||
{
|
||||
Transform = new Transform(Basis.Identity, Vector3.Up * 10);
|
||||
verticalSpeed = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
HorizontalMovement(delta);
|
||||
VerticalMovement(delta);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks WASD and Shift for horizontal movement via MoveAndSlide.
|
||||
/// </summary>
|
||||
private void HorizontalMovement(real_t delta)
|
||||
{
|
||||
Vector3 localX = Vector3.Right;
|
||||
Vector3 localZ = Vector3.Back;
|
||||
|
||||
if (isometricControls && _parent.Basis25D.x.IsEqualApprox(Basis25D.Isometric.x * Node25D.SCALE))
|
||||
{
|
||||
localX = new Vector3(0.70710678118f, 0, -0.70710678118f);
|
||||
localZ = new Vector3(0.70710678118f, 0, 0.70710678118f);
|
||||
}
|
||||
|
||||
// Gather player input and add directional movement to force Vector3 variables
|
||||
Vector3 moveDir = Vector3.Zero;
|
||||
moveDir += localX * (Input.GetActionStrength("move_right") - Input.GetActionStrength("move_left"));
|
||||
moveDir += localZ * (Input.GetActionStrength("move_back") - Input.GetActionStrength("move_forward"));
|
||||
|
||||
moveDir = moveDir.Normalized() * delta * 600;
|
||||
if (Input.IsActionPressed("movement_modifier"))
|
||||
{
|
||||
moveDir /= 2;
|
||||
}
|
||||
MoveAndSlide(moveDir);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks Jump and applies gravity and vertical speed via MoveAndCollide.
|
||||
/// </summary>
|
||||
/// <param name="delta">Time delta since last call</param>
|
||||
private void VerticalMovement(real_t delta)
|
||||
{
|
||||
if (Input.IsActionJustPressed("jump"))
|
||||
{
|
||||
verticalSpeed = 1.25f;
|
||||
}
|
||||
verticalSpeed -= delta * 5; // Gravity
|
||||
var k = MoveAndCollide(Vector3.Up * verticalSpeed);
|
||||
if (k != null)
|
||||
{
|
||||
verticalSpeed = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
229
mono/2.5d/assets/player/PlayerSprite.cs
Normal file
@@ -0,0 +1,229 @@
|
||||
using Godot;
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
using real_t = System.Single;
|
||||
#endif
|
||||
|
||||
public class PlayerSprite : Sprite
|
||||
{
|
||||
private static Texture _stand = ResourceLoader.Load<Texture>("res://assets/player/textures/stand.png");
|
||||
private static Texture _jump = ResourceLoader.Load<Texture>("res://assets/player/textures/jump.png");
|
||||
private static Texture _run = ResourceLoader.Load<Texture>("res://assets/player/textures/run.png");
|
||||
private const int FRAMERATE = 15;
|
||||
|
||||
private int _direction;
|
||||
private float _progress;
|
||||
private Node25D _parent;
|
||||
private PlayerMath25D _parentMath;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_parent = GetParent<Node25D>();
|
||||
_parentMath = _parent.GetChild<PlayerMath25D>(0);
|
||||
}
|
||||
|
||||
public override void _Process(real_t delta)
|
||||
{
|
||||
SpriteBasis();
|
||||
bool movement = CheckMovement(); // Always run to get direction, but don't always use return bool.
|
||||
|
||||
// Test-only move and collide, check if the player is on the ground.
|
||||
var k = _parentMath.MoveAndCollide(Vector3.Down * 10 * delta, true, true, true);
|
||||
if (k != null)
|
||||
{
|
||||
if (movement)
|
||||
{
|
||||
// TODO: https://github.com/godotengine/godot/issues/28748
|
||||
Hframes = 6;
|
||||
Texture = _run;
|
||||
if (Input.IsActionPressed("movement_modifier"))
|
||||
{
|
||||
delta /= 2;
|
||||
}
|
||||
_progress = (_progress + FRAMERATE * delta) % 6;
|
||||
Frame = _direction * 6 + (int)_progress;
|
||||
}
|
||||
else
|
||||
{
|
||||
Hframes = 1;
|
||||
Texture = _stand;
|
||||
_progress = 0;
|
||||
Frame = _direction;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Hframes = 2;
|
||||
Texture = _jump;
|
||||
_progress = 0;
|
||||
int jumping = _parentMath.verticalSpeed < 0 ? 1 : 0;
|
||||
Frame = _direction * 2 + jumping;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetViewMode(int viewModeIndex)
|
||||
{
|
||||
Transform2D t = Transform;
|
||||
switch (viewModeIndex)
|
||||
{
|
||||
case 0:
|
||||
t.x = new Vector2(1, 0);
|
||||
t.y = new Vector2(0, 0.75f);
|
||||
break;
|
||||
case 1:
|
||||
t.x = new Vector2(1, 0);
|
||||
t.y = new Vector2(0, 1);
|
||||
break;
|
||||
case 2:
|
||||
t.x = new Vector2(1, 0);
|
||||
t.y = new Vector2(0, 0.5f);
|
||||
break;
|
||||
case 3:
|
||||
t.x = new Vector2(1, 0);
|
||||
t.y = new Vector2(0, 1);
|
||||
break;
|
||||
case 4:
|
||||
t.x = new Vector2(1, 0);
|
||||
t.y = new Vector2(0.75f, 0.75f);
|
||||
break;
|
||||
case 5:
|
||||
t.x = new Vector2(1, 0.25f);
|
||||
t.y = new Vector2(0, 1);
|
||||
break;
|
||||
}
|
||||
Transform = t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change the basis of the sprite to try and make it fit multiple view modes.
|
||||
/// </summary>
|
||||
private void SpriteBasis()
|
||||
{
|
||||
if (Input.IsActionPressed("forty_five_mode"))
|
||||
{
|
||||
SetViewMode(0);
|
||||
}
|
||||
else if (Input.IsActionPressed("isometric_mode"))
|
||||
{
|
||||
SetViewMode(1);
|
||||
}
|
||||
else if (Input.IsActionPressed("top_down_mode"))
|
||||
{
|
||||
SetViewMode(2);
|
||||
}
|
||||
else if (Input.IsActionPressed("front_side_mode"))
|
||||
{
|
||||
SetViewMode(3);
|
||||
}
|
||||
else if (Input.IsActionPressed("oblique_y_mode"))
|
||||
{
|
||||
SetViewMode(4);
|
||||
}
|
||||
else if (Input.IsActionPressed("oblique_z_mode"))
|
||||
{
|
||||
SetViewMode(5);
|
||||
}
|
||||
}
|
||||
|
||||
// There might be a more efficient way to do this, but I can't think of it.
|
||||
private bool CheckMovement()
|
||||
{
|
||||
// Gather player input and store movement to these int variables. Note: These indeed have to be integers.
|
||||
int x = 0;
|
||||
int z = 0;
|
||||
|
||||
if (Input.IsActionPressed("move_right"))
|
||||
{
|
||||
x++;
|
||||
}
|
||||
if (Input.IsActionPressed("move_left"))
|
||||
{
|
||||
x--;
|
||||
}
|
||||
if (Input.IsActionPressed("move_forward"))
|
||||
{
|
||||
z--;
|
||||
}
|
||||
if (Input.IsActionPressed("move_back"))
|
||||
{
|
||||
z++;
|
||||
}
|
||||
|
||||
// Check for isometric controls and add more to movement accordingly.
|
||||
// For efficiency, only check the X axis since this X axis value isn't used anywhere else.
|
||||
if (!_parentMath.isometricControls && _parent.Basis25D.x.IsEqualApprox(Basis25D.Isometric.x * Node25D.SCALE))
|
||||
{
|
||||
if (Input.IsActionPressed("move_right"))
|
||||
{
|
||||
z++;
|
||||
}
|
||||
if (Input.IsActionPressed("move_left"))
|
||||
{
|
||||
z--;
|
||||
}
|
||||
if (Input.IsActionPressed("move_forward"))
|
||||
{
|
||||
x++;
|
||||
}
|
||||
if (Input.IsActionPressed("move_back"))
|
||||
{
|
||||
x--;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the direction based on which inputs were pressed.
|
||||
if (x == 0)
|
||||
{
|
||||
if (z == 0)
|
||||
{
|
||||
return false; // No movement
|
||||
}
|
||||
else if (z > 0)
|
||||
{
|
||||
_direction = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_direction = 4;
|
||||
}
|
||||
}
|
||||
else if (x > 0)
|
||||
{
|
||||
if (z == 0)
|
||||
{
|
||||
_direction = 2;
|
||||
FlipH = true;
|
||||
}
|
||||
else if (z > 0)
|
||||
{
|
||||
_direction = 1;
|
||||
FlipH = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_direction = 3;
|
||||
FlipH = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (z == 0)
|
||||
{
|
||||
_direction = 2;
|
||||
FlipH = false;
|
||||
}
|
||||
else if (z > 0)
|
||||
{
|
||||
_direction = 1;
|
||||
FlipH = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_direction = 3;
|
||||
FlipH = false;
|
||||
}
|
||||
}
|
||||
return true; // There is movement
|
||||
}
|
||||
}
|
||||
39
mono/2.5d/assets/player/player_25d.tscn
Normal file
@@ -0,0 +1,39 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://addons/node25d-cs/Node25D.cs" type="Script" id=1]
|
||||
[ext_resource path="res://addons/node25d-cs/icons/node_25d_icon.png" type="Texture" id=2]
|
||||
[ext_resource path="res://assets/player/PlayerMath25D.cs" type="Script" id=3]
|
||||
[ext_resource path="res://assets/player/textures/stand.png" type="Texture" id=4]
|
||||
[ext_resource path="res://assets/player/PlayerSprite.cs" type="Script" id=5]
|
||||
|
||||
[sub_resource type="BoxShape" id=1]
|
||||
extents = Vector3( 0.5, 1, 0.5 )
|
||||
|
||||
[node name="Player25D" type="Node2D"]
|
||||
position = Vector2( 0, -226.274 )
|
||||
z_index = 100
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 2 )
|
||||
}
|
||||
spatialPosition = Vector3( 0, 10, 0 )
|
||||
|
||||
[node name="PlayerMath25D" type="KinematicBody" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 0 )
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="PlayerMath25D"]
|
||||
shape = SubResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="PlayerSprite" type="Sprite" parent="."]
|
||||
scale = Vector2( 1, 0.75 )
|
||||
z_index = 1
|
||||
texture = ExtResource( 4 )
|
||||
vframes = 5
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="PlayerCamera" type="Camera2D" parent="PlayerSprite"]
|
||||
current = true
|
||||
BIN
mono/2.5d/assets/player/textures/jump.png
Executable file
|
After Width: | Height: | Size: 3.7 KiB |
34
mono/2.5d/assets/player/textures/jump.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/jump.png-ee91d86ec39d8c1dde239a382e843e86.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/player/textures/jump.png"
|
||||
dest_files=[ "res://.import/jump.png-ee91d86ec39d8c1dde239a382e843e86.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/assets/player/textures/run.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
34
mono/2.5d/assets/player/textures/run.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/run.png-6110949046e0632be1a9b1c8ac504217.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/player/textures/run.png"
|
||||
dest_files=[ "res://.import/run.png-6110949046e0632be1a9b1c8ac504217.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/assets/player/textures/stand.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
34
mono/2.5d/assets/player/textures/stand.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/stand.png-4d65e60dbd5f40d1f70da6aa2507ebe3.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/player/textures/stand.png"
|
||||
dest_files=[ "res://.import/stand.png-4d65e60dbd5f40d1f70da6aa2507ebe3.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
39
mono/2.5d/assets/shadow/shadow_25d.tscn
Normal file
@@ -0,0 +1,39 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://addons/node25d-cs/Node25D.cs" type="Script" id=1]
|
||||
[ext_resource path="res://addons/node25d-cs/icons/node_25d_icon.png" type="Texture" id=2]
|
||||
[ext_resource path="res://addons/node25d-cs/ShadowMath25D.cs" type="Script" id=3]
|
||||
[ext_resource path="res://addons/node25d-cs/icons/shadow_math_25d_icon.png" type="Texture" id=4]
|
||||
[ext_resource path="res://assets/shadow/textures/forty_five.png" type="Texture" id=5]
|
||||
[ext_resource path="res://assets/shadow/shadow_sprite.gd" type="Script" id=6]
|
||||
|
||||
[sub_resource type="BoxShape" id=1]
|
||||
extents = Vector3( 0.5, 0.001, 0.5 )
|
||||
|
||||
[node name="Shadow25D" type="Node2D"]
|
||||
visible = false
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 2 )
|
||||
}
|
||||
spatialPosition = Vector3( 0, 10, 0 )
|
||||
|
||||
[node name="ShadowMath25D" type="KinematicBody" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 0 )
|
||||
collision_layer = 16
|
||||
collision_mask = 16
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 4 )
|
||||
}
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="ShadowMath25D"]
|
||||
shape = SubResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="ShadowSprite" type="Sprite" parent="."]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
texture = ExtResource( 5 )
|
||||
script = ExtResource( 6 )
|
||||
39
mono/2.5d/assets/shadow/shadow_sprite.gd
Normal file
@@ -0,0 +1,39 @@
|
||||
tool
|
||||
extends Sprite
|
||||
|
||||
onready var _forty_five = preload("res://assets/shadow/textures/forty_five.png")
|
||||
onready var _isometric = preload("res://assets/shadow/textures/isometric.png")
|
||||
onready var _top_down = preload("res://assets/shadow/textures/top_down.png")
|
||||
onready var _front_side = preload("res://assets/shadow/textures/front_side.png")
|
||||
onready var _oblique_y = preload("res://assets/shadow/textures/oblique_y.png")
|
||||
onready var _oblique_z = preload("res://assets/shadow/textures/oblique_z.png")
|
||||
|
||||
func _process(_delta):
|
||||
if Input.is_action_pressed("forty_five_mode"):
|
||||
set_view_mode(0)
|
||||
elif Input.is_action_pressed("isometric_mode"):
|
||||
set_view_mode(1)
|
||||
elif Input.is_action_pressed("top_down_mode"):
|
||||
set_view_mode(2)
|
||||
elif Input.is_action_pressed("front_side_mode"):
|
||||
set_view_mode(3)
|
||||
elif Input.is_action_pressed("oblique_y_mode"):
|
||||
set_view_mode(4)
|
||||
elif Input.is_action_pressed("oblique_z_mode"):
|
||||
set_view_mode(5)
|
||||
|
||||
|
||||
func set_view_mode(view_mode_index):
|
||||
match view_mode_index:
|
||||
0: # 45 Degrees
|
||||
texture = _forty_five;
|
||||
1: # Isometric
|
||||
texture = _isometric
|
||||
2: # Top Down
|
||||
texture = _top_down
|
||||
3: # Front Side
|
||||
texture = _front_side
|
||||
4: # Oblique Y
|
||||
texture = _oblique_y
|
||||
5: # Oblique Z
|
||||
texture = _oblique_z
|
||||
BIN
mono/2.5d/assets/shadow/textures/forty_five.png
Normal file
|
After Width: | Height: | Size: 396 B |
34
mono/2.5d/assets/shadow/textures/forty_five.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/forty_five.png-22dcfa54db51531b3612f686997a3fbe.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/shadow/textures/forty_five.png"
|
||||
dest_files=[ "res://.import/forty_five.png-22dcfa54db51531b3612f686997a3fbe.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/assets/shadow/textures/front_side.png
Normal file
|
After Width: | Height: | Size: 84 B |
34
mono/2.5d/assets/shadow/textures/front_side.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/front_side.png-1470842d27848ecf4de63924b0b98f42.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/shadow/textures/front_side.png"
|
||||
dest_files=[ "res://.import/front_side.png-1470842d27848ecf4de63924b0b98f42.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/assets/shadow/textures/isometric.png
Normal file
|
After Width: | Height: | Size: 266 B |
34
mono/2.5d/assets/shadow/textures/isometric.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/isometric.png-1a91c869806816b66a8fb886d4801f31.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/shadow/textures/isometric.png"
|
||||
dest_files=[ "res://.import/isometric.png-1a91c869806816b66a8fb886d4801f31.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/assets/shadow/textures/oblique_y.png
Normal file
|
After Width: | Height: | Size: 353 B |
34
mono/2.5d/assets/shadow/textures/oblique_y.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/oblique_y.png-47d60a179a2cdeff15364f0e389e6008.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/shadow/textures/oblique_y.png"
|
||||
dest_files=[ "res://.import/oblique_y.png-47d60a179a2cdeff15364f0e389e6008.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/assets/shadow/textures/oblique_z.png
Normal file
|
After Width: | Height: | Size: 805 B |
34
mono/2.5d/assets/shadow/textures/oblique_z.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/oblique_z.png-d8378bf8b95f890e76162d62a82022de.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/shadow/textures/oblique_z.png"
|
||||
dest_files=[ "res://.import/oblique_z.png-d8378bf8b95f890e76162d62a82022de.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
BIN
mono/2.5d/assets/shadow/textures/top_down.png
Normal file
|
After Width: | Height: | Size: 87 B |
34
mono/2.5d/assets/shadow/textures/top_down.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/top_down.png-a3a98721249636eff54d8113d6075229.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/shadow/textures/top_down.png"
|
||||
dest_files=[ "res://.import/top_down.png-a3a98721249636eff54d8113d6075229.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
5
mono/2.5d/assets/ui/control_hints.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
extends Control
|
||||
|
||||
func _process(_delta):
|
||||
if Input.is_action_just_pressed("toggle_control_hints"):
|
||||
visible = !visible
|
||||
28
mono/2.5d/assets/ui/overlay.tscn
Normal file
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://assets/ui/control_hints.gd" type="Script" id=1]
|
||||
|
||||
[node name="Overlay" type="CanvasLayer"]
|
||||
|
||||
[node name="ControlHints" type="CenterContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
margin_bottom = 200.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Label" type="Label" parent="ControlHints"]
|
||||
margin_left = 348.0
|
||||
margin_top = 25.0
|
||||
margin_right = 1251.0
|
||||
margin_bottom = 175.0
|
||||
rect_min_size = Vector2( 500, 50 )
|
||||
text = "
|
||||
Controls: WASD to move, Space to jump, R to reset, Shift to walk, T to toggle isometric controls, C to view cube demo, Tab to toggle hints.
|
||||
|
||||
UIOJKL to change view mode. U = Forty Five deg, I = Isometric,
|
||||
O = Top Down, J = Front Side, K = Oblique Y, L = Oblique Z
|
||||
|
||||
Not every view mode is meant to be good, it's just to showcase what the system can do.
|
||||
In actual games, shadows, resizing, parallax, and other hints of depth could be added to make the world seem more 3D.
|
||||
"
|
||||
align = 1
|
||||
valign = 1
|
||||
28
mono/2.5d/assets/ui/overlay_cube.tscn
Normal file
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://assets/ui/control_hints.gd" type="Script" id=1]
|
||||
|
||||
[node name="Overlay" type="CanvasLayer"]
|
||||
|
||||
[node name="ControlHints" type="CenterContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
margin_bottom = 200.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Label" type="Label" parent="ControlHints"]
|
||||
margin_left = 416.0
|
||||
margin_top = 25.0
|
||||
margin_right = 1183.0
|
||||
margin_bottom = 175.0
|
||||
rect_min_size = Vector2( 500, 50 )
|
||||
text = "
|
||||
Controls: WASDQE to rotate, R to reset, C to return to the world, Tab to toggle hints.
|
||||
|
||||
UIOKL to change view mode. U = Forty Five deg, I = Isometric,
|
||||
O = Top Down, K = Oblique Y, L = Oblique Z
|
||||
|
||||
Not every view mode is meant to be good, it's just to showcase what the system can do.
|
||||
In actual games, shadows, resizing, parallax, and other hints of depth could be added to make the world seem more 3D.
|
||||
"
|
||||
align = 1
|
||||
valign = 1
|
||||
7
mono/2.5d/default_env.tres
Normal file
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
BIN
mono/2.5d/icon.png
Normal file
|
After Width: | Height: | Size: 262 B |
34
mono/2.5d/icon.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
169
mono/2.5d/project.godot
Normal file
@@ -0,0 +1,169 @@
|
||||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_class_icons={
|
||||
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="2.5D Demo (Mono C#)"
|
||||
run/main_scene="res://assets/demo_scene.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/width=1600
|
||||
window/size/height=900
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
enabled=PoolStringArray( "node25d-cs" )
|
||||
|
||||
[input]
|
||||
|
||||
move_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_forward={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_back={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
movement_modifier={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777348,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
jump={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777350,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
reset_position={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":82,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
forty_five_mode={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":85,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777354,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
isometric_mode={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":73,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777355,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
top_down_mode={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":79,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777356,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
front_side_mode={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":74,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777351,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
oblique_y_mode={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":75,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777352,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":4,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
oblique_z_mode={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":76,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777353,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":5,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
toggle_isometric_controls={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":84,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":8,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777349,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
toggle_control_hints={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777218,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777347,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":10,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_clockwise={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777359,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":7,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_counterclockwise={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":81,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777357,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
view_cube_demo={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":67,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777358,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
exit={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
quality/driver/driver_name="GLES2"
|
||||
environment/default_environment="res://default_env.tres"
|
||||