mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Add PhysicsBehavior support to newIDE, with an example
This commit is contained in:
3
.vscode/c_cpp_properties.json
vendored
3
.vscode/c_cpp_properties.json
vendored
@@ -13,6 +13,7 @@
|
||||
"/usr/local/lib/wx/include/osx_cocoa-unicode-3.0",
|
||||
"/usr/local/include/wx-3.0",
|
||||
"/usr/include/machine",
|
||||
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include",
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
|
||||
"/usr/local/include",
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.0.0/include",
|
||||
@@ -86,4 +87,4 @@
|
||||
}
|
||||
],
|
||||
"version": 3
|
||||
}
|
||||
}
|
||||
|
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -67,7 +67,10 @@
|
||||
"__functional_base": "cpp",
|
||||
"__functional_base_03": "cpp",
|
||||
"chrono": "cpp",
|
||||
"ratio": "cpp"
|
||||
"ratio": "cpp",
|
||||
"atomic": "cpp",
|
||||
"locale": "cpp",
|
||||
"string_view": "cpp"
|
||||
},
|
||||
"files.exclude": {
|
||||
"Binaries/*build*": true,
|
||||
|
@@ -37,9 +37,7 @@ IF (NOT EMSCRIPTEN)
|
||||
ADD_SUBDIRECTORY(PathBehavior)
|
||||
ENDIF()
|
||||
ADD_SUBDIRECTORY(PathfindingBehavior)
|
||||
IF (NOT EMSCRIPTEN)
|
||||
ADD_SUBDIRECTORY(PhysicsBehavior)
|
||||
ENDIF()
|
||||
ADD_SUBDIRECTORY(PhysicsBehavior)
|
||||
ADD_SUBDIRECTORY(PlatformBehavior)
|
||||
ADD_SUBDIRECTORY(PrimitiveDrawing)
|
||||
ADD_SUBDIRECTORY(Shopify)
|
||||
|
@@ -10,36 +10,36 @@ This project is released under the MIT License.
|
||||
#include "PathfindingBehavior.h"
|
||||
#include "PathfindingObstacleBehavior.h"
|
||||
|
||||
void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension)
|
||||
{
|
||||
extension.SetExtensionInformation("PathfindingBehavior",
|
||||
_("Pathfinding behavior"),
|
||||
_("Compute paths for objects avoiding obstacles."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)");
|
||||
_("Pathfinding behavior"),
|
||||
_("Compute paths for objects avoiding obstacles."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)");
|
||||
|
||||
{
|
||||
gd::BehaviorMetadata &aut = extension.AddBehavior("PathfindingBehavior",
|
||||
_("Pathfinding"),
|
||||
"Pathfinding",
|
||||
_("With this, characters will move while avoiding all objects that are flagged as obstacles."),
|
||||
"",
|
||||
"CppPlatform/Extensions/AStaricon.png",
|
||||
"PathfindingBehavior",
|
||||
std::make_shared<PathfindingBehavior>(),
|
||||
std::make_shared<gd::BehaviorsSharedData>());
|
||||
gd::BehaviorMetadata& aut = extension.AddBehavior("PathfindingBehavior",
|
||||
_("Pathfinding"),
|
||||
"Pathfinding",
|
||||
_("With this, characters will move while avoiding all objects that are flagged as obstacles."),
|
||||
"",
|
||||
"CppPlatform/Extensions/AStaricon.png",
|
||||
"PathfindingBehavior",
|
||||
std::make_shared<PathfindingBehavior>(),
|
||||
std::make_shared<gd::BehaviorsSharedData>());
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
|
||||
aut.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddAction("SetDestination",
|
||||
_("Move to a position"),
|
||||
_("Move the object to a position"),
|
||||
_("Move _PARAM0_ to _PARAM3_;_PARAM4_"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Move to a position"),
|
||||
_("Move the object to a position"),
|
||||
_("Move _PARAM0_ to _PARAM3_;_PARAM4_"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -50,12 +50,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddCondition("PathFound",
|
||||
_("Path found"),
|
||||
_("Return true if a path has been found."),
|
||||
_("A path has been found for _PARAM0_"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Path found"),
|
||||
_("Return true if a path has been found."),
|
||||
_("A path has been found for _PARAM0_"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -63,12 +63,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddCondition("DestinationReached",
|
||||
_("Destination reached"),
|
||||
_("Return true if the destination was reached."),
|
||||
_("_PARAM0_ reached its destination"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Destination reached"),
|
||||
_("Return true if the destination was reached."),
|
||||
_("_PARAM0_ reached its destination"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -76,12 +76,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddAction("CellWidth",
|
||||
_("Width of the cells"),
|
||||
_("Change the width of the cells of the virtual grid."),
|
||||
_("Do _PARAM2__PARAM3_ to the width of the virtual cells of _PARAM0_"),
|
||||
_("Virtual grid"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Width of the cells"),
|
||||
_("Change the width of the cells of the virtual grid."),
|
||||
_("Do _PARAM2__PARAM3_ to the width of the virtual cells of _PARAM0_"),
|
||||
_("Virtual grid"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -93,12 +93,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddCondition("CellWidth",
|
||||
_("Width of the virtual grid"),
|
||||
_("Compare the width of the cells of the virtual grid."),
|
||||
_("Width of the virtual cells of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Virtual grid"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Width of the virtual grid"),
|
||||
_("Compare the width of the cells of the virtual grid."),
|
||||
_("Width of the virtual cells of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Virtual grid"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -109,12 +109,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddAction("CellHeight",
|
||||
_("Height of the cells"),
|
||||
_("Change the height of the cells of the virtual grid."),
|
||||
_("Do _PARAM2__PARAM3_ to the height of the virtual cells of _PARAM0_"),
|
||||
_("Virtual grid"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Height of the cells"),
|
||||
_("Change the height of the cells of the virtual grid."),
|
||||
_("Do _PARAM2__PARAM3_ to the height of the virtual cells of _PARAM0_"),
|
||||
_("Virtual grid"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -126,12 +126,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddCondition("CellHeight",
|
||||
_("Height of the virtual grid"),
|
||||
_("Compare the height of the cells of the virtual grid."),
|
||||
_("Height of the virtual cells of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Virtual grid"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Height of the virtual grid"),
|
||||
_("Compare the height of the cells of the virtual grid."),
|
||||
_("Height of the virtual cells of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Virtual grid"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -142,12 +142,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddAction("Acceleration",
|
||||
_("Acceleration"),
|
||||
_("Change the acceleration when moving the object"),
|
||||
_("Do _PARAM2__PARAM3_ to the acceleration of _PARAM0_ on the path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Acceleration"),
|
||||
_("Change the acceleration when moving the object"),
|
||||
_("Do _PARAM2__PARAM3_ to the acceleration of _PARAM0_ on the path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -159,12 +159,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddCondition("Acceleration",
|
||||
_("Acceleration"),
|
||||
_("Compare the acceleration when moving the object"),
|
||||
_("Acceleration of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Acceleration"),
|
||||
_("Compare the acceleration when moving the object"),
|
||||
_("Acceleration of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -175,12 +175,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddAction("MaxSpeed",
|
||||
_("Maximum speed"),
|
||||
_("Change the maximum speed when moving the object"),
|
||||
_("Do _PARAM2__PARAM3_ to the max. speed of _PARAM0_ on the path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Maximum speed"),
|
||||
_("Change the maximum speed when moving the object"),
|
||||
_("Do _PARAM2__PARAM3_ to the max. speed of _PARAM0_ on the path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -192,12 +192,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddCondition("MaxSpeed",
|
||||
_("Maximum speed"),
|
||||
_("Compare the maximum speed when moving the object"),
|
||||
_("Max. speed of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Maximum speed"),
|
||||
_("Compare the maximum speed when moving the object"),
|
||||
_("Max. speed of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -208,12 +208,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddAction("Speed",
|
||||
_("Speed"),
|
||||
_("Change the speed of the object on the path"),
|
||||
_("Do _PARAM2__PARAM3_ to the speed of _PARAM0_ on the path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Speed"),
|
||||
_("Change the speed of the object on the path"),
|
||||
_("Do _PARAM2__PARAM3_ to the speed of _PARAM0_ on the path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -225,12 +225,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddCondition("Speed",
|
||||
_("Speed"),
|
||||
_("Compare the speed of the object on the path"),
|
||||
_("Speed of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Speed"),
|
||||
_("Compare the speed of the object on the path"),
|
||||
_("Speed of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -241,12 +241,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddAction("AngularMaxSpeed",
|
||||
_("Angular maximum speed"),
|
||||
_("Change the maximum angular speed when moving the object"),
|
||||
_("Do _PARAM2__PARAM3_ to the max. angular speed of _PARAM0_ on the path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Angular maximum speed"),
|
||||
_("Change the maximum angular speed when moving the object"),
|
||||
_("Do _PARAM2__PARAM3_ to the max. angular speed of _PARAM0_ on the path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -258,12 +258,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddCondition("AngularMaxSpeed",
|
||||
_("Angular maximum speed"),
|
||||
_("Compare the maximum angular speed when moving the object"),
|
||||
_("Max. angular speed of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Angular maximum speed"),
|
||||
_("Compare the maximum angular speed when moving the object"),
|
||||
_("Max. angular speed of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -274,12 +274,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddAction("AngleOffset",
|
||||
_("Rotation offset"),
|
||||
_("Change the rotation offset applied when moving the object"),
|
||||
_("Do _PARAM2__PARAM3_ to the rotation offset of _PARAM0_ on the path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Rotation offset"),
|
||||
_("Change the rotation offset applied when moving the object"),
|
||||
_("Do _PARAM2__PARAM3_ to the rotation offset of _PARAM0_ on the path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -291,12 +291,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddCondition("AngleOffset",
|
||||
_("Rotation offset"),
|
||||
_("Compare the rotation offset when moving the object"),
|
||||
_("Rotation offset of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Rotation offset"),
|
||||
_("Compare the rotation offset when moving the object"),
|
||||
_("Rotation offset of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -307,12 +307,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddAction("ExtraBorder",
|
||||
_("Extra border"),
|
||||
_("Change the size of the extra border applied to the object when planning a path"),
|
||||
_("Do _PARAM2__PARAM3_ to the extra border of _PARAM0_ on the path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Extra border"),
|
||||
_("Change the size of the extra border applied to the object when planning a path"),
|
||||
_("Do _PARAM2__PARAM3_ to the extra border of _PARAM0_ on the path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -324,12 +324,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddCondition("ExtraBorder",
|
||||
_("Extra border"),
|
||||
_("Compare the size of the extra border applied to the object when planning a path"),
|
||||
_("Size of the extra border applied to _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Extra border"),
|
||||
_("Compare the size of the extra border applied to the object when planning a path"),
|
||||
_("Size of the extra border applied to _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -340,12 +340,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddAction("AllowDiagonals",
|
||||
_("Diagonals moves"),
|
||||
_("Allow or restrict diagonal movement on the path"),
|
||||
_("Allow diagonal movement for _PARAM0_ on the path: _PARAM2_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Diagonals moves"),
|
||||
_("Allow or restrict diagonal movement on the path"),
|
||||
_("Allow diagonal movement for _PARAM0_ on the path: _PARAM2_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -354,12 +354,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddCondition("DiagonalsAllowed",
|
||||
_("Diagonals moves"),
|
||||
_("Return true if the object is allowed to move diagonally on the path"),
|
||||
_("Diagonal moves allowed for _PARAM0_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Diagonals moves"),
|
||||
_("Return true if the object is allowed to move diagonally on the path"),
|
||||
_("Diagonal moves allowed for _PARAM0_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -367,12 +367,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddAction("RotateObject",
|
||||
_("Rotate the object"),
|
||||
_("Enable or disable rotation of the object on the path"),
|
||||
_("Enable rotation of _PARAM0_ on the path: _PARAM2_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Rotate the object"),
|
||||
_("Enable or disable rotation of the object on the path"),
|
||||
_("Enable rotation of _PARAM0_ on the path: _PARAM2_"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -381,12 +381,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");
|
||||
|
||||
aut.AddCondition("ObjectRotated",
|
||||
_("Object rotated"),
|
||||
_("Return true if the object is rotated when traveling on its path."),
|
||||
_("_PARAM0_ is rotated when traveling on its path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
_("Object rotated"),
|
||||
_("Return true if the object is rotated when traveling on its path."),
|
||||
_("_PARAM0_ is rotated when traveling on its path"),
|
||||
_("Path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -506,26 +506,26 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
#endif
|
||||
}
|
||||
{
|
||||
gd::BehaviorMetadata &aut = extension.AddBehavior("PathfindingObstacleBehavior",
|
||||
_("Obstacle for pathfinding"),
|
||||
"PathfindingObstacle",
|
||||
_("Flag the object as being an obstacle for pathfinding."),
|
||||
"",
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon.png",
|
||||
"PathfindingObstacleBehavior",
|
||||
std::make_shared<PathfindingObstacleBehavior>(),
|
||||
std::make_shared<gd::BehaviorsSharedData>());
|
||||
gd::BehaviorMetadata& aut = extension.AddBehavior("PathfindingObstacleBehavior",
|
||||
_("Obstacle for pathfinding"),
|
||||
"PathfindingObstacle",
|
||||
_("Flag the object as being an obstacle for pathfinding."),
|
||||
"",
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon.png",
|
||||
"PathfindingObstacleBehavior",
|
||||
std::make_shared<PathfindingObstacleBehavior>(),
|
||||
std::make_shared<gd::BehaviorsSharedData>());
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
aut.SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h");
|
||||
|
||||
aut.AddAction("Cost",
|
||||
_("Cost"),
|
||||
_("Change the cost of going through the object."),
|
||||
_("Do _PARAM2__PARAM3_ to the cost of _PARAM0_"),
|
||||
_("Obstacles"),
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon24.png",
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon16.png")
|
||||
_("Cost"),
|
||||
_("Change the cost of going through the object."),
|
||||
_("Do _PARAM2__PARAM3_ to the cost of _PARAM0_"),
|
||||
_("Obstacles"),
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon24.png",
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior")
|
||||
@@ -537,12 +537,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h");
|
||||
|
||||
aut.AddCondition("Cost",
|
||||
_("Cost"),
|
||||
_("Compare the cost of going through the object"),
|
||||
_("Cost of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Obstacles"),
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon24.png",
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon16.png")
|
||||
_("Cost"),
|
||||
_("Compare the cost of going through the object"),
|
||||
_("Cost of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("Obstacles"),
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon24.png",
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior")
|
||||
@@ -553,12 +553,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h");
|
||||
|
||||
aut.AddAction("SetImpassable",
|
||||
_("Should object be impassable?"),
|
||||
_("Decide if the object is an impassable obstacle"),
|
||||
_("Set _PARAM0_ as an impassable obstacle: _PARAM2_"),
|
||||
_("Obstacles"),
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon24.png",
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon16.png")
|
||||
_("Should object be impassable?"),
|
||||
_("Decide if the object is an impassable obstacle"),
|
||||
_("Set _PARAM0_ as an impassable obstacle: _PARAM2_"),
|
||||
_("Obstacles"),
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon24.png",
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior")
|
||||
@@ -567,12 +567,12 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
.SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h");
|
||||
|
||||
aut.AddCondition("IsImpassable",
|
||||
_("Is object impassable?"),
|
||||
_("Return true if the obstacle is impassable"),
|
||||
_("_PARAM0_ is impassable"),
|
||||
_("Obstacles"),
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon24.png",
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon16.png")
|
||||
_("Is object impassable?"),
|
||||
_("Return true if the obstacle is impassable"),
|
||||
_("_PARAM0_ is impassable"),
|
||||
_("Obstacles"),
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon24.png",
|
||||
"CppPlatform/Extensions/pathfindingobstacleicon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior")
|
||||
@@ -592,9 +592,8 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension &extension)
|
||||
/**
|
||||
* \brief This class declares information about the extension.
|
||||
*/
|
||||
class PathfindingBehaviorCppExtension : public ExtensionBase
|
||||
{
|
||||
public:
|
||||
class PathfindingBehaviorCppExtension : public ExtensionBase {
|
||||
public:
|
||||
/**
|
||||
* Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
|
||||
*/
|
||||
@@ -607,7 +606,7 @@ class PathfindingBehaviorCppExtension : public ExtensionBase
|
||||
};
|
||||
|
||||
#if defined(ANDROID)
|
||||
extern "C" ExtensionBase *CreateGDCppPathfindingBehaviorExtension()
|
||||
extern "C" ExtensionBase* CreateGDCppPathfindingBehaviorExtension()
|
||||
{
|
||||
return new PathfindingBehaviorCppExtension;
|
||||
}
|
||||
@@ -616,7 +615,7 @@ extern "C" ExtensionBase *CreateGDCppPathfindingBehaviorExtension()
|
||||
* Used by GDevelop to create the extension class
|
||||
* -- Do not need to be modified. --
|
||||
*/
|
||||
extern "C" ExtensionBase *GD_EXTENSION_API CreateGDExtension()
|
||||
extern "C" ExtensionBase* GD_EXTENSION_API CreateGDExtension()
|
||||
{
|
||||
return new PathfindingBehaviorCppExtension;
|
||||
}
|
||||
|
@@ -7,7 +7,6 @@ This project is released under the MIT License.
|
||||
#if defined(GD_IDE_ONLY)
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include <iostream>
|
||||
|
||||
void DeclarePathfindingBehaviorExtension(gd::PlatformExtension & extension);
|
||||
|
||||
@@ -99,6 +98,7 @@ public:
|
||||
}
|
||||
|
||||
StripUnimplementedInstructionsAndExpressions();
|
||||
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
|
||||
};
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -6,29 +6,23 @@ This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY)
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
|
||||
void DeclarePhysicsBehaviorExtension(gd::PlatformExtension & extension);
|
||||
|
||||
/**
|
||||
* \brief This class declares information about the JS extension.
|
||||
*/
|
||||
class JsExtension : public gd::PlatformExtension
|
||||
class PhysicsBehaviorJsExtension : public gd::PlatformExtension
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* \brief Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
|
||||
*/
|
||||
JsExtension()
|
||||
PhysicsBehaviorJsExtension()
|
||||
{
|
||||
SetExtensionInformation("PhysicsBehavior",
|
||||
_("Physics behavior"),
|
||||
_("Behavior allowing to move objects as if they were subject to the laws of physics."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)");
|
||||
CloneExtension("GDevelop C++ platform", "PhysicsBehavior");
|
||||
DeclarePhysicsBehaviorExtension(*this);
|
||||
|
||||
GetBehaviorMetadata("PhysicsBehavior::PhysicsBehavior")
|
||||
.SetIncludeFile("Extensions/PhysicsBehavior/box2djs/box2d.js")
|
||||
@@ -145,14 +139,21 @@ public:
|
||||
*/
|
||||
|
||||
StripUnimplementedInstructionsAndExpressions();
|
||||
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
|
||||
};
|
||||
};
|
||||
|
||||
#if defined(EMSCRIPTEN)
|
||||
extern "C" gd::PlatformExtension * CreateGDJSPhysicsBehaviorExtension() {
|
||||
return new PhysicsBehaviorJsExtension;
|
||||
}
|
||||
#else
|
||||
/**
|
||||
* Used by GDevelop to create the extension class
|
||||
* -- Do not need to be modified. --
|
||||
*/
|
||||
extern "C" gd::PlatformExtension * GD_EXTENSION_API CreateGDJSExtension() {
|
||||
return new JsExtension;
|
||||
return new PhysicsBehaviorJsExtension;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -7,6 +7,7 @@ This project is released under the MIT License.
|
||||
|
||||
#include "PhysicsBehavior.h"
|
||||
#include <string>
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "Box2D/Box2D.h"
|
||||
#include "Triangulation/triangulate.h"
|
||||
#include "GDCpp/Runtime/RuntimeScene.h"
|
||||
@@ -17,6 +18,10 @@ This project is released under the MIT License.
|
||||
#include "GDCpp/Runtime/Project/Project.h"
|
||||
#include "GDCpp/Runtime/Project/Layout.h"
|
||||
#include "RuntimeScenePhysicsDatas.h"
|
||||
#if defined(GD_IDE_ONLY)
|
||||
#include <map>
|
||||
#include "GDCore/IDE/Dialogs/PropertyDescriptor.h"
|
||||
#endif
|
||||
|
||||
#undef GetObject
|
||||
|
||||
@@ -100,10 +105,6 @@ void PhysicsBehavior::DoStepPostEvents(RuntimeScene & scene)
|
||||
float newHeight = object->GetHeight();
|
||||
if ( (int)objectOldWidth != (int)newWidth || (int)objectOldHeight != (int)newHeight )
|
||||
{
|
||||
/*std::cout << "Changed:" << (int)objectOldWidth << "!=" << (int)newWidth << std::endl;
|
||||
std::cout << "Changed:" << (int)objectOldHeight << "!=" << (int)newHeight << std::endl;
|
||||
std::cout << "( Object name:" << object->GetName() << std::endl;*/
|
||||
|
||||
double oldAngularVelocity = body->GetAngularVelocity();
|
||||
b2Vec2 oldVelocity = body->GetLinearVelocity();
|
||||
|
||||
@@ -700,6 +701,76 @@ void PhysicsBehavior::UnserializeFrom(const gd::SerializerElement & element)
|
||||
SetPolygonCoords(PhysicsBehavior::GetCoordsVectorFromString(coordsStr, '/', ';'));
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::PropertyDescriptor> PhysicsBehavior::GetProperties(gd::Project & project) const
|
||||
{
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
|
||||
gd::String shapeTypeStr = _("Box (rectangle)");
|
||||
if (shapeType == Box) shapeTypeStr = _("Box (rectangle)");
|
||||
else if (shapeType == Circle) shapeTypeStr = _("Circle");
|
||||
else if (shapeType == CustomPolygon) shapeTypeStr = _("Custom polygon");
|
||||
|
||||
properties[_("Shape")]
|
||||
.SetValue(shapeTypeStr)
|
||||
.SetType("Choice")
|
||||
.AddExtraInfo(_("Box (rectangle)"))
|
||||
.AddExtraInfo(_("Circle"));
|
||||
|
||||
properties[_("Dynamic object")].SetValue(dynamic ? "true" : "false").SetType("Boolean");
|
||||
properties[_("Fixed rotation")].SetValue(fixedRotation ? "true" : "false").SetType("Boolean");
|
||||
properties[_("Consider as bullet (better collision handling)")].SetValue(isBullet ? "true" : "false").SetType("Boolean");
|
||||
properties[_("Mass density")].SetValue(gd::String::From(massDensity));
|
||||
properties[_("Friction")].SetValue(gd::String::From(averageFriction));
|
||||
properties[_("Restitution (elasticity)")].SetValue(gd::String::From(averageRestitution));
|
||||
properties[_("Linear Damping")].SetValue(gd::String::From(linearDamping));
|
||||
properties[_("Angular Damping")].SetValue(gd::String::From(angularDamping));
|
||||
properties[_("PLEASE_ALSO_SHOW_EDIT_BUTTON_THANKS")].SetValue("");
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
bool PhysicsBehavior::UpdateProperty(const gd::String & name, const gd::String & value, gd::Project & project)
|
||||
{
|
||||
if (name == _("Shape"))
|
||||
{
|
||||
if (value == _("Box (rectangle)"))
|
||||
shapeType = Box;
|
||||
else if (value == _("Circle"))
|
||||
shapeType = Circle;
|
||||
else if (value == _("Custom polygon"))
|
||||
shapeType = CustomPolygon;
|
||||
}
|
||||
if ( name == _("Dynamic object") ) {
|
||||
dynamic = (value != "0");
|
||||
}
|
||||
if ( name == _("Fixed rotation") ) {
|
||||
fixedRotation = (value != "0");
|
||||
}
|
||||
if ( name == _("Consider as bullet (better collision handling)") ) {
|
||||
isBullet = (value != "0");
|
||||
}
|
||||
if ( name == _("Mass density") ) {
|
||||
massDensity = value.To<float>();
|
||||
}
|
||||
if ( name == _("Friction") ) {
|
||||
averageFriction = value.To<float>();
|
||||
}
|
||||
if ( name == _("Restitution (elasticity)") ) {
|
||||
averageRestitution = value.To<float>();
|
||||
}
|
||||
if ( name == _("Linear Damping") ) {
|
||||
if ( value.To<float>() < 0 ) return false;
|
||||
linearDamping = value.To<float>();
|
||||
}
|
||||
if ( name == _("Angular Damping") ) {
|
||||
if ( value.To<float>() < 0 ) return false;
|
||||
angularDamping = value.To<float>();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
gd::String PhysicsBehavior::GetStringFromCoordsVector(const std::vector<sf::Vector2f> &vec, char32_t coordsSep, char32_t composantSep)
|
||||
{
|
||||
|
@@ -56,6 +56,9 @@ public:
|
||||
* Called when user wants to edit the behavior.
|
||||
*/
|
||||
virtual void EditBehavior( wxWindow* parent, gd::Project & project_, gd::Layout * layout_, gd::MainFrameWrapper & mainFrameWrapper_ );
|
||||
|
||||
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties(gd::Project & project) const;
|
||||
virtual bool UpdateProperty(const gd::String & name, const gd::String & value, gd::Project & project);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@@ -138,6 +138,7 @@ gd::PlatformExtension * CreateGDJSLinkedObjectsExtension();
|
||||
gd::PlatformExtension * CreateGDJSSystemInfoExtension();
|
||||
gd::PlatformExtension * CreateGDJSShopifyExtension();
|
||||
gd::PlatformExtension * CreateGDJSPathfindingBehaviorExtension();
|
||||
gd::PlatformExtension * CreateGDJSPhysicsBehaviorExtension();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -185,6 +186,7 @@ JsPlatform::JsPlatform() :
|
||||
AddExtension(std::shared_ptr<gd::PlatformExtension>(CreateGDJSSystemInfoExtension())); std::cout.flush();
|
||||
AddExtension(std::shared_ptr<gd::PlatformExtension>(CreateGDJSShopifyExtension())); std::cout.flush();
|
||||
AddExtension(std::shared_ptr<gd::PlatformExtension>(CreateGDJSPathfindingBehaviorExtension())); std::cout.flush();
|
||||
AddExtension(std::shared_ptr<gd::PlatformExtension>(CreateGDJSPhysicsBehaviorExtension())); std::cout.flush();
|
||||
#endif
|
||||
std::cout << "done." << std::endl;
|
||||
};
|
||||
|
BIN
newIDE/app/resources/examples/physics/2DSmallWoodBox.jpg
Normal file
BIN
newIDE/app/resources/examples/physics/2DSmallWoodBox.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
newIDE/app/resources/examples/physics/2DWoodBox.jpg
Normal file
BIN
newIDE/app/resources/examples/physics/2DWoodBox.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
newIDE/app/resources/examples/physics/BlackSphere.png
Normal file
BIN
newIDE/app/resources/examples/physics/BlackSphere.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
newIDE/app/resources/examples/physics/ConcreteWall.png
Normal file
BIN
newIDE/app/resources/examples/physics/ConcreteWall.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
Binary file not shown.
After Width: | Height: | Size: 214 KiB |
3145
newIDE/app/resources/examples/physics/physics.json
Normal file
3145
newIDE/app/resources/examples/physics/physics.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -503,6 +503,78 @@ Object {
|
||||
},
|
||||
},
|
||||
},
|
||||
"Physics behavior": Object {
|
||||
"Collision": Object {
|
||||
"displayedName": "Collision",
|
||||
"fullGroupName": "Physics behavior/",
|
||||
"type": "PhysicsBehavior::CollisionWith",
|
||||
},
|
||||
"Collision polygon": Object {
|
||||
"Collision polygon X scale": Object {
|
||||
"displayedName": "Collision polygon X scale",
|
||||
"fullGroupName": "Physics behavior/Collision polygon",
|
||||
"type": "PhysicsBehavior::GetPolygonScaleX",
|
||||
},
|
||||
"Collision polygon Y scale": Object {
|
||||
"displayedName": "Collision polygon Y scale",
|
||||
"fullGroupName": "Physics behavior/Collision polygon",
|
||||
"type": "PhysicsBehavior::GetPolygonScaleY",
|
||||
},
|
||||
},
|
||||
"Displacement": Object {
|
||||
"Angular damping": Object {
|
||||
"displayedName": "Angular damping",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::AngularDamping",
|
||||
},
|
||||
"Linear damping": Object {
|
||||
"displayedName": "Linear damping",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::LinearDamping",
|
||||
},
|
||||
"Linear speed": Object {
|
||||
"displayedName": "Linear speed",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::LinearVelocity",
|
||||
},
|
||||
"X component": Object {
|
||||
"displayedName": "X component",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::LinearVelocityX",
|
||||
},
|
||||
"Y component": Object {
|
||||
"displayedName": "Y component",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::LinearVelocityY",
|
||||
},
|
||||
},
|
||||
"Movement": Object {
|
||||
"The object is dynamic": Object {
|
||||
"displayedName": "The object is dynamic",
|
||||
"fullGroupName": "Physics behavior/Movement",
|
||||
"type": "PhysicsBehavior::IsDynamic",
|
||||
},
|
||||
},
|
||||
"Other": Object {
|
||||
"Object is treated like a bullet": Object {
|
||||
"displayedName": "Object is treated like a bullet",
|
||||
"fullGroupName": "Physics behavior/Other",
|
||||
"type": "PhysicsBehavior::IsBullet",
|
||||
},
|
||||
},
|
||||
"Rotation": Object {
|
||||
"Angular speed": Object {
|
||||
"displayedName": "Angular speed",
|
||||
"fullGroupName": "Physics behavior/Rotation",
|
||||
"type": "PhysicsBehavior::AngularVelocity",
|
||||
},
|
||||
"Fixed rotation": Object {
|
||||
"displayedName": "Fixed rotation",
|
||||
"fullGroupName": "Physics behavior/Rotation",
|
||||
"type": "PhysicsBehavior::IsFixedRotation",
|
||||
},
|
||||
},
|
||||
},
|
||||
"Platform Behavior": Object {
|
||||
"Is falling": Object {
|
||||
"displayedName": "Is falling",
|
||||
@@ -1846,6 +1918,121 @@ Array [
|
||||
"fullGroupName": "Pathfinding behavior/Obstacles",
|
||||
"type": "PathfindingBehavior::SetImpassable",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Add a gear between two objects",
|
||||
"fullGroupName": "Physics behavior/Joints",
|
||||
"type": "PhysicsBehavior::ActAddGearJointBetweenObjects",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Add a hinge",
|
||||
"fullGroupName": "Physics behavior/Joints",
|
||||
"type": "PhysicsBehavior::AddRevoluteJoint",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Add a hinge between two objects",
|
||||
"fullGroupName": "Physics behavior/Joints",
|
||||
"type": "PhysicsBehavior::AddRevoluteJointBetweenObjects",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Add a force",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::ApplyForce",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Apply a force toward a position",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::ApplyForceTowardPosition",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Apply a force ( angle )",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::ApplyForceUsingPolarCoordinates",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Apply an impulse",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::ApplyImpulse",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Apply an impulse toward a position",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::ApplyImpulseTowardPosition",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Apply an impulse (angle)",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::ApplyImpulseUsingPolarCoordinates",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Add a torque (a rotation)",
|
||||
"fullGroupName": "Physics behavior/Rotation",
|
||||
"type": "PhysicsBehavior::ApplyTorque",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Do not treat object like a bullet",
|
||||
"fullGroupName": "Physics behavior/Other",
|
||||
"type": "PhysicsBehavior::DontSetAsBullet",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Angular damping",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::SetAngularDamping",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Angular speed",
|
||||
"fullGroupName": "Physics behavior/Rotation",
|
||||
"type": "PhysicsBehavior::SetAngularVelocity",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Treat object like a bullet.",
|
||||
"fullGroupName": "Physics behavior/Other",
|
||||
"type": "PhysicsBehavior::SetAsBullet",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Make the object dynamic",
|
||||
"fullGroupName": "Physics behavior/Movement",
|
||||
"type": "PhysicsBehavior::SetDynamic",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Fix rotation",
|
||||
"fullGroupName": "Physics behavior/Rotation",
|
||||
"type": "PhysicsBehavior::SetFixedRotation",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Make object's rotation free",
|
||||
"fullGroupName": "Physics behavior/Rotation",
|
||||
"type": "PhysicsBehavior::SetFreeRotation",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Gravity",
|
||||
"fullGroupName": "Physics behavior/Global options",
|
||||
"type": "PhysicsBehavior::SetGravity",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Linear damping",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::SetLinearDamping",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Linear velocity",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::SetLinearVelocity",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Change the X scale of a collision polygon",
|
||||
"fullGroupName": "Physics behavior/Collision polygon",
|
||||
"type": "PhysicsBehavior::SetPolygonScaleX",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Change the Y scale of a collision polygon",
|
||||
"fullGroupName": "Physics behavior/Collision polygon",
|
||||
"type": "PhysicsBehavior::SetPolygonScaleY",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Make the object static",
|
||||
"fullGroupName": "Physics behavior/Movement",
|
||||
"type": "PhysicsBehavior::SetStatic",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
@@ -2591,5 +2778,65 @@ Array [
|
||||
"fullGroupName": "Pathfinding behavior/Obstacles",
|
||||
"type": "PathfindingBehavior::IsImpassable",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Angular damping",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::AngularDamping",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Angular speed",
|
||||
"fullGroupName": "Physics behavior/Rotation",
|
||||
"type": "PhysicsBehavior::AngularVelocity",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Collision",
|
||||
"fullGroupName": "Physics behavior/",
|
||||
"type": "PhysicsBehavior::CollisionWith",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Collision polygon X scale",
|
||||
"fullGroupName": "Physics behavior/Collision polygon",
|
||||
"type": "PhysicsBehavior::GetPolygonScaleX",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Collision polygon Y scale",
|
||||
"fullGroupName": "Physics behavior/Collision polygon",
|
||||
"type": "PhysicsBehavior::GetPolygonScaleY",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Object is treated like a bullet",
|
||||
"fullGroupName": "Physics behavior/Other",
|
||||
"type": "PhysicsBehavior::IsBullet",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "The object is dynamic",
|
||||
"fullGroupName": "Physics behavior/Movement",
|
||||
"type": "PhysicsBehavior::IsDynamic",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Fixed rotation",
|
||||
"fullGroupName": "Physics behavior/Rotation",
|
||||
"type": "PhysicsBehavior::IsFixedRotation",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Linear damping",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::LinearDamping",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Linear speed",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::LinearVelocity",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "X component",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::LinearVelocityX",
|
||||
},
|
||||
Object {
|
||||
"displayedName": "Y component",
|
||||
"fullGroupName": "Physics behavior/Displacement",
|
||||
"type": "PhysicsBehavior::LinearVelocityY",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
@@ -46,6 +46,19 @@ export default class LocalCreateDialog extends Component {
|
||||
}}
|
||||
/>
|
||||
<Subheader>Examples</Subheader>
|
||||
<ListItem
|
||||
primaryText="Physics"
|
||||
secondaryText={
|
||||
<p>
|
||||
Example showing how to configure physics behavior on objects and use events to detect collisions.
|
||||
</p>
|
||||
}
|
||||
secondaryTextLines={2}
|
||||
onClick={() => {
|
||||
sendNewGameCreated('physics');
|
||||
this.props.onOpen('internal://physics');
|
||||
}}
|
||||
/>
|
||||
<ListItem
|
||||
primaryText="Pathfinding"
|
||||
secondaryText={
|
||||
|
@@ -105,6 +105,12 @@ export default class LocalCreateDialog extends Component {
|
||||
onClick={() => this.createEmptyGame()}
|
||||
/>
|
||||
<Subheader>Examples</Subheader>
|
||||
<ListItem
|
||||
primaryText="Physics"
|
||||
secondaryText={<p>Example showing how to configure physics behavior on objects and use events to detect collisions.</p>}
|
||||
secondaryTextLines={2}
|
||||
onClick={() => this.createFromExample('physics')}
|
||||
/>
|
||||
<ListItem
|
||||
primaryText="Pathfinding"
|
||||
secondaryText={<p>Example showing how to move a tank avoiding obstacles on the battlefield.</p>}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import platformer from '../fixtures/platformer/platformer.json';
|
||||
import spaceShooter from '../fixtures/space-shooter/space-shooter.json';
|
||||
import pathfinding from '../fixtures/pathfinding/pathfinding.json';
|
||||
import physics from '../fixtures/physics/physics.json';
|
||||
|
||||
export default class BrowserProjectOpener {
|
||||
static readInternalFile(url) {
|
||||
@@ -10,6 +11,8 @@ export default class BrowserProjectOpener {
|
||||
return Promise.resolve(spaceShooter);
|
||||
} else if (url === 'internal://pathfinding') {
|
||||
return Promise.resolve(pathfinding);
|
||||
} else if (url === 'internal://physics') {
|
||||
return Promise.resolve(physics);
|
||||
}
|
||||
|
||||
return Promise.reject(`Unknown built-in game with URL ${url}`);
|
||||
|
@@ -35,6 +35,8 @@ export default class PropertiesEditor extends Component {
|
||||
}
|
||||
|
||||
_renderEditField = field => {
|
||||
if (field.name === 'PLEASE_ALSO_SHOW_EDIT_BUTTON_THANKS') return null; // This special property was used in GDevelop 4 IDE to ask for a Edit button to be shown, ignore it.
|
||||
|
||||
if (field.valueType === 'boolean') {
|
||||
return (
|
||||
<Checkbox
|
||||
|
3145
newIDE/app/src/fixtures/physics/physics.json
Normal file
3145
newIDE/app/src/fixtures/physics/physics.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user