Skip to content

Commit e20524e

Browse files
Migrates to pahser 3.60
1 parent 1e01494 commit e20524e

31 files changed

+804
-134
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
node_modules/
1+
node_modules/
2+
.DS_Store

index.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99

1010
<script src="lib/phaser.min.js"></script>
1111
<script src="src/components/UserComponent.js"></script>
12-
<script src="src/components/PushOnClick.js"></script>
13-
<script src="src/components/PreloadText.js"></script>
12+
<script src="src/script-nodes-basic-js/ScriptNode.js"></script>
13+
<script src="src/script-nodes-basic-js/OnEventScript.js"></script>
14+
<script src="src/script-nodes-basic-js/OnPointerDownScript.js"></script>
15+
<script src="src/script-nodes-basic-js/CallbackActionScript.js"></script>
16+
<script src="src/script-nodes/PushActionScript.js"></script>
1417
<script src="src/scenes/Preload.js"></script>
1518
<script src="src/scenes/Level.js"></script>
1619
<script src="src/main.js"></script>

src/components/Behaviors.components

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
{
22
"components": [
3-
{
4-
"name": "PushOnClick",
5-
"baseClass": "UserComponent",
6-
"gameObjectType": "Phaser.GameObjects.Image",
7-
"properties": []
8-
},
9-
{
10-
"name": "PreloadText",
11-
"baseClass": "UserComponent",
12-
"gameObjectType": "Phaser.GameObjects.Text",
13-
"properties": []
14-
}
3+
154
],
165
"meta": {
176
"app": "Phaser Editor 2D - Object Script Editor",

src/components/PreloadText.js

-38
This file was deleted.

src/components/PushOnClick.js

-48
This file was deleted.

src/scenes/Level.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ class Level extends Phaser.Scene {
1919
// dino
2020
const dino = this.add.image(400, 218, "dino");
2121

22+
// onPointerDownScript
23+
const onPointerDownScript = new OnPointerDownScript(dino);
24+
25+
// pushActionScript
26+
new PushActionScript(onPointerDownScript);
27+
2228
// text_1
2329
const text_1 = this.add.text(400, 408, "", {});
2430
text_1.setOrigin(0.5, 0.5);
2531
text_1.text = "Phaser 3 + Phaser Editor 2D";
26-
text_1.setStyle({"fontFamily":"Arial","fontSize":"30px"});
27-
28-
// dino (components)
29-
new PushOnClick(dino);
32+
text_1.setStyle({ "fontFamily": "Arial", "fontSize": "30px" });
3033

3134
this.events.emit("scene-awake");
3235
}

src/scenes/Level.scene

+26-6
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,31 @@
1111
"type": "Image",
1212
"id": "7d5827fd-34f6-473f-90e0-b9424a51d5fa",
1313
"label": "dino",
14-
"components": [
15-
"PushOnClick"
16-
],
14+
"components": [],
1715
"texture": {
1816
"key": "dino"
1917
},
2018
"x": 400,
21-
"y": 218
19+
"y": 218,
20+
"list": [
21+
{
22+
"prefabId": "a06ed60b-79f1-4444-bf35-89046f71f954",
23+
"id": "f10cc69a-251a-4bca-81de-f36affc5660b",
24+
"label": "onPointerDownScript",
25+
"components": [],
26+
"nestedPrefabs": [],
27+
"list": [
28+
{
29+
"prefabId": "0e39177a-6e19-4b56-a7c2-2360a2e41505",
30+
"id": "a497f179-61d6-4cc9-9147-dca543fe034d",
31+
"label": "pushActionScript",
32+
"components": [],
33+
"nestedPrefabs": [],
34+
"list": []
35+
}
36+
]
37+
}
38+
]
2239
},
2340
{
2441
"type": "Text",
@@ -27,16 +44,19 @@
2744
"components": [],
2845
"x": 400,
2946
"y": 408,
47+
"originX": 0.5,
48+
"originY": 0.5,
3049
"text": "Phaser 3 + Phaser Editor 2D",
3150
"fontFamily": "Arial",
32-
"fontSize": "30px"
51+
"fontSize": "30px",
52+
"list": []
3353
}
3454
],
3555
"plainObjects": [],
3656
"meta": {
3757
"app": "Phaser Editor 2D - Scene Editor",
3858
"url": "https://phasereditor2d.com",
3959
"contentType": "phasereditor2d.core.scene.SceneContentType",
40-
"version": 2
60+
"version": 3
4161
}
4262
}

src/scenes/Preload.js

-9
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ class Preload extends Phaser.Scene {
2727
guapen.scaleX = 0.5915891440784282;
2828
guapen.scaleY = 0.5915891440784282;
2929

30-
// progress
31-
const progress = this.add.text(400, 349, "", {});
32-
progress.setOrigin(0.5, 0.5);
33-
progress.text = "0%";
34-
progress.setStyle({ "fontSize": "30px" });
35-
36-
// progress (components)
37-
new PreloadText(progress);
38-
3930
this.events.emit("scene-awake");
4031
}
4132

