mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Add 2 example for the new Physics Engine
This commit is contained in:
BIN
newIDE/app/resources/examples/physics-joints-demo/Box.png
Executable file
BIN
newIDE/app/resources/examples/physics-joints-demo/Box.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
BIN
newIDE/app/resources/examples/physics-joints-demo/Circle.png
Executable file
BIN
newIDE/app/resources/examples/physics-joints-demo/Circle.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 798 B |
@@ -0,0 +1 @@
|
||||
A demo of all the joints that can be created using the Physics engine.
|
BIN
newIDE/app/resources/examples/physics-joints-demo/Wall.png
Executable file
BIN
newIDE/app/resources/examples/physics-joints-demo/Wall.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 139 B |
5646
newIDE/app/resources/examples/physics-joints-demo/physics-joints-demo.json
Executable file
5646
newIDE/app/resources/examples/physics-joints-demo/physics-joints-demo.json
Executable file
File diff suppressed because it is too large
Load Diff
BIN
newIDE/app/resources/examples/physics-joints-settings-demo/Box.png
Executable file
BIN
newIDE/app/resources/examples/physics-joints-settings-demo/Box.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
BIN
newIDE/app/resources/examples/physics-joints-settings-demo/Circle.png
Executable file
BIN
newIDE/app/resources/examples/physics-joints-settings-demo/Circle.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 798 B |
@@ -0,0 +1 @@
|
||||
A demo of all the joints, and the way they can be customized, using the Physics engine.
|
BIN
newIDE/app/resources/examples/physics-joints-settings-demo/Wall.png
Executable file
BIN
newIDE/app/resources/examples/physics-joints-settings-demo/Wall.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 139 B |
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ const {
|
||||
loadSerializedProject,
|
||||
} = require('./lib/LocalProjectOpener');
|
||||
const { writeProjectJSONFile } = require('./lib/LocalProjectWriter');
|
||||
const makeExtensionsLoader = require('./lib/LocalJsExtensionsLoader');
|
||||
const { getExampleNames } = require('./lib/ExamplesLoader');
|
||||
const fs = require('fs');
|
||||
|
||||
@@ -35,28 +36,36 @@ const updateResources = (project, baseUrl) => {
|
||||
project.exposeResources(worker);
|
||||
};
|
||||
|
||||
getExampleNames().then(exampleNames =>
|
||||
Promise.all(
|
||||
exampleNames.map(exampleName => {
|
||||
return readProjectJSONFile(
|
||||
`../resources/examples/${exampleName}/${exampleName}.json`
|
||||
)
|
||||
.then(projectObject => {
|
||||
console.log(`Example "${exampleName}" loaded.`);
|
||||
const project = loadSerializedProject(gd, projectObject);
|
||||
updateResources(project, baseUrl + '/' + exampleName);
|
||||
fs.mkdir(`../src/fixtures/${exampleName}`, () => {
|
||||
writeProjectJSONFile(
|
||||
gd,
|
||||
project,
|
||||
`../src/fixtures/${exampleName}/${exampleName}.json`
|
||||
);
|
||||
console.log(`Update of "${exampleName}" done.`);
|
||||
const extensionsLoader = makeExtensionsLoader({ gd, filterExamples: false });
|
||||
extensionsLoader
|
||||
.loadAllExtensions()
|
||||
.then(loadingResults => {
|
||||
console.info('Loaded extensions', loadingResults);
|
||||
|
||||
return getExampleNames();
|
||||
})
|
||||
.then(exampleNames =>
|
||||
Promise.all(
|
||||
exampleNames.map(exampleName => {
|
||||
return readProjectJSONFile(
|
||||
`../resources/examples/${exampleName}/${exampleName}.json`
|
||||
)
|
||||
.then(projectObject => {
|
||||
console.log(`Example "${exampleName}" loaded.`);
|
||||
const project = loadSerializedProject(gd, projectObject);
|
||||
updateResources(project, baseUrl + '/' + exampleName);
|
||||
fs.mkdir(`../src/fixtures/${exampleName}`, () => {
|
||||
writeProjectJSONFile(
|
||||
gd,
|
||||
project,
|
||||
`../src/fixtures/${exampleName}/${exampleName}.json`
|
||||
);
|
||||
console.log(`Update of "${exampleName}" done.`);
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error caught:', error);
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error caught:', error);
|
||||
});
|
||||
})
|
||||
)
|
||||
);
|
||||
})
|
||||
)
|
||||
);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import indexHTML from './GDJSindex.html.js';
|
||||
|
||||
const gdjsRoot =
|
||||
'https://s3-eu-west-1.amazonaws.com/gdevelop-resources/GDJS-5.0.0-beta58';
|
||||
'https://s3-eu-west-1.amazonaws.com/gdevelop-resources/GDJS-5.0.0-beta62';
|
||||
|
||||
export const findGDJS = cb => {
|
||||
return cb({
|
||||
|
@@ -23,6 +23,10 @@ const jsExtensions = [
|
||||
name: 'DeviceVibration',
|
||||
extensionModule: require('GDJS-for-web-app-only/Runtime/Extensions/DeviceVibration/JsExtension.js'),
|
||||
},
|
||||
{
|
||||
name: 'Physics2',
|
||||
extensionModule: require('GDJS-for-web-app-only/Runtime/Extensions/Physics2Behavior/JsExtension.js'),
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
|
@@ -69,6 +69,8 @@ const exampleNames = [
|
||||
'particles-various-effects',
|
||||
'pathfinding-basics',
|
||||
'pathfinding',
|
||||
'physics-joints-demo',
|
||||
'physics-joints-settings-demo',
|
||||
'physics',
|
||||
'pin-object-to-another-multiple-parents',
|
||||
'pin-object-to-another',
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -59,6 +59,8 @@ import particlesVariousEffects from '../fixtures/particles-various-effects/parti
|
||||
import pathfinding from '../fixtures/pathfinding/pathfinding.json';
|
||||
import pathfindingBasics from '../fixtures/pathfinding-basics/pathfinding-basics.json';
|
||||
import physics from '../fixtures/physics/physics.json';
|
||||
import physicsJointsDemo from '../fixtures/physics-joints-demo/physics-joints-demo.json';
|
||||
import physicsJointsSettingsDemo from '../fixtures/physics-joints-settings-demo/physics-joints-settings-demo.json';
|
||||
import pinObjectToAnother from '../fixtures/pin-object-to-another/pin-object-to-another.json';
|
||||
import pinObjectToAnotherMultipleParents from '../fixtures/pin-object-to-another-multiple-parents/pin-object-to-another-multiple-parents.json';
|
||||
import planeAndClouds from '../fixtures/plane-and-clouds/plane-and-clouds.json';
|
||||
@@ -219,6 +221,10 @@ export default class BrowserProjectOpener {
|
||||
return Promise.resolve(pathfindingBasics);
|
||||
} else if (url === 'example://physics') {
|
||||
return Promise.resolve(physics);
|
||||
} else if (url === 'example://physics-joints-demo') {
|
||||
return Promise.resolve(physicsJointsDemo);
|
||||
} else if (url === 'example://physics-joints-settings-demo') {
|
||||
return Promise.resolve(physicsJointsSettingsDemo);
|
||||
} else if (url === 'example://platformer') {
|
||||
return Promise.resolve(platformer);
|
||||
} else if (url === 'example://platformer-double-jump') {
|
||||
|
5646
newIDE/app/src/fixtures/physics-joints-demo/physics-joints-demo.json
Normal file
5646
newIDE/app/src/fixtures/physics-joints-demo/physics-joints-demo.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user