diff --git a/hugo-site/static/games/power-rangers-intro/assets/animations.json b/hugo-site/static/games/power-rangers-intro/assets/animations.json new file mode 100755 index 00000000..1cfa3013 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/assets/animations.json @@ -0,0 +1,108 @@ +{ + "anims": [ + { + "key": "lightningStrikes", + "type": "frame", + "frames": [ + { + "key": "lightning_spritesheet", + "frame": 0, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 1, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 2, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 3, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 0, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 2, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 1, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 0, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 3, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 2, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 0, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 1, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 2, + "duration": 0, + "keyframe": false + }, + { + "key": "lightning_spritesheet", + "frame": 3, + "duration": 0, + "keyframe": false + } + ], + "frameRate": 14, + "skipMissedFrames": true, + "repeat": -1, + "randomFrame": false + } + ], + "globalTimeScale": 1, + "meta": { + "app": "Phaser Editor 2D v3", + "contentType": "Phaser v3 Animations" + }, + "settings": { + "sourceLang": "JAVA_SCRIPT", + "esModule": false, + "generateCode": false + } +} \ No newline at end of file diff --git a/hugo-site/static/games/power-rangers-intro/assets/asset-pack.json b/hugo-site/static/games/power-rangers-intro/assets/asset-pack.json new file mode 100755 index 00000000..36a15d01 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/assets/asset-pack.json @@ -0,0 +1,44 @@ +{ + "section1": { + "files": [ + { + "url": "assets/animations.json", + "type": "animation", + "key": "animations" + }, + { + "url": "assets/power_rangers/lightning_spritesheet.png", + "frameConfig": { + "frameWidth": 256, + "frameHeight": 213, + "startFrame": 0, + "endFrame": -1, + "spacing": 0, + "margin": 0 + }, + "type": "spritesheet", + "key": "lightning_spritesheet" + }, + { + "atlasURL": "assets/power_rangers/logo_spritesheet.json", + "textureURL": "assets/power_rangers/logo_spritesheet.png", + "type": "atlas", + "key": "logo_spritesheet" + }, + { + "url": [ + "assets/power_glove_power_rangers.mp3" + ], + "type": "audio", + "key": "power_glove_power_rangers" + } + ] + }, + "meta": { + "app": "Phaser Editor 2D - Asset Pack Editor", + "contentType": "phasereditor2d.pack.core.AssetContentType", + "url": "https://phasereditor2d.com", + "version": 2, + "showAllFilesInBlocks": false + } +} \ No newline at end of file diff --git a/hugo-site/static/games/power-rangers-intro/assets/editorhero-logo.png b/hugo-site/static/games/power-rangers-intro/assets/editorhero-logo.png new file mode 100644 index 00000000..4e48f455 Binary files /dev/null and b/hugo-site/static/games/power-rangers-intro/assets/editorhero-logo.png differ diff --git a/hugo-site/static/games/power-rangers-intro/assets/fonts/PressStart2P-Regular.ttf b/hugo-site/static/games/power-rangers-intro/assets/fonts/PressStart2P-Regular.ttf new file mode 100644 index 00000000..2442affb Binary files /dev/null and b/hugo-site/static/games/power-rangers-intro/assets/fonts/PressStart2P-Regular.ttf differ diff --git a/hugo-site/static/games/power-rangers-intro/assets/power_glove_power_rangers.mp3 b/hugo-site/static/games/power-rangers-intro/assets/power_glove_power_rangers.mp3 new file mode 100644 index 00000000..5a1fe3fa Binary files /dev/null and b/hugo-site/static/games/power-rangers-intro/assets/power_glove_power_rangers.mp3 differ diff --git a/hugo-site/static/games/power-rangers-intro/assets/power_rangers/lightning_spritesheet.json b/hugo-site/static/games/power-rangers-intro/assets/power_rangers/lightning_spritesheet.json new file mode 100644 index 00000000..9cb7d53a --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/assets/power_rangers/lightning_spritesheet.json @@ -0,0 +1,95 @@ +{ + "frames": { + "1.png": { + "frame": { + "x": 0, + "y": 0, + "w": 256, + "h": 193 + }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 256, + "h": 193 + }, + "sourceSize": { + "w": 256, + "h": 193 + } + }, + "2.png": { + "frame": { + "x": 256, + "y": 0, + "w": 256, + "h": 211 + }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 256, + "h": 211 + }, + "sourceSize": { + "w": 256, + "h": 211 + } + }, + "3.png": { + "frame": { + "x": 512, + "y": 0, + "w": 256, + "h": 213 + }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 256, + "h": 213 + }, + "sourceSize": { + "w": 256, + "h": 213 + } + }, + "4.png": { + "frame": { + "x": 768, + "y": 0, + "w": 256, + "h": 183 + }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 256, + "h": 183 + }, + "sourceSize": { + "w": 256, + "h": 183 + } + } + }, + "meta": { + "app": "http://www.codeandweb.com/texturepacker", + "version": "1.0", + "image": "spritesheet.png", + "format": "RGBA8888", + "size": { + "w": 1024, + "h": 213 + }, + "scale": "1" + } +} \ No newline at end of file diff --git a/hugo-site/static/games/power-rangers-intro/assets/power_rangers/lightning_spritesheet.png b/hugo-site/static/games/power-rangers-intro/assets/power_rangers/lightning_spritesheet.png new file mode 100644 index 00000000..50af5eff Binary files /dev/null and b/hugo-site/static/games/power-rangers-intro/assets/power_rangers/lightning_spritesheet.png differ diff --git a/hugo-site/static/games/power-rangers-intro/assets/power_rangers/logo_spritesheet.json b/hugo-site/static/games/power-rangers-intro/assets/power_rangers/logo_spritesheet.json new file mode 100644 index 00000000..6e0fa44f --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/assets/power_rangers/logo_spritesheet.json @@ -0,0 +1,75 @@ +{ + "frames": { + "bolt.png": { + "frame": { + "x": 0, + "y": 0, + "w": 406, + "h": 270 + }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 406, + "h": 270 + }, + "sourceSize": { + "w": 406, + "h": 270 + } + }, + "mirror.png": { + "frame": { + "x": 406, + "y": 0, + "w": 406, + "h": 270 + }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 406, + "h": 270 + }, + "sourceSize": { + "w": 406, + "h": 270 + } + }, + "text.png": { + "frame": { + "x": 812, + "y": 0, + "w": 406, + "h": 270 + }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 406, + "h": 270 + }, + "sourceSize": { + "w": 406, + "h": 270 + } + } + }, + "meta": { + "app": "http://www.codeandweb.com/texturepacker", + "version": "1.0", + "image": "spritesheet.png", + "format": "RGBA8888", + "size": { + "w": 1218, + "h": 270 + }, + "scale": "1" + } +} \ No newline at end of file diff --git a/hugo-site/static/games/power-rangers-intro/assets/power_rangers/logo_spritesheet.png b/hugo-site/static/games/power-rangers-intro/assets/power_rangers/logo_spritesheet.png new file mode 100644 index 00000000..6cc9c5c8 Binary files /dev/null and b/hugo-site/static/games/power-rangers-intro/assets/power_rangers/logo_spritesheet.png differ diff --git a/hugo-site/static/games/power-rangers-intro/assets/preload-asset-pack.json b/hugo-site/static/games/power-rangers-intro/assets/preload-asset-pack.json new file mode 100755 index 00000000..cd4e4615 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/assets/preload-asset-pack.json @@ -0,0 +1,25 @@ +{ + "section1": { + "files": [ + { + "url": "assets/editorhero-logo.png", + "type": "image", + "key": "editorhero-logo" + }, + { + "url": "assets/fonts/PressStart2P-Regular.ttf", + "format": "truetype", + "descriptors": {}, + "type": "font", + "key": "PressStart2P-Regular" + } + ] + }, + "meta": { + "app": "Phaser Editor 2D - Asset Pack Editor", + "contentType": "phasereditor2d.pack.core.AssetContentType", + "url": "https://phasereditor2d.com", + "version": 2, + "showAllFilesInBlocks": false + } +} \ No newline at end of file diff --git a/hugo-site/static/games/power-rangers-intro/index.html b/hugo-site/static/games/power-rangers-intro/index.html new file mode 100644 index 00000000..3f478d3e --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/index.html @@ -0,0 +1,28 @@ + + + + + + + + Power Rangers SNES Intro + + + + + + + + + + + + + + diff --git a/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_base/ActionTargetComp.js b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_base/ActionTargetComp.js new file mode 100644 index 00000000..bece6761 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_base/ActionTargetComp.js @@ -0,0 +1,46 @@ +// You can write more code here +/* END-USER-IMPORTS */ +export default class ActionTargetComp { + constructor(gameObject) { + this.gameObject = gameObject; + gameObject["__ActionTargetComp"] = this; + /* START-USER-CTR-CODE */ + // Write your code here. + /* END-USER-CTR-CODE */ + } + static getComponent(gameObject) { + return gameObject["__ActionTargetComp"]; + } + gameObject; + target = "GAME_OBJECT"; + targetName = ""; + /* START-USER-CODE */ + static getTargetGameObject(scriptNode, args) { + const comp = ActionTargetComp.getComponent(scriptNode); + if (comp) { + switch (comp.target) { + case "GAME_OBJECT": + return scriptNode.gameObject; + case "ARG_1": + return args[0]; + case "ARG_2": + return args[1]; + case "ARG_3": + return args[2]; + case "ARG_4": + return args[3]; + case "ARG_5": + return args[4]; + case "ARG_6": + return args[5]; + case "ARG_7": + return args[6]; + case "ARG_8": + return args[7]; + } + } + return scriptNode.gameObject; + } +} +/* END OF COMPILED CODE */ +// You can write more code here diff --git a/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_base/ScriptNode.js b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_base/ScriptNode.js new file mode 100644 index 00000000..b4b97dea --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_base/ScriptNode.js @@ -0,0 +1,95 @@ +import ActionTargetComp from "./ActionTargetComp.js"; +export default class ScriptNode { + _scene; + _gameObject; + _parent; + _children; + constructor(parent) { + this._parent = parent; + if (parent instanceof ScriptNode) { + this._scene = parent.scene; + this._gameObject = parent.gameObject; + parent.add(this); + } + else if (parent instanceof Phaser.GameObjects.GameObject) { + this._scene = parent.scene; + this._gameObject = parent; + } + else { + this._scene = parent; + } + const listenAwake = this.awake !== ScriptNode.prototype.awake; + const listenStart = this.start !== ScriptNode.prototype.start; + const listenUpdate = this.update !== ScriptNode.prototype.update; + const listenDestroy = this.destroy !== ScriptNode.prototype.destroy; + if (listenAwake) { + this.scene.events.once("scene-awake", this.awake, this); + } + if (listenStart) { + this.scene.events.once(Phaser.Scenes.Events.UPDATE, this.start, this); + } + if (listenUpdate) { + this.scene.events.on(Phaser.Scenes.Events.UPDATE, this.update, this); + } + if (listenAwake || listenStart || listenUpdate || listenDestroy) { + const destroyCallback = () => { + this.scene.events.off("scene-awake", this.awake, this); + this.scene.events.off(Phaser.Scenes.Events.UPDATE, this.start, this); + this.scene.events.off(Phaser.Scenes.Events.UPDATE, this.update, this); + if (listenDestroy) { + this.destroy(); + } + }; + if (this.gameObject) { + this.gameObject.on(Phaser.GameObjects.Events.DESTROY, destroyCallback); + } + else { + this.scene.events.on(Phaser.Scenes.Events.SHUTDOWN, destroyCallback); + } + } + } + getActionTargetObject(args) { + const target = ActionTargetComp.getTargetGameObject(this, args); + return target; + } + get scene() { + return this._scene; + } + get gameObject() { + return this._gameObject; + } + get parent() { + return this._parent; + } + get children() { + if (!this._children) { + this._children = []; + } + return this._children; + } + add(child) { + this.children.push(child); + } + executeChildren(...args) { + if (this._children) { + for (const child of this._children) { + child.execute(...args); + } + } + } + execute(...args) { + // override this on executable nodes + } + awake() { + // override this + } + start() { + // override this + } + update() { + // override this + } + destroy() { + // override this + } +} diff --git a/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_base/UserComponent.js b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_base/UserComponent.js new file mode 100644 index 00000000..a9cf7729 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_base/UserComponent.js @@ -0,0 +1,43 @@ +export default class UserComponent { + /** + * @param gameObject The entity. + */ + constructor(gameObject) { + this.scene = gameObject.scene; + const listenAwake = this.awake !== UserComponent.prototype.awake; + const listenStart = this.start !== UserComponent.prototype.start; + const listenUpdate = this.update !== UserComponent.prototype.update; + const listenDestroy = this.destroy !== UserComponent.prototype.destroy; + if (listenAwake) { + this.scene.events.once("scene-awake", this.awake, this); + } + if (listenStart) { + this.scene.events.once(Phaser.Scenes.Events.UPDATE, this.start, this); + } + if (listenUpdate) { + this.scene.events.on(Phaser.Scenes.Events.UPDATE, this.update, this); + } + if (listenStart || listenUpdate || listenDestroy) { + gameObject.on(Phaser.GameObjects.Events.DESTROY, () => { + this.scene.events.off(Phaser.Scenes.Events.UPDATE, this.start, this); + this.scene.events.off(Phaser.Scenes.Events.UPDATE, this.update, this); + if (listenDestroy) { + this.destroy(); + } + }); + } + } + scene; + awake() { + // override this + } + start() { + // override this + } + update() { + // override this + } + destroy() { + // override this + } +} diff --git a/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_base/index.js b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_base/index.js new file mode 100644 index 00000000..b33a7528 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_base/index.js @@ -0,0 +1,3 @@ +export { default as ScriptNode } from "./ScriptNode.js"; +export { default as UserComponent } from "./UserComponent.js"; +export { default as ActionTargetComp } from "./ActionTargetComp.js"; diff --git a/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_custom/ActionTargetComp.js b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_custom/ActionTargetComp.js new file mode 100644 index 00000000..bece6761 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_custom/ActionTargetComp.js @@ -0,0 +1,46 @@ +// You can write more code here +/* END-USER-IMPORTS */ +export default class ActionTargetComp { + constructor(gameObject) { + this.gameObject = gameObject; + gameObject["__ActionTargetComp"] = this; + /* START-USER-CTR-CODE */ + // Write your code here. + /* END-USER-CTR-CODE */ + } + static getComponent(gameObject) { + return gameObject["__ActionTargetComp"]; + } + gameObject; + target = "GAME_OBJECT"; + targetName = ""; + /* START-USER-CODE */ + static getTargetGameObject(scriptNode, args) { + const comp = ActionTargetComp.getComponent(scriptNode); + if (comp) { + switch (comp.target) { + case "GAME_OBJECT": + return scriptNode.gameObject; + case "ARG_1": + return args[0]; + case "ARG_2": + return args[1]; + case "ARG_3": + return args[2]; + case "ARG_4": + return args[3]; + case "ARG_5": + return args[4]; + case "ARG_6": + return args[5]; + case "ARG_7": + return args[6]; + case "ARG_8": + return args[7]; + } + } + return scriptNode.gameObject; + } +} +/* END OF COMPILED CODE */ +// You can write more code here diff --git a/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_custom/ScriptNode.js b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_custom/ScriptNode.js new file mode 100644 index 00000000..b4b97dea --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_custom/ScriptNode.js @@ -0,0 +1,95 @@ +import ActionTargetComp from "./ActionTargetComp.js"; +export default class ScriptNode { + _scene; + _gameObject; + _parent; + _children; + constructor(parent) { + this._parent = parent; + if (parent instanceof ScriptNode) { + this._scene = parent.scene; + this._gameObject = parent.gameObject; + parent.add(this); + } + else if (parent instanceof Phaser.GameObjects.GameObject) { + this._scene = parent.scene; + this._gameObject = parent; + } + else { + this._scene = parent; + } + const listenAwake = this.awake !== ScriptNode.prototype.awake; + const listenStart = this.start !== ScriptNode.prototype.start; + const listenUpdate = this.update !== ScriptNode.prototype.update; + const listenDestroy = this.destroy !== ScriptNode.prototype.destroy; + if (listenAwake) { + this.scene.events.once("scene-awake", this.awake, this); + } + if (listenStart) { + this.scene.events.once(Phaser.Scenes.Events.UPDATE, this.start, this); + } + if (listenUpdate) { + this.scene.events.on(Phaser.Scenes.Events.UPDATE, this.update, this); + } + if (listenAwake || listenStart || listenUpdate || listenDestroy) { + const destroyCallback = () => { + this.scene.events.off("scene-awake", this.awake, this); + this.scene.events.off(Phaser.Scenes.Events.UPDATE, this.start, this); + this.scene.events.off(Phaser.Scenes.Events.UPDATE, this.update, this); + if (listenDestroy) { + this.destroy(); + } + }; + if (this.gameObject) { + this.gameObject.on(Phaser.GameObjects.Events.DESTROY, destroyCallback); + } + else { + this.scene.events.on(Phaser.Scenes.Events.SHUTDOWN, destroyCallback); + } + } + } + getActionTargetObject(args) { + const target = ActionTargetComp.getTargetGameObject(this, args); + return target; + } + get scene() { + return this._scene; + } + get gameObject() { + return this._gameObject; + } + get parent() { + return this._parent; + } + get children() { + if (!this._children) { + this._children = []; + } + return this._children; + } + add(child) { + this.children.push(child); + } + executeChildren(...args) { + if (this._children) { + for (const child of this._children) { + child.execute(...args); + } + } + } + execute(...args) { + // override this on executable nodes + } + awake() { + // override this + } + start() { + // override this + } + update() { + // override this + } + destroy() { + // override this + } +} diff --git a/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_custom/UserComponent.js b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_custom/UserComponent.js new file mode 100644 index 00000000..a9cf7729 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_custom/UserComponent.js @@ -0,0 +1,43 @@ +export default class UserComponent { + /** + * @param gameObject The entity. + */ + constructor(gameObject) { + this.scene = gameObject.scene; + const listenAwake = this.awake !== UserComponent.prototype.awake; + const listenStart = this.start !== UserComponent.prototype.start; + const listenUpdate = this.update !== UserComponent.prototype.update; + const listenDestroy = this.destroy !== UserComponent.prototype.destroy; + if (listenAwake) { + this.scene.events.once("scene-awake", this.awake, this); + } + if (listenStart) { + this.scene.events.once(Phaser.Scenes.Events.UPDATE, this.start, this); + } + if (listenUpdate) { + this.scene.events.on(Phaser.Scenes.Events.UPDATE, this.update, this); + } + if (listenStart || listenUpdate || listenDestroy) { + gameObject.on(Phaser.GameObjects.Events.DESTROY, () => { + this.scene.events.off(Phaser.Scenes.Events.UPDATE, this.start, this); + this.scene.events.off(Phaser.Scenes.Events.UPDATE, this.update, this); + if (listenDestroy) { + this.destroy(); + } + }); + } + } + scene; + awake() { + // override this + } + start() { + // override this + } + update() { + // override this + } + destroy() { + // override this + } +} diff --git a/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_custom/index.js b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_custom/index.js new file mode 100644 index 00000000..b33a7528 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/phaserjs_editor_scripts_custom/index.js @@ -0,0 +1,3 @@ +export { default as ScriptNode } from "./ScriptNode.js"; +export { default as UserComponent } from "./UserComponent.js"; +export { default as ActionTargetComp } from "./ActionTargetComp.js"; diff --git a/hugo-site/static/games/power-rangers-intro/src/main.js b/hugo-site/static/games/power-rangers-intro/src/main.js new file mode 100644 index 00000000..f6ad2353 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/src/main.js @@ -0,0 +1,36 @@ +import Preload from "./scenes/Preload.js"; +import Info from "./scenes/Info.js"; +import Title from "./scenes/Title.js"; + +window.addEventListener('load', function () { + + var game = new Phaser.Game({ + width: 256, + height: 224, + type: Phaser.AUTO, + backgroundColor: "#000000", + scale: { + mode: Phaser.Scale.FIT, + autoCenter: Phaser.Scale.CENTER_BOTH + }, + pixelArt: true + }); + + game.scene.add("Preload", Preload); + game.scene.add("Info", Info); + game.scene.add("Title", Title); + game.scene.add("Boot", Boot, true); +}); + +class Boot extends Phaser.Scene { + + preload() { + + this.load.pack("pack", "assets/preload-asset-pack.json"); + } + + create() { + + this.scene.start("Preload"); + } +} diff --git a/hugo-site/static/games/power-rangers-intro/src/scenes/Info.js b/hugo-site/static/games/power-rangers-intro/src/scenes/Info.js new file mode 100755 index 00000000..626f638e --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/src/scenes/Info.js @@ -0,0 +1,89 @@ + +// You can write more code here + +/* START OF COMPILED CODE */ + +import OnAwakeActionScript from "../../phaserjs_editor_scripts_custom/utils/OnAwakeActionScript.js"; +import FadeActionScript from "../../phaserjs_editor_scripts_custom/animations/FadeActionScript.js"; +import FromConfigComp from "../../phaserjs_editor_scripts_custom/animations/components/FromConfigComp.js"; +import ToConfigComp from "../../phaserjs_editor_scripts_custom/animations/components/ToConfigComp.js"; +import DurationConfigComp from "../../phaserjs_editor_scripts_custom/animations/components/DurationConfigComp.js"; +import YoyoConfigComp from "../../phaserjs_editor_scripts_custom/animations/components/YoyoConfigComp.js"; +import RepeatConfigComp from "../../phaserjs_editor_scripts_custom/animations/components/RepeatConfigComp.js"; +/* START-USER-IMPORTS */ +/* END-USER-IMPORTS */ + +export default class Info extends Phaser.Scene { + + constructor() { + super("Info"); + + /* START-USER-CTR-CODE */ + // Write your code here. + /* END-USER-CTR-CODE */ + } + + /** @returns {void} */ + editorCreate() { + + // infoText + const infoText = this.add.text(8, 48.5, "", {}); + infoText.text = "Power Ranges is owned by Hasbro.\n\n\nThis is a fan recreation of the SNES Power Ranges intro, using assets from the game created by Bandai and Saban.\n"; + infoText.setStyle({ "align": "center", "fontFamily": "PressStart2P-Regular", "fontSize": "10px" }); + infoText.setLineSpacing(3); + infoText.setWordWrapWidth(256); + + // clickToPlayText + const clickToPlayText = this.add.text(53, 195, "", {}); + clickToPlayText.text = "Click to start!"; + clickToPlayText.setStyle({ "align": "center", "fontFamily": "PressStart2P-Regular", "fontSize": "10px" }); + clickToPlayText.setLineSpacing(3); + clickToPlayText.setWordWrapWidth(256); + + // onAwakeActionScript + const onAwakeActionScript = new OnAwakeActionScript(this); + + // fadeActionScript + const fadeActionScript = new FadeActionScript(onAwakeActionScript); + + // fadeActionScript (prefab fields) + fadeActionScript.targetGameObject = clickToPlayText; + fadeActionScript.fadeDirection = "FadeOut"; + + // fadeActionScript (components) + const fadeActionScriptFromConfigComp = new FromConfigComp(fadeActionScript); + fadeActionScriptFromConfigComp.from = 1; + new ToConfigComp(fadeActionScript); + const fadeActionScriptDurationConfigComp = new DurationConfigComp(fadeActionScript); + fadeActionScriptDurationConfigComp.duration = 1000; + const fadeActionScriptYoyoConfigComp = new YoyoConfigComp(fadeActionScript); + fadeActionScriptYoyoConfigComp.yoyo = true; + const fadeActionScriptRepeatConfigComp = new RepeatConfigComp(fadeActionScript); + fadeActionScriptRepeatConfigComp.repeat = -1; + + this.events.emit("scene-awake"); + } + + /* START-USER-CODE */ + + // Write your code here + + create() { + + this.editorCreate(); + this.cameras.main.fadeIn(500, 0, 0, 0); + + this.input.once(Phaser.Input.Events.POINTER_DOWN, () => { + this.cameras.main.fadeOut(500, 0, 0, 0); + this.cameras.main.once(Phaser.Cameras.Scene2D.Events.FADE_OUT_COMPLETE, () => { + this.scene.start("Title"); + }); + }); + } + + /* END-USER-CODE */ +} + +/* END OF COMPILED CODE */ + +// You can write more code here diff --git a/hugo-site/static/games/power-rangers-intro/src/scenes/Preload.js b/hugo-site/static/games/power-rangers-intro/src/scenes/Preload.js new file mode 100644 index 00000000..9afe6f04 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/src/scenes/Preload.js @@ -0,0 +1,64 @@ + +// You can write more code here + +/* START OF COMPILED CODE */ + +/* START-USER-IMPORTS */ +/* END-USER-IMPORTS */ + +export default class Preload extends Phaser.Scene { + + constructor() { + super("Preload"); + + /* START-USER-CTR-CODE */ + // Write your code here. + /* END-USER-CTR-CODE */ + } + + /** @returns {void} */ + editorPreload() { + + this.load.pack("asset-pack", "assets/asset-pack.json"); + } + + /** @returns {void} */ + editorCreate() { + + // logo + const logo = this.add.image(128, 210, "editorhero-logo"); + logo.scaleX = 0.2; + logo.scaleY = 0.2; + + // text_1 + const text_1 = this.add.text(37, 54, "", {}); + text_1.text = "Created using"; + text_1.setStyle({ "fontFamily": "PressStart2P-Regular", "fontSize": "14px" }); + + this.events.emit("scene-awake"); + } + + /* START-USER-CODE */ + + // Write your code here + + preload() { + this.editorCreate(); + this.editorPreload(); + } + + create() { + this.time.delayedCall(1000, () => { + this.cameras.main.fadeOut(500, 0, 0, 0); + this.cameras.main.once(Phaser.Cameras.Scene2D.Events.FADE_OUT_COMPLETE, () => { + this.scene.start("Info"); + }); + }); + } + + /* END-USER-CODE */ +} + +/* END OF COMPILED CODE */ + +// You can write more code here diff --git a/hugo-site/static/games/power-rangers-intro/src/scenes/Title.js b/hugo-site/static/games/power-rangers-intro/src/scenes/Title.js new file mode 100755 index 00000000..b2364232 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/src/scenes/Title.js @@ -0,0 +1,233 @@ + +// You can write more code here + +/* START OF COMPILED CODE */ + +import DurationConfigComp from "../../phaserjs_editor_scripts_custom/animations/components/DurationConfigComp.js"; +import OnAwakeActionScript from "../../phaserjs_editor_scripts_custom/utils/OnAwakeActionScript.js"; +import FadeActionScript from "../../phaserjs_editor_scripts_custom/animations/FadeActionScript.js"; +import FromConfigComp from "../../phaserjs_editor_scripts_custom/animations/components/FromConfigComp.js"; +import ToConfigComp from "../../phaserjs_editor_scripts_custom/animations/components/ToConfigComp.js"; +import DelayConfigComp from "../../phaserjs_editor_scripts_custom/animations/components/DelayConfigComp.js"; +import MoveToActionScript from "../../phaserjs_editor_scripts_custom/animations/MoveToActionScript.js"; +import EaseConfigComp from "../../phaserjs_editor_scripts_custom/animations/components/EaseConfigComp.js"; +import TimeEventActionScript from "../../phaserjs_editor_scripts_custom/timer/TimeEventActionScript.js"; +import SetVisibleActionScript from "../../phaserjs_editor_scripts_custom/gameobjects/SetVisibleActionScript.js"; +import PlaySpriteAnimationActionScript from "../../phaserjs_editor_scripts_custom/gameobjects/PlaySpriteAnimationActionScript.js"; +import LogoFlashActionScript from "../scriptnodes/LogoFlashActionScript.js"; +import CustomCameraFlashActionScript from "../scriptnodes/CustomCameraFlashActionScript.js"; +import PlaySoundActionScript from "../../phaserjs_editor_scripts_custom/audio/PlaySoundActionScript.js"; +import AudioLoopConfigComp from "../../phaserjs_editor_scripts_custom/audio/components/AudioLoopConfigComp.js"; +/* START-USER-IMPORTS */ +/* END-USER-IMPORTS */ + +export default class Title extends Phaser.Scene { + + constructor() { + super("Title"); + + /* START-USER-CTR-CODE */ + // Write your code here. + /* END-USER-CTR-CODE */ + } + + /** @returns {void} */ + editorCreate() { + + // lightningSprite + const lightningSprite = this.add.sprite(128, 112, "lightning_spritesheet", 0); + lightningSprite.visible = false; + + // logoContainer + const logoContainer = this.add.container(137, 67); + + // mirror + const mirror = this.add.image(0, 0, "logo_spritesheet", "mirror.png"); + mirror.scaleX = 0.5; + mirror.scaleY = 0.5; + mirror.alpha = 0; + mirror.alphaTopLeft = 0; + mirror.alphaTopRight = 0; + mirror.alphaBottomLeft = 0; + mirror.alphaBottomRight = 0; + logoContainer.add(mirror); + + // text + const text = this.add.image(0, 0, "logo_spritesheet", "text.png"); + text.scaleX = 0.5; + text.scaleY = 0.5; + text.visible = false; + logoContainer.add(text); + + // shineFx + text.preFX.addShine(0.7, 0.2, 1, false); + + // bolt + const bolt = this.add.image(0, -138, "logo_spritesheet", "bolt.png"); + bolt.scaleX = 0.5; + bolt.scaleY = 0.5; + logoContainer.add(bolt); + + // musicCreditText + const musicCreditText = this.add.text(36, 195, "", {}); + musicCreditText.visible = false; + musicCreditText.text = "Music by: Powerglove\n\nThe Power Rangers Theme"; + musicCreditText.setStyle({ "align": "center", "fontFamily": "PressStart2P-Regular", "fontSize": "8px" }); + + // startIntroOnAwakeActionScript + const startIntroOnAwakeActionScript = new OnAwakeActionScript(this); + + // fadeInMirrorActionScript + const fadeInMirrorActionScript = new FadeActionScript(startIntroOnAwakeActionScript); + + // moveBoltToMirrorActionScript + const moveBoltToMirrorActionScript = new MoveToActionScript(fadeInMirrorActionScript); + + // moveBoltDuringCollisionActionScript + const moveBoltDuringCollisionActionScript = new MoveToActionScript(moveBoltToMirrorActionScript); + + // moveMirrorDuringCollisionActionScript + const moveMirrorDuringCollisionActionScript = new MoveToActionScript(moveBoltToMirrorActionScript); + + // delayActionScriptForLightningStartAnimation + const delayActionScriptForLightningStartAnimation = new TimeEventActionScript(moveBoltToMirrorActionScript); + + // setVisibleActionScriptForLightning + const setVisibleActionScriptForLightning = new SetVisibleActionScript(delayActionScriptForLightningStartAnimation); + + // playSpriteAnimationActionScript + const playSpriteAnimationActionScript = new PlaySpriteAnimationActionScript(setVisibleActionScriptForLightning); + + // timeEventActionScriptForShowingLogo + const timeEventActionScriptForShowingLogo = new TimeEventActionScript(moveBoltToMirrorActionScript); + + // setVisibleActionScriptForTitleText + const setVisibleActionScriptForTitleText = new SetVisibleActionScript(timeEventActionScriptForShowingLogo); + + // logoFlashActionScript + const logoFlashActionScript = new LogoFlashActionScript(setVisibleActionScriptForTitleText); + + // setVisibleActionScript + const setVisibleActionScript = new SetVisibleActionScript(logoFlashActionScript); + + // customCameraFlashActionScript + const customCameraFlashActionScript = new CustomCameraFlashActionScript(moveBoltToMirrorActionScript); + + // playSoundActionScript + const playSoundActionScript = new PlaySoundActionScript(moveBoltToMirrorActionScript); + + // lists + const objectsToIgnoreForCameraFlash = [lightningSprite, text, mirror]; + + // bolt (components) + const boltDurationConfigComp = new DurationConfigComp(bolt); + boltDurationConfigComp.duration = 2000; + + // fadeInMirrorActionScript (prefab fields) + fadeInMirrorActionScript.targetGameObject = mirror; + fadeInMirrorActionScript.fadeDirection = "FadeIn"; + + // fadeInMirrorActionScript (components) + new FromConfigComp(fadeInMirrorActionScript); + const fadeInMirrorActionScriptToConfigComp = new ToConfigComp(fadeInMirrorActionScript); + fadeInMirrorActionScriptToConfigComp.to = 1; + const fadeInMirrorActionScriptDurationConfigComp = new DurationConfigComp(fadeInMirrorActionScript); + fadeInMirrorActionScriptDurationConfigComp.duration = 800; + const fadeInMirrorActionScriptDelayConfigComp = new DelayConfigComp(fadeInMirrorActionScript); + fadeInMirrorActionScriptDelayConfigComp.delay = 1000; + + // moveBoltToMirrorActionScript (prefab fields) + moveBoltToMirrorActionScript.targetGameObject = bolt; + + // moveBoltToMirrorActionScript (components) + new DurationConfigComp(moveBoltToMirrorActionScript); + new EaseConfigComp(moveBoltToMirrorActionScript); + + // moveBoltDuringCollisionActionScript (prefab fields) + moveBoltDuringCollisionActionScript.targetGameObject = bolt; + moveBoltDuringCollisionActionScript.y = 5; + moveBoltDuringCollisionActionScript.yoyo = true; + + // moveBoltDuringCollisionActionScript (components) + const moveBoltDuringCollisionActionScriptDurationConfigComp = new DurationConfigComp(moveBoltDuringCollisionActionScript); + moveBoltDuringCollisionActionScriptDurationConfigComp.duration = 200; + new EaseConfigComp(moveBoltDuringCollisionActionScript); + + // moveMirrorDuringCollisionActionScript (prefab fields) + moveMirrorDuringCollisionActionScript.targetGameObject = mirror; + moveMirrorDuringCollisionActionScript.y = 5; + moveMirrorDuringCollisionActionScript.yoyo = true; + + // moveMirrorDuringCollisionActionScript (components) + const moveMirrorDuringCollisionActionScriptDurationConfigComp = new DurationConfigComp(moveMirrorDuringCollisionActionScript); + moveMirrorDuringCollisionActionScriptDurationConfigComp.duration = 200; + new EaseConfigComp(moveMirrorDuringCollisionActionScript); + + // delayActionScriptForLightningStartAnimation (prefab fields) + delayActionScriptForLightningStartAnimation.delay = 200; + + // setVisibleActionScriptForLightning (prefab fields) + setVisibleActionScriptForLightning.targetGameObject = lightningSprite; + + // playSpriteAnimationActionScript (prefab fields) + playSpriteAnimationActionScript.targetGameObject = lightningSprite; + playSpriteAnimationActionScript.animationKey = "lightningStrikes"; + playSpriteAnimationActionScript.ignoreIfPlaying = true; + + // timeEventActionScriptForShowingLogo (prefab fields) + timeEventActionScriptForShowingLogo.delay = 1200; + + // setVisibleActionScriptForTitleText (prefab fields) + setVisibleActionScriptForTitleText.targetGameObject = text; + setVisibleActionScriptForTitleText.visible = true; + + // logoFlashActionScript (prefab fields) + logoFlashActionScript.targetGameObject = text; + + // setVisibleActionScript (prefab fields) + setVisibleActionScript.targetGameObject = musicCreditText; + + // customCameraFlashActionScript (prefab fields) + customCameraFlashActionScript.objectsToIgnore = objectsToIgnoreForCameraFlash; + + // playSoundActionScript (prefab fields) + playSoundActionScript.audioKey = "power_glove_power_rangers"; + + // playSoundActionScript (components) + new AudioLoopConfigComp(playSoundActionScript); + + this.lightningSprite = lightningSprite; + this.mirror = mirror; + this.text = text; + this.bolt = bolt; + this.objectsToIgnoreForCameraFlash = objectsToIgnoreForCameraFlash; + + this.events.emit("scene-awake"); + } + + /** @type {Phaser.GameObjects.Sprite} */ + lightningSprite; + /** @type {Phaser.GameObjects.Image} */ + mirror; + /** @type {Phaser.GameObjects.Image} */ + text; + /** @type {Phaser.GameObjects.Image} */ + bolt; + /** @type {Array} */ + objectsToIgnoreForCameraFlash; + + /* START-USER-CODE */ + + // Write your code here + + create() { + + this.editorCreate(); + } + + /* END-USER-CODE */ +} + +/* END OF COMPILED CODE */ + +// You can write more code here diff --git a/hugo-site/static/games/power-rangers-intro/src/scriptnodes/CustomCameraFlashActionScript.js b/hugo-site/static/games/power-rangers-intro/src/scriptnodes/CustomCameraFlashActionScript.js new file mode 100755 index 00000000..daa9060e --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/src/scriptnodes/CustomCameraFlashActionScript.js @@ -0,0 +1,46 @@ + +// You can write more code here + +/* START OF COMPILED CODE */ + +import ScriptNode from "../../phaserjs_editor_scripts_base/ScriptNode.js"; +/* START-USER-IMPORTS */ +/* END-USER-IMPORTS */ + +export default class CustomCameraFlashActionScript extends ScriptNode { + + constructor(parent) { + super(parent); + + /* START-USER-CTR-CODE */ + // Write your code here. + /* END-USER-CTR-CODE */ + } + + /** @type {Phaser.GameObjects.GameObject[]} */ + objectsToIgnore = []; + + /* START-USER-CODE */ + + // Write your code here. + execute() { + /** @type {Phaser.Scene} */ + const scene = this.scene; + const camera = scene.cameras.add(); + camera.ignore(this.objectsToIgnore); + scene.cameras.main.fadeOut(400, 255, 255, 255); + scene.cameras.main.once(Phaser.Cameras.Scene2D.Events.FADE_OUT_COMPLETE, () => { + scene.cameras.main.fadeIn(1000, 255, 255, 255); + }); + scene.cameras.main.once(Phaser.Cameras.Scene2D.Events.FADE_IN_COMPLETE, () => { + scene.cameras.remove(camera); + this.executeChildren(); + }); + } + + /* END-USER-CODE */ +} + +/* END OF COMPILED CODE */ + +// You can write more code here diff --git a/hugo-site/static/games/power-rangers-intro/src/scriptnodes/LogoFlashActionScript.js b/hugo-site/static/games/power-rangers-intro/src/scriptnodes/LogoFlashActionScript.js new file mode 100755 index 00000000..ef42b4c7 --- /dev/null +++ b/hugo-site/static/games/power-rangers-intro/src/scriptnodes/LogoFlashActionScript.js @@ -0,0 +1,48 @@ + +// You can write more code here + +/* START OF COMPILED CODE */ + +import ScriptNodeWithTarget from "../../phaserjs_editor_scripts_custom/base/ScriptNodeWithTarget.js"; +import ScriptNode from "../../phaserjs_editor_scripts_base/ScriptNode.js"; +/* START-USER-IMPORTS */ +/* END-USER-IMPORTS */ + +export default class LogoFlashActionScript extends ScriptNodeWithTarget { + + constructor(parent) { + super(parent); + + /* START-USER-CTR-CODE */ + // Write your code here. + /* END-USER-CTR-CODE */ + } + + /* START-USER-CODE */ + + // Write your code here. + execute(...args) { + const gameObject = this.getActionTargetObject(args); + /** @type {Phaser.FX.ColorMatrix} */ + const fx = gameObject.preFX.addColorMatrix(); + fx.brightness(20); + this.scene.tweens.addCounter({ + from: 20, + to: 1, + duration: 800, + onUpdate: (tween, data) => { + fx.brightness(data.value) + }, + onComplete: () => { + gameObject.preFX.remove(fx); + this.executeChildren(); + } + }); + } + + /* END-USER-CODE */ +} + +/* END OF COMPILED CODE */ + +// You can write more code here