src/scenes/Preload.scene

+3-14
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,15 @@
2121
"x": 400,
2222
"y": 219,
2323
"scaleX": 0.5915891440784282,
24-
"scaleY": 0.5915891440784282
25-
},
26-
{
27-
"type": "Text",
28-
"id": "2ce42443-5227-4c9b-b498-e81f9a21cde3",
29-
"label": "progress",
30-
"components": [
31-
"PreloadText"
32-
],
33-
"x": 400,
34-
"y": 349,
35-
"text": "0%",
36-
"fontSize": "30px"
24+
"scaleY": 0.5915891440784282,
25+
"list": []
3726
}
3827
],
3928
"plainObjects": [],
4029
"meta": {
4130
"app": "Phaser Editor 2D - Scene Editor",
4231
"url": "https://phasereditor2d.com",
4332
"contentType": "phasereditor2d.core.scene.SceneContentType",
44-
"version": 2
33+
"version": 3
4534
}
4635
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// You can write more code here
2+
/* START OF COMPILED CODE */
3+
4+
class CallbackActionScript extends ScriptNode {
5+
6+
constructor(parent) {
7+
super(parent);
8+
9+
/* START-USER-CTR-CODE */
10+
// Write your code here.
11+
/* END-USER-CTR-CODE */
12+
}
13+
14+
/** @type {() => void} */
15+
callback;
16+
17+
/* START-USER-CODE */
18+
execute() {
19+
if (this.callback) {
20+
this.callback();
21+
}
22+
}
23+
/* END-USER-CODE */
24+
}
25+
26+
/* END OF COMPILED CODE */
27+
// You can write more code here
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"id": "e29bc630-dabe-4a8c-97e0-45ccb875b877",
3+
"sceneType": "PREFAB",
4+
"settings": {
5+
"preloadMethodName": "",
6+
"preloadPackFiles": [],
7+
"createMethodName": "",
8+
"borderWidth": 1280,
9+
"borderHeight": 720
10+
},
11+
"displayList": [
12+
{
13+
"type": "ScriptNode",
14+
"id": "96b59bda-a578-4a52-9a56-8edc8558e9ea",
15+
"label": "scriptnode_1",
16+
"components": [],
17+
"list": []
18+
}
19+
],
20+
"plainObjects": [],
21+
"meta": {
22+
"app": "Phaser Editor 2D - Scene Editor",
23+
"url": "https://phasereditor2d.com",
24+
"contentType": "phasereditor2d.core.scene.SceneContentType",
25+
"version": 3
26+
},
27+
"prefabProperties": [
28+
{
29+
"name": "callback",
30+
"label": "Callback",
31+
"tooltip": "Callback",
32+
"defValue": "",
33+
"customDefinition": false,
34+
"type": {
35+
"id": "expression",
36+
"expressionType": "() => void"
37+
}
38+
}
39+
]
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// You can write more code here
2+
/* START OF COMPILED CODE */
3+
4+
class ExecActionScript extends ScriptNode {
5+
6+
constructor(parent) {
7+
super(parent);
8+
9+
/* START-USER-CTR-CODE */
10+
// Write your code here.
11+
/* END-USER-CTR-CODE */
12+
}
13+
14+
/** @type {ScriptNode} */
15+
targetAction;
16+
17+
/* START-USER-CODE */
18+
execute() {
19+
if (this.targetAction) {
20+
this.targetAction.execute();
21+
}
22+
}
23+
/* END-USER-CODE */
24+
}
25+
26+
/* END OF COMPILED CODE */
27+
// You can write more code here
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"id": "00708fed-6db6-443f-aa52-29c655f684ed",
3+
"sceneType": "PREFAB",
4+
"settings": {
5+
"preloadMethodName": "",
6+
"preloadPackFiles": [],
7+
"createMethodName": "",
8+
"borderWidth": 1280,
9+
"borderHeight": 720
10+
},
11+
"displayList": [
12+
{
13+
"type": "ScriptNode",
14+
"id": "38c73c28-dade-40c3-8869-025a274b163d",
15+
"label": "scriptnode_1",
16+
"components": [],
17+
"list": []
18+
}
19+
],
20+
"plainObjects": [],
21+
"meta": {
22+
"app": "Phaser Editor 2D - Scene Editor",
23+
"url": "https://phasereditor2d.com",
24+
"contentType": "phasereditor2d.core.scene.SceneContentType",
25+
"version": 3
26+
},
27+
"prefabProperties": [
28+
{
29+
"name": "targetAction",
30+
"label": "Target Action",
31+
"tooltip": "The target action node",
32+
"defValue": "",
33+
"customDefinition": false,
34+
"type": {
35+
"id": "object-var",
36+
"expressionType": "ScriptNode"
37+
}
38+
}
39+
]
40+
}

0 commit comments

Comments
 (0)