From a44db77003cf0cea02737fb3a3cd6ce56479e65e Mon Sep 17 00:00:00 2001 From: Davis Date: Mon, 31 Jan 2022 19:12:21 -0600 Subject: [PATCH 01/10] Update Liscense --- jumpD/assets/into1.txt | 14 ++++++++++++++ jumpD/js/ManagePhysics.js | 4 ++++ jumpD/js/Player.js | 27 +++++++++++++++++++++++---- jumpD/js/SceneMain.js | 1 + jumpD/js/intro.js | 5 +++++ jumpD/js/tileMap.js | 35 ++++++++++++++++++++++++++++++++--- 6 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 jumpD/assets/into1.txt create mode 100644 jumpD/js/intro.js diff --git a/jumpD/assets/into1.txt b/jumpD/assets/into1.txt new file mode 100644 index 0000000..664351f --- /dev/null +++ b/jumpD/assets/into1.txt @@ -0,0 +1,14 @@ +I have, in the past, been told +that there are things you can't do +once you grow older + +that in the "real world" +you can't play with your toys +first your blanket, your teddy bear +then your toys and books + +expectations are higher +people aren't kind and nice to others +the + +I decided diff --git a/jumpD/js/ManagePhysics.js b/jumpD/js/ManagePhysics.js index a741bd2..cf05c7c 100644 --- a/jumpD/js/ManagePhysics.js +++ b/jumpD/js/ManagePhysics.js @@ -8,4 +8,8 @@ function updatePhysics() { scene.player.updatePhysics(); scene.tilemap.updatePhysics(); +} +function cleanPhysics(){ + scene.tilemap.cleanPhysics(); + scene.player.cleanPhysics(); } \ No newline at end of file diff --git a/jumpD/js/Player.js b/jumpD/js/Player.js index 9ab779d..c66add7 100644 --- a/jumpD/js/Player.js +++ b/jumpD/js/Player.js @@ -8,6 +8,10 @@ class Player { frameHeight: 32 }); this.keys = makeKeys(['w', 'a', 's', 'd', 'j']); + var spaceBar = scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); + this.keys.push(spaceBar); + this.keys.SPACE = spaceBar; + this.drag = 300; this.maxVelocityX = 180; @@ -30,20 +34,28 @@ class Player { const animation = animations[i]; console.log(player.anims.create(animation)); } - scene.input.keyboard.on("keyup", this.onKeyUp); + scene.input.keyboard.on("keyup", this.onKeyUp.bind(this)); } onKeyUp(event) { if (event.keyCode == Phaser.Input.Keyboard.KeyCodes.J) { - scene.tilemap.swapLayers(); + + this.swap = true; + } } + cleanPhysics(){ + this.swap = false; + } updatePhysics() { + var onFloor; if (player.body.onFloor()) { player.setDragX(this.drag); + onFloor = true; } else { + onFloor = false; player.setDragX(0); } let downKeys = getKeysDown(this.keys); @@ -55,6 +67,8 @@ class Player { for (var i in downKeys) { switch (downKeys[i]) { case keys.w: + case keys.SPACE: + console.log('Space down') up = true; break; case keys.a: @@ -67,16 +81,21 @@ class Player { break; } } + if (this.swap){ + scene.tilemap.swapLayers(); + } let cursors = this.cursors; if (cursors.left.isDown || left) { - player.setAccelerationX(-180); + let dragBonus = onFloor && player.body.velocity.x > 0 ? -this.drag : 0; + player.setAccelerationX(-180 + dragBonus); player.anims.play('walk', true); player.flipX = true; } else if (cursors.right.isDown || right) { - player.setAccelerationX(180); + let dragBonus = onFloor && player.body.velocity.x < 0 ? this.drag : 0; + player.setAccelerationX(180 + dragBonus); player.play('walk', true); player.flipX = false; diff --git a/jumpD/js/SceneMain.js b/jumpD/js/SceneMain.js index 956a367..5d7fa5c 100644 --- a/jumpD/js/SceneMain.js +++ b/jumpD/js/SceneMain.js @@ -24,6 +24,7 @@ class SceneMain extends Phaser.Scene { } update() { updatePhysics(); + cleanPhysics(); } } \ No newline at end of file diff --git a/jumpD/js/intro.js b/jumpD/js/intro.js new file mode 100644 index 0000000..8c13c15 --- /dev/null +++ b/jumpD/js/intro.js @@ -0,0 +1,5 @@ +class TextScreen extends Phaser.Scene{ + constructor(){ + + } +} \ No newline at end of file diff --git a/jumpD/js/tileMap.js b/jumpD/js/tileMap.js index 82a9ff3..ab08d91 100644 --- a/jumpD/js/tileMap.js +++ b/jumpD/js/tileMap.js @@ -37,16 +37,45 @@ class tilemap { let c1 = scene.physics.add.collider(this.Layer1, player); let c2 = scene.physics.add.collider(this.Layer2, player); c2.active = false; + /*let o1 = scene.physics.add.overlap(this.Layer1,player,function(bdy1,ci){ + if (ci && (ci.collideUp && ci.collideDown && ci.collideRight && ci.collideLeft)){ + this.Layer1.playerInzone = true; + } + }.bind(this)); + let o2 = scene.physics.add.overlap(this.Layer2,player, function(bdy1,ci){ + if (ci){ + //console.log(ci); + } + if (ci && (ci.collideUp && ci.collideDown && ci.collideRight && ci.collideLeft)){ + this.Layer1.playerInzone = true; + } + }.bind(this))*/ this.colliders = [c1, c2]; } + cleanPhysics(){ + for(var i in this.layers){ + this.layers[i].playerInzone = false; + } + } + isPlayerInZone(layer){ + let bounds = player.getBounds(); + let tiles = layer.getTilesWithinShape(bounds, {isNotEmpty: true}); + let overlap = scene.physics.overlapTiles(player,tiles); + return overlap; + } swapLayers() { + let currentCollider = this.colliders[this.activeLayer]; let currentLayer = this.layers[this.activeLayer]; - this.activeLayer = (this.activeLayer + 1) % 2; + let activeLayer = (this.activeLayer + 1) % 2; + + let newCollider = this.colliders[activeLayer]; + let newLayer = this.layers[activeLayer]; + + if (this.isPlayerInZone(newLayer)) return; - let newCollider = this.colliders[this.activeLayer]; - let newLayer = this.layers[this.activeLayer]; + this.activeLayer = activeLayer; currentCollider.active = false; newCollider.active = true; From e18b0d288f5e5944d5c3321d4dd44d015549d562 Mon Sep 17 00:00:00 2001 From: Davis Date: Sun, 20 Feb 2022 19:33:15 -0600 Subject: [PATCH 02/10] added intro text file --- jumpD/assets/into1.txt | 14 +++++++++++++- jumpD/assets/outro1.txt | 0 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 jumpD/assets/outro1.txt diff --git a/jumpD/assets/into1.txt b/jumpD/assets/into1.txt index 664351f..fc52804 100644 --- a/jumpD/assets/into1.txt +++ b/jumpD/assets/into1.txt @@ -11,4 +11,16 @@ expectations are higher people aren't kind and nice to others the -I decided +I decided not to visit this "real world" + +Care to Join Me? + +'Yes'/'No' + +'Yes' Welcome! + +'No' What will you do now? + +'Wait.'/'Goodbye' + +'Wait' Care to Join Me? \ No newline at end of file diff --git a/jumpD/assets/outro1.txt b/jumpD/assets/outro1.txt new file mode 100644 index 0000000..e69de29 From b4e11ec8c5b82d522336e5feed38320dd7ce90ab Mon Sep 17 00:00:00 2001 From: anonymouscript Date: Mon, 14 Mar 2022 10:47:18 -0500 Subject: [PATCH 03/10] finally added multi scenes --- _config.yml | 5 ++- jumpD/index.html | 23 ++--------- jumpD/js/SceneMain.js | 3 +- jumpD/{assets/into1.txt => js/into1.js} | 4 +- jumpD/js/intro.js | 52 +++++++++++++++++++++++-- jumpD/js/main.js | 22 +++++++++++ 6 files changed, 82 insertions(+), 27 deletions(-) rename jumpD/{assets/into1.txt => js/into1.js} (84%) create mode 100644 jumpD/js/main.js diff --git a/_config.yml b/_config.yml index c38ae10..60582bb 100644 --- a/_config.yml +++ b/_config.yml @@ -42,12 +42,15 @@ plugins: # exclude: - vendor/bundle/ + - .github + - .git + - node_modules/ # - .sass-cache/ # - .jekyll-cache/ # - gemfiles/ # - Gemfile # - Gemfile.lock -# - node_modules/ + # - vendor/cache/ # - vendor/gems/ diff --git a/jumpD/index.html b/jumpD/index.html index bebdde1..7c88bff 100644 --- a/jumpD/index.html +++ b/jumpD/index.html @@ -6,6 +6,7 @@ + @@ -13,27 +14,9 @@ + + - \ No newline at end of file diff --git a/jumpD/js/SceneMain.js b/jumpD/js/SceneMain.js index 5d7fa5c..21bcce6 100644 --- a/jumpD/js/SceneMain.js +++ b/jumpD/js/SceneMain.js @@ -1,6 +1,6 @@ class SceneMain extends Phaser.Scene { constructor() { - super("SceneMain"); + super({ key: "scenemain", visible: true }); } preload() { console.log("loading") @@ -8,6 +8,7 @@ class SceneMain extends Phaser.Scene { this.tilemap = new tilemap(); this.tilemap.loadTilemapForest(); camera = this.cameras.main; + } create() { diff --git a/jumpD/assets/into1.txt b/jumpD/js/into1.js similarity index 84% rename from jumpD/assets/into1.txt rename to jumpD/js/into1.js index fc52804..0d59e83 100644 --- a/jumpD/assets/into1.txt +++ b/jumpD/js/into1.js @@ -1,4 +1,4 @@ -I have, in the past, been told +let intro1 = ` I have, in the past, been told that there are things you can't do once you grow older @@ -23,4 +23,4 @@ Care to Join Me? 'Wait.'/'Goodbye' -'Wait' Care to Join Me? \ No newline at end of file +'Wait' Care to Join Me?` \ No newline at end of file diff --git a/jumpD/js/intro.js b/jumpD/js/intro.js index 8c13c15..232fbc2 100644 --- a/jumpD/js/intro.js +++ b/jumpD/js/intro.js @@ -1,5 +1,51 @@ -class TextScreen extends Phaser.Scene{ - constructor(){ - +class FirstScreen extends Phaser.Scene { + constructor() { + super("FirstScreen"); + this.style = { + fontFace: "libreBaskerville", + fontSize: "75px" + }; + } + preload() { + console.log("preload") + this.centerX = config.width / 2; + this.centerY = config.height / 2; + var LibreBaskerville = new FontFace("LibreBaskerville", `url(assets/fonts/Libre-Baskerville/LibreBaskerville-Regular.ttf)`) + } + startPointerDown() { + this.startTween.resume(); + console.log("start tween") + } + activateSceneMain() { + console.log('activate scene') + this.scene.launch('scenemain') + //this.scene.add(scene); + + //this.scene.start("scenemain"); + //this.scene.pause(); + } + create() { + //this.scene.add("SceneMain") + let start = this.add.text(this.centerX, this.centerY * 0.95, "Start", this.style); + start.setOrigin(0.5, 0.5); + start.setInteractive(); + start.on('pointerdown', this.startPointerDown, this); + this.startTween = this.tweens.add({ + targets: [start], + duration: 1000, + alpha: 0, + paused: true, + ease: "power0", + onComplete: this.activateSceneMain.bind(this) + + }); + + + + } + update() { + + } + } \ No newline at end of file diff --git a/jumpD/js/main.js b/jumpD/js/main.js new file mode 100644 index 0000000..4c2e1ab --- /dev/null +++ b/jumpD/js/main.js @@ -0,0 +1,22 @@ +var Game; +Game = 1; + +var config = { + type: Phaser.AUTO, + width: 800, + height: 600, + physics: { + default: 'arcade', + arcade: { + gravity: { + y: 200 + } + } + }, + pixelArt: true, + scene: [SceneMain, FirstScreen] +}; + +Game = new Phaser.Game(config); +var scene = Game.scene.scenes[0]; +var startScene = Game.scene.scenes[1]; \ No newline at end of file From ac9f54b1757f021606b045a08a7036290d2915ff Mon Sep 17 00:00:00 2001 From: anonymouscript Date: Mon, 14 Mar 2022 11:38:33 -0500 Subject: [PATCH 04/10] Did some mainence --- jumpD/assets/fonts/Libre-Baskerville | 1 + jumpD/index.html | 3 ++- jumpD/js/SceneMain.js | 1 + jumpD/js/intro.js | 1 + jumpD/js/main.js | 12 +++++++++--- 5 files changed, 14 insertions(+), 4 deletions(-) create mode 160000 jumpD/assets/fonts/Libre-Baskerville diff --git a/jumpD/assets/fonts/Libre-Baskerville b/jumpD/assets/fonts/Libre-Baskerville new file mode 160000 index 0000000..2fba7c8 --- /dev/null +++ b/jumpD/assets/fonts/Libre-Baskerville @@ -0,0 +1 @@ +Subproject commit 2fba7c8e0a8f53f86efd3d81bc4c63674b0c613f diff --git a/jumpD/index.html b/jumpD/index.html index 7c88bff..b087596 100644 --- a/jumpD/index.html +++ b/jumpD/index.html @@ -6,7 +6,7 @@ - +
@@ -16,6 +16,7 @@ +
diff --git a/jumpD/js/SceneMain.js b/jumpD/js/SceneMain.js index 21bcce6..fa787d9 100644 --- a/jumpD/js/SceneMain.js +++ b/jumpD/js/SceneMain.js @@ -1,6 +1,7 @@ class SceneMain extends Phaser.Scene { constructor() { super({ key: "scenemain", visible: true }); + scene = this; } preload() { console.log("loading") diff --git a/jumpD/js/intro.js b/jumpD/js/intro.js index 232fbc2..5f90829 100644 --- a/jumpD/js/intro.js +++ b/jumpD/js/intro.js @@ -1,6 +1,7 @@ class FirstScreen extends Phaser.Scene { constructor() { super("FirstScreen"); + startScreen = this; this.style = { fontFace: "libreBaskerville", fontSize: "75px" diff --git a/jumpD/js/main.js b/jumpD/js/main.js index 4c2e1ab..bd3543c 100644 --- a/jumpD/js/main.js +++ b/jumpD/js/main.js @@ -1,6 +1,11 @@ var Game; -Game = 1; - +var scene; +var startscene; +/*a global method is prefered here, initialized by the constructor, because + *with the amount of things that need to access the scene, it makes sense for + *it to be able to be accessed globally, instead of mangling a bunch of bind + *method calls, you know what you are getting + */ var config = { type: Phaser.AUTO, width: 800, @@ -19,4 +24,5 @@ var config = { Game = new Phaser.Game(config); var scene = Game.scene.scenes[0]; -var startScene = Game.scene.scenes[1]; \ No newline at end of file +var startScene = Game.scene.scenes[1]; +console.log("main finished") \ No newline at end of file From c2a6a5fe4921a5f9e7f1667f94f3d349e729b0c2 Mon Sep 17 00:00:00 2001 From: anonymouscript Date: Mon, 14 Mar 2022 16:56:19 -0500 Subject: [PATCH 05/10] scene switch actually works don't change --- jumpD/js/SceneMain.js | 4 +++- jumpD/js/intro.js | 12 ++++-------- jumpD/js/main.js | 5 ++--- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/jumpD/js/SceneMain.js b/jumpD/js/SceneMain.js index fa787d9..68b8b19 100644 --- a/jumpD/js/SceneMain.js +++ b/jumpD/js/SceneMain.js @@ -1,7 +1,8 @@ class SceneMain extends Phaser.Scene { constructor() { - super({ key: "scenemain", visible: true }); + super({ key: "scenemain" }); scene = this; + } preload() { console.log("loading") @@ -9,6 +10,7 @@ class SceneMain extends Phaser.Scene { this.tilemap = new tilemap(); this.tilemap.loadTilemapForest(); camera = this.cameras.main; + this.scene.setActive(false, 'scenemain'); } create() { diff --git a/jumpD/js/intro.js b/jumpD/js/intro.js index 5f90829..3ee9829 100644 --- a/jumpD/js/intro.js +++ b/jumpD/js/intro.js @@ -1,7 +1,7 @@ class FirstScreen extends Phaser.Scene { constructor() { super("FirstScreen"); - startScreen = this; + this.style = { fontFace: "libreBaskerville", fontSize: "75px" @@ -16,15 +16,11 @@ class FirstScreen extends Phaser.Scene { } startPointerDown() { this.startTween.resume(); - console.log("start tween") + console.log("start tween"); } activateSceneMain() { - console.log('activate scene') - this.scene.launch('scenemain') - //this.scene.add(scene); - - //this.scene.start("scenemain"); - //this.scene.pause(); + console.log('activate scene'); + Game.scene.add("scenemain", SceneMain, true); } create() { //this.scene.add("SceneMain") diff --git a/jumpD/js/main.js b/jumpD/js/main.js index bd3543c..21bd7a7 100644 --- a/jumpD/js/main.js +++ b/jumpD/js/main.js @@ -19,10 +19,9 @@ var config = { } }, pixelArt: true, - scene: [SceneMain, FirstScreen] + scene: FirstScreen }; Game = new Phaser.Game(config); -var scene = Game.scene.scenes[0]; -var startScene = Game.scene.scenes[1]; +var startScene = Game.scene.scenes[0]; console.log("main finished") \ No newline at end of file From d511b638716300d7293b0beecf50de51ffaf0b0d Mon Sep 17 00:00:00 2001 From: Davis Date: Sat, 19 Mar 2022 08:07:31 -0500 Subject: [PATCH 06/10] started a text crawl, must write it better --- LISCENSE (1) | 12 +++++++++++ jumpD/js/intro.js | 54 +++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 LISCENSE (1) diff --git a/LISCENSE (1) b/LISCENSE (1) new file mode 100644 index 0000000..eb3a6df --- /dev/null +++ b/LISCENSE (1) @@ -0,0 +1,12 @@ +The following liscense applies to all files on this website except where another liscense is provided +(Generally a liscense will be provided in a parent folder. A liscense overides a different one in a parent folder) + +Content refers to any text, web page, music, images, etc. + +By providing any content to you, you recieve an implicit liscense to view said content, on an As-Is and As-provided Basis. +I do not have any liability to you for the content provided. + +You may distribute content on this website non-commertially as long as you give credit, provide a link back to this website, and allow others to do the same, under the same terms with no further conditions. + +You may also use this content under the terms of the GNU GPLv3 availible here: https://www.gnu.org/licenses/gpl-3.0-standalone.html +also at https://davidorgan.com/GNU-GPLv3.0.html \ No newline at end of file diff --git a/jumpD/js/intro.js b/jumpD/js/intro.js index 3ee9829..a53b890 100644 --- a/jumpD/js/intro.js +++ b/jumpD/js/intro.js @@ -4,7 +4,11 @@ class FirstScreen extends Phaser.Scene { this.style = { fontFace: "libreBaskerville", - fontSize: "75px" + fontSize: "75px", + wordWrap: { + width: 670, + advanced: false + } }; } @@ -14,6 +18,32 @@ class FirstScreen extends Phaser.Scene { this.centerY = config.height / 2; var LibreBaskerville = new FontFace("LibreBaskerville", `url(assets/fonts/Libre-Baskerville/LibreBaskerville-Regular.ttf)`) } + secondSlide(){ + + this.style.fontSize = "20px" + this.out = this.add.text(50,50, "", this.style); + this.slide = 1; + } + slidethree(){ + this.slide = 2; + } + printText(textObj, text, callback, args, scope){ + if(this.wait && this.wait > 0){ + this.wait -= 1000/60 + return text; + } + if(text[0] == "<"){ + let dex = text.indexOf(">"); + let newS = text.slice(1, dex); + this.wait += +newS; + return text.slice(dex + 1); + } + textObj.text += text[0]; + let s = text.slice(1); + this.wait += 1000/60 + return s == "" ? callback.bind(scope)(args) : s; + + } startPointerDown() { this.startTween.resume(); console.log("start tween"); @@ -34,15 +64,25 @@ class FirstScreen extends Phaser.Scene { alpha: 0, paused: true, ease: "power0", - onComplete: this.activateSceneMain.bind(this) - + onComplete: this.secondSlide.bind(this) }); - - + + this.start = start; + this.slide = 0; + this.index = 0; + this.wait = 0; + this.text = `I have a fear of growing up. A fear of <1000>being<150>\nimprissoned<1500> by social expectation, <1000>losing my freedom.`; + this.slide2 = [`when I'm older<1000>`,`when I grow up<1000>`,`when I get a job<1000>`, `in the<1000>`,"Real World<750>"]; } update() { - + if(this.slide == 1){ + let text = this.printText(this.out, this.text, this.slidethree, null, this); + this.text = text + } + if (this.slide == 2){ + let text = this.printText() + } } -} \ No newline at end of file +} From 097d54f3f4a570186843f53f734c56719ff66c02 Mon Sep 17 00:00:00 2001 From: Davis Date: Thu, 31 Mar 2022 17:18:48 -0500 Subject: [PATCH 07/10] include by liquid, libre js compatible, middle of overhauling js --- jumpD/LISCENSE | 9 ++-- jumpD/index.html | 51 ++++++++++++++++++++++- jumpD/js/Button.js | 30 +++++++++++++ jumpD/js/Queue.js | 19 +++++++++ jumpD/js/component interface | 3 ++ jumpD/js/intro.js | 81 +++++------------------------------- jumpD/js/intro.js.old | 78 ++++++++++++++++++++++++++++++++++ jumpD/js/listener.js | 25 +++++++++++ jumpD/js/textScroll.js | 40 ++++++++++++++++++ privacy/index.md | 2 +- 10 files changed, 259 insertions(+), 79 deletions(-) create mode 100644 jumpD/js/Button.js create mode 100644 jumpD/js/Queue.js create mode 100644 jumpD/js/component interface create mode 100644 jumpD/js/intro.js.old create mode 100644 jumpD/js/listener.js create mode 100644 jumpD/js/textScroll.js diff --git a/jumpD/LISCENSE b/jumpD/LISCENSE index afc8c48..41c8431 100644 --- a/jumpD/LISCENSE +++ b/jumpD/LISCENSE @@ -1,6 +1,3 @@ -This Game is availible under the GNU-GPLv3.0 liscense with the following additional condition added to the liscense: - if you modify the game you must tell others that the game was modified - if you change the game so the gameplay is different (e.g. add levels, change mechanics), - or make a derivitive work (e.g. a sequel, or a clone), you must make it obvious that this is - not an official release (assuming its not) -If this would prevent this work being used with another work liscensed under the GNU GPL, these conditions may be ignoreds \ No newline at end of file +this Game is availible under the GNU-GPL-Version 3 or later. With the following request: + please do not use the name jumpD or somehow indicate that your game is different from mine in an obvious manner + this is a legally non-binding request. \ No newline at end of file diff --git a/jumpD/index.html b/jumpD/index.html index b087596..4d66f56 100644 --- a/jumpD/index.html +++ b/jumpD/index.html @@ -1,12 +1,44 @@ +--- +--- JumpD + +
+ +
diff --git a/jumpD/js/Button.js b/jumpD/js/Button.js new file mode 100644 index 0000000..8e0a5e2 --- /dev/null +++ b/jumpD/js/Button.js @@ -0,0 +1,30 @@ +class Button{ + constructor(scene, callback, text,config={}){ + this.scene = scene; //scene is required + this.text = text; + this.callback = callback; + this.start = show; + if(!config.paused){ + this.show() + } + } + start = show; + show(text, callback){ + this.text = text ? text:this.text; + this.callback = callback ? callback : this.callback; + let start = this.scene.add.text(this.centerX, this.centerY * 0.95, this.text, this.style); + start.setOrigin(0.5, 0.5); + start.setInteractive(); + start.on('pointerdown', this.scene.startPointerDown, this); + this.startTween = this.scene.tweens.add({ + targets: [start], + duration: 1000, + alpha: 0, + paused: true, + ease: "power0", + onComplete: this.callback + }); + this.listener = new listener(); + } + +} \ No newline at end of file diff --git a/jumpD/js/Queue.js b/jumpD/js/Queue.js new file mode 100644 index 0000000..fe34d51 --- /dev/null +++ b/jumpD/js/Queue.js @@ -0,0 +1,19 @@ +class Queue2{ +constructor(objs = []){ + this.start = 0; + this.end = 1; // exclusive + this.objs = objs +} +next(){ + console.assert(this.start + 1 < this.end); + let value = this.objs[this.start]; + this.start += 1; + return value; +} +add(value){ + this.objs[this.end] = value; + this.end += 1; + return value; +} + +} \ No newline at end of file diff --git a/jumpD/js/component interface b/jumpD/js/component interface new file mode 100644 index 0000000..28328cb --- /dev/null +++ b/jumpD/js/component interface @@ -0,0 +1,3 @@ +each component follows the following constructor signature +constructor(scene, callback, data, config){} +and has a method named start \ No newline at end of file diff --git a/jumpD/js/intro.js b/jumpD/js/intro.js index a53b890..98fbc18 100644 --- a/jumpD/js/intro.js +++ b/jumpD/js/intro.js @@ -1,4 +1,4 @@ -class FirstScreen extends Phaser.Scene { +class FirstScreen extends Phaser.Scene{ constructor() { super("FirstScreen"); @@ -10,79 +10,18 @@ class FirstScreen extends Phaser.Scene { advanced: false } }; - } preload() { console.log("preload") - this.centerX = config.width / 2; - this.centerY = config.height / 2; - var LibreBaskerville = new FontFace("LibreBaskerville", `url(assets/fonts/Libre-Baskerville/LibreBaskerville-Regular.ttf)`) - } - secondSlide(){ - - this.style.fontSize = "20px" - this.out = this.add.text(50,50, "", this.style); - this.slide = 1; - } - slidethree(){ - this.slide = 2; - } - printText(textObj, text, callback, args, scope){ - if(this.wait && this.wait > 0){ - this.wait -= 1000/60 - return text; - } - if(text[0] == "<"){ - let dex = text.indexOf(">"); - let newS = text.slice(1, dex); - this.wait += +newS; - return text.slice(dex + 1); - } - textObj.text += text[0]; - let s = text.slice(1); - this.wait += 1000/60 - return s == "" ? callback.bind(scope)(args) : s; - + new FontFace("LibreBaskerville", `url(assets/fonts/Libre-Baskerville/LibreBaskerville-Regular.ttf)`) } - startPointerDown() { - this.startTween.resume(); - console.log("start tween"); + create(data){ + this.listener = new Listener2(); + this.componentQueue = new Queue2([ + new Button(this, this.listener.raise,"Start", {}) + ]); } - activateSceneMain() { - console.log('activate scene'); - Game.scene.add("scenemain", SceneMain, true); + update(){ + this.listener.raise("update"); } - create() { - //this.scene.add("SceneMain") - let start = this.add.text(this.centerX, this.centerY * 0.95, "Start", this.style); - start.setOrigin(0.5, 0.5); - start.setInteractive(); - start.on('pointerdown', this.startPointerDown, this); - this.startTween = this.tweens.add({ - targets: [start], - duration: 1000, - alpha: 0, - paused: true, - ease: "power0", - onComplete: this.secondSlide.bind(this) - }); - - this.start = start; - this.slide = 0; - this.index = 0; - this.wait = 0; - this.text = `I have a fear of growing up. A fear of <1000>being<150>\nimprissoned<1500> by social expectation, <1000>losing my freedom.`; - this.slide2 = [`when I'm older<1000>`,`when I grow up<1000>`,`when I get a job<1000>`, `in the<1000>`,"Real World<750>"]; - - } - update() { - if(this.slide == 1){ - let text = this.printText(this.out, this.text, this.slidethree, null, this); - this.text = text - } - if (this.slide == 2){ - let text = this.printText() - } - } - -} +} \ No newline at end of file diff --git a/jumpD/js/intro.js.old b/jumpD/js/intro.js.old new file mode 100644 index 0000000..5c60820 --- /dev/null +++ b/jumpD/js/intro.js.old @@ -0,0 +1,78 @@ +/*class FirstScreen extends Phaser.Scene { + constructor() { + super("FirstScreen"); + + this.style = { + fontFace: "libreBaskerville", + fontSize: "75px", + wordWrap: { + width: 670, + advanced: false + } + }; + + } + preload() { + console.log("preload") + this.centerX = config.width / 2; + this.centerY = config.height / 2; + var LibreBaskerville = new FontFace("LibreBaskerville", `url(assets/fonts/Libre-Baskerville/LibreBaskerville-Regular.ttf)`) + } + printText(textObj, text, callback, args, scope){ + if(this.wait && this.wait > 0){ + this.wait -= 1000/60 + return text; + } + if(text[0] == "<"){ + let dex = text.indexOf(">"); + let newS = text.slice(1, dex); + this.wait += +newS; + return text.slice(dex + 1); + } + textObj.text += text[0]; + let s = text.slice(1); + this.wait += 1000/60 + return s == "" ? callback.bind(scope)(args) : s; + + } + secondSlide(){ + this.style.fontSize = "20px" + let scrawl1 = new textScroll(this,this.text,this.style); + this.listener.on(this.update,scrawl1.printText,this.slidethree); + } + + slidethree(){ + console.log("slide three"); + + } + + startPointerDown() { + this.startTween.resume(); + console.log("start tween"); + } + activateSceneMain() { + console.log('activate scene'); + Game.scene.add("scenemain", SceneMain, true); + } + create(data) { + //this.scene.add("SceneMain") + this.startButton = new Button(this, "Start", this.secondSlide); + this.startButton.show(); + this.listener = new Listener2(); + this.stack = data; + + this.text = `I have a fear of growing up. A fear of <1000>being<150>\nimprissoned<100> by social expectation, <1000>losing my freedom.`; + this.slide2 = [`when I'm older<1000>`,`when I grow up<1000>`,`when I get a job<1000>`, `in the<1000>`,"Real World<750>"]; + + } + update() { + this.listener.raise(this.update); + } + +} +let stack = [ + { + objClass: Button + + } +]*/ \ No newline at end of file diff --git a/jumpD/js/listener.js b/jumpD/js/listener.js new file mode 100644 index 0000000..1454c53 --- /dev/null +++ b/jumpD/js/listener.js @@ -0,0 +1,25 @@ +class Listener2{ + constructor(){ + this.listens = {}; + } + //bind your own function, please + on(event, func, args){ + func.args = args ? args : []; + if(this.listens[event]){ + this.lisens[event] += func; + } else { + this.listens[event] = [func]; + } + } + raise(event, args){ + if (!this.listens[event]){return;} + let funcs = this.listens[event] + for(var i = 0; i < funcs.length; i ++){ + let newArgs = (funcs[i].args.concat(args ? args : [])) + if(!this.listens[event][i](...newArgs)){ + this.listens[event].splice(i,1); + i--; + } + } + } +} \ No newline at end of file diff --git a/jumpD/js/textScroll.js b/jumpD/js/textScroll.js new file mode 100644 index 0000000..88a5132 --- /dev/null +++ b/jumpD/js/textScroll.js @@ -0,0 +1,40 @@ +class textScroll{ + /* + * a class to take care of character by character text. + */ + constructor(scene, callback, rawTextScript, config){ + this.scene = scene; this.callback = callback; + this.rawTextScript = rawTextScript; this.config = config; + + + this.tObj = scene.add.text(config.x,config.y,"",config.style); + this.rawTextScript = rawTextScript; + + config.autostart ? this.activate() : null; + + + } + + activate(){ + this.scene.listener.on("update", this.printText); + } + start = activate; + printText(){ + if(this.wait > 0){ + this.wait -= 1000/60 + return; + } + if(this.rawTextScript[0] == "<"){ + let dex = this.rawTextScript.indexOf(">"); + let newS = this.rawTextScript.slice(1, dex); + this.wait += +newS; + this.rawTextScript(dex + 1); + return; + } + this.tObj += this.rawTextScript[0] + this.rawTextScript = this.rawTextScript.slice(1); + if (this.rawTextScript == "") { this.callback.bind(this.scene)(...this.config.args); return false;} else {return true;} + } + + +} \ No newline at end of file diff --git a/privacy/index.md b/privacy/index.md index 9c68be1..c7d4881 100644 --- a/privacy/index.md +++ b/privacy/index.md @@ -4,7 +4,7 @@ title: Privacy --- ## Privacy -I don't think that we track you when you use this website, if you find out I am, please let me know +To the best of my knowledge, this website does not track ## Personal Data This website probably does not collect your personal data. Your data individual is too complicated. From ba3f1828baeb9275b029d004b110333513045de8 Mon Sep 17 00:00:00 2001 From: Davis Date: Sat, 2 Apr 2022 16:37:47 -0500 Subject: [PATCH 08/10] Saving Work --- _includes/jsLiscenseGPL.html | 26 +++++++++++++++++ jumpD/index.html | 12 ++++---- jumpD/js/Button.js | 20 +++++++------ jumpD/js/Queue.js | 10 +++---- jumpD/js/intro.js | 37 ++++++++++++++++++++++--- jumpD/js/{intro.js.old => intro.old.js} | 6 ++-- jumpD/js/listener.js | 2 +- jumpD/js/main.js | 6 ++-- jumpD/js/textScroll.js | 23 +++++++-------- 9 files changed, 102 insertions(+), 40 deletions(-) create mode 100644 _includes/jsLiscenseGPL.html rename jumpD/js/{intro.js.old => intro.old.js} (96%) diff --git a/_includes/jsLiscenseGPL.html b/_includes/jsLiscenseGPL.html new file mode 100644 index 0000000..ec7c9bc --- /dev/null +++ b/_includes/jsLiscenseGPL.html @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/jumpD/index.html b/jumpD/index.html index 4d66f56..d1895a3 100644 --- a/jumpD/index.html +++ b/jumpD/index.html @@ -36,7 +36,8 @@
- - +
diff --git a/jumpD/js/Button.js b/jumpD/js/Button.js index 8e0a5e2..46de990 100644 --- a/jumpD/js/Button.js +++ b/jumpD/js/Button.js @@ -1,21 +1,22 @@ -class Button{ + class Button{ constructor(scene, callback, text,config={}){ this.scene = scene; //scene is required this.text = text; this.callback = callback; - this.start = show; - if(!config.paused){ - this.show() + this.style = config.style; + this.x = config.x ? config.x : width/2; + this.y = config.y ? config.y : height/2 * 0.95; + if(config.autostart){ + this.start() } } - start = show; - show(text, callback){ + + start(text, callback){ this.text = text ? text:this.text; this.callback = callback ? callback : this.callback; - let start = this.scene.add.text(this.centerX, this.centerY * 0.95, this.text, this.style); + let start = this.scene.add.text(this.x, this.y, this.text, this.style); start.setOrigin(0.5, 0.5); start.setInteractive(); - start.on('pointerdown', this.scene.startPointerDown, this); this.startTween = this.scene.tweens.add({ targets: [start], duration: 1000, @@ -24,7 +25,8 @@ class Button{ ease: "power0", onComplete: this.callback }); - this.listener = new listener(); + start.on('pointerdown', this.startTween.resume, this.startTween); + } } \ No newline at end of file diff --git a/jumpD/js/Queue.js b/jumpD/js/Queue.js index fe34d51..9102c61 100644 --- a/jumpD/js/Queue.js +++ b/jumpD/js/Queue.js @@ -1,14 +1,14 @@ class Queue2{ constructor(objs = []){ this.start = 0; - this.end = 1; // exclusive - this.objs = objs + this.end = objs.length; // exclusive + for(var i = 0; i < this.end; i++) this[i] = objs[i]; } next(){ - console.assert(this.start + 1 < this.end); - let value = this.objs[this.start]; + console.assert(this.start < this.end); + let nextElement = this[this.start]; this.start += 1; - return value; + return nextElement; } add(value){ this.objs[this.end] = value; diff --git a/jumpD/js/intro.js b/jumpD/js/intro.js index 98fbc18..fcc7c68 100644 --- a/jumpD/js/intro.js +++ b/jumpD/js/intro.js @@ -1,4 +1,5 @@ -class FirstScreen extends Phaser.Scene{ +var component; +class FirstScreen extends Phaser.Scene { constructor() { super("FirstScreen"); @@ -15,13 +16,41 @@ class FirstScreen extends Phaser.Scene{ console.log("preload") new FontFace("LibreBaskerville", `url(assets/fonts/Libre-Baskerville/LibreBaskerville-Regular.ttf)`) } - create(data){ + next() { + let nextComponent = this.componentQueue.next(); + nextComponent.start(); + component = nextComponent; + } + create(data) { this.listener = new Listener2(); + let smallTS = { + fontFace: "libreBaskerville", + fontSize: "30px", + wordWrap: { + width: 670, + advanced: false + } + } + let next = this.next.bind(this); + new Button(this, next, "Start", { autostart: true, style: this.style }) //auto start this.componentQueue = new Queue2([ - new Button(this, this.listener.raise,"Start", {}) + new textScroll(this, next, `I have a fear of growing up. A fear of <1000>being<150> imprissoned<100> by social expectation, <1000>losing my freedom.` + , { style: smallTS, x: 10, y: 10 }), + new textScroll(this, next, `when I'm older<1000>`, { style: smallTS, x: 10, y: 200 }), + new textScroll(this, next, `when I grow up<1000>`, { style: smallTS, x: 10, y: 230 }), + new textScroll(this, next, `when I get a job<1000>`, { style: smallTS, x: 10, y: 260 }), + new textScroll(this, next, `in the<1000>`, { style: smallTS, x: 10, y: 290 }), + new textScroll(this, next, `Real World<750>`, { style: smallTS, x: 10, y: 320 })/*, + + { + start: function () { + console.log('activate scene'); + Game.scene.add("scenemain", SceneMain, true); + } + }*/ ]); } - update(){ + update() { this.listener.raise("update"); } } \ No newline at end of file diff --git a/jumpD/js/intro.js.old b/jumpD/js/intro.old.js similarity index 96% rename from jumpD/js/intro.js.old rename to jumpD/js/intro.old.js index 5c60820..7e818d3 100644 --- a/jumpD/js/intro.js.old +++ b/jumpD/js/intro.old.js @@ -1,4 +1,4 @@ -/*class FirstScreen extends Phaser.Scene { +class FirstScreen extends Phaser.Scene { constructor() { super("FirstScreen"); @@ -57,7 +57,7 @@ create(data) { //this.scene.add("SceneMain") this.startButton = new Button(this, "Start", this.secondSlide); - this.startButton.show(); + this.startButton.start(); this.listener = new Listener2(); this.stack = data; @@ -75,4 +75,4 @@ let stack = [ objClass: Button } -]*/ \ No newline at end of file +] \ No newline at end of file diff --git a/jumpD/js/listener.js b/jumpD/js/listener.js index 1454c53..94823ff 100644 --- a/jumpD/js/listener.js +++ b/jumpD/js/listener.js @@ -6,7 +6,7 @@ class Listener2{ on(event, func, args){ func.args = args ? args : []; if(this.listens[event]){ - this.lisens[event] += func; + this.listens[event].push(func); } else { this.listens[event] = [func]; } diff --git a/jumpD/js/main.js b/jumpD/js/main.js index 21bd7a7..6a8998f 100644 --- a/jumpD/js/main.js +++ b/jumpD/js/main.js @@ -6,10 +6,12 @@ var startscene; *it to be able to be accessed globally, instead of mangling a bunch of bind *method calls, you know what you are getting */ +var height = 600; +var width = 800; var config = { type: Phaser.AUTO, - width: 800, - height: 600, + width: width, + height: height, physics: { default: 'arcade', arcade: { diff --git a/jumpD/js/textScroll.js b/jumpD/js/textScroll.js index 88a5132..fb20097 100644 --- a/jumpD/js/textScroll.js +++ b/jumpD/js/textScroll.js @@ -6,34 +6,35 @@ class textScroll{ this.scene = scene; this.callback = callback; this.rawTextScript = rawTextScript; this.config = config; - + this.wait = 0; this.tObj = scene.add.text(config.x,config.y,"",config.style); - this.rawTextScript = rawTextScript; - config.autostart ? this.activate() : null; + config.autostart ? this.start() : null; + !config.args ? config.args = [] : null; } - activate(){ - this.scene.listener.on("update", this.printText); + start(){ + this.scene.listener.on("update", this.printText.bind(this)); } - start = activate; + printText(){ if(this.wait > 0){ this.wait -= 1000/60 - return; + return true; } + if (this.rawTextScript == "") { this.callback.bind(this.scene)(...this.config.args); return false;} if(this.rawTextScript[0] == "<"){ let dex = this.rawTextScript.indexOf(">"); let newS = this.rawTextScript.slice(1, dex); this.wait += +newS; - this.rawTextScript(dex + 1); - return; + this.rawTextScript = this.rawTextScript.slice(dex+1); + return true; } - this.tObj += this.rawTextScript[0] + this.tObj.text += this.rawTextScript[0] this.rawTextScript = this.rawTextScript.slice(1); - if (this.rawTextScript == "") { this.callback.bind(this.scene)(...this.config.args); return false;} else {return true;} + return true; } From 278440387c3336b08667a5f6b9b1b748b8211120 Mon Sep 17 00:00:00 2001 From: Davis Date: Tue, 19 Apr 2022 19:23:27 -0500 Subject: [PATCH 09/10] non functional save point, because I'm breaking everything again. --- .gitignore | 1 + jumpD/index.html | 4 +- jumpD/js/Button.js | 14 +++++- jumpD/js/intro.js | 99 ++++++++++++++++++++++++++++++++++++------ jumpD/js/listener.js | 1 + jumpD/js/main.js | 6 ++- jumpD/js/textScroll.js | 23 +++++++--- start.bat | 4 +- 8 files changed, 128 insertions(+), 24 deletions(-) mode change 100644 => 100755 start.bat diff --git a/.gitignore b/.gitignore index 918de83..4c2c357 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ _site .jekyll-metadata vendor Gemfile.lock +start.bat diff --git a/jumpD/index.html b/jumpD/index.html index d1895a3..c17a3ad 100644 --- a/jumpD/index.html +++ b/jumpD/index.html @@ -1,5 +1,6 @@ --- --- + @@ -49,6 +50,7 @@ + - + \ No newline at end of file diff --git a/jumpD/js/Button.js b/jumpD/js/Button.js index 46de990..f94a10a 100644 --- a/jumpD/js/Button.js +++ b/jumpD/js/Button.js @@ -4,28 +4,40 @@ this.text = text; this.callback = callback; this.style = config.style; + this.config = config; + this.wait = config.wait; this.x = config.x ? config.x : width/2; this.y = config.y ? config.y : height/2 * 0.95; + if(config.autostart){ this.start() } } + fade(){ + this.startTween.resume.bind(this.startTween)() + this.start.setInteractive(false); + } start(text, callback){ this.text = text ? text:this.text; this.callback = callback ? callback : this.callback; let start = this.scene.add.text(this.x, this.y, this.text, this.style); + this.start = start; + this.config.tweenIn ? this.config.tweenIn : null; start.setOrigin(0.5, 0.5); start.setInteractive(); + this.config.listens ? this.scene.listener.on(this.listens, () => {start.setInteractive(false);this.startTween.resume.bind(this.startTween)()}) : null; this.startTween = this.scene.tweens.add({ targets: [start], duration: 1000, alpha: 0, paused: true, - ease: "power0", onComplete: this.callback }); start.on('pointerdown', this.startTween.resume, this.startTween); + start.on('pointerdown', ) + + } diff --git a/jumpD/js/intro.js b/jumpD/js/intro.js index fcc7c68..8cf39f9 100644 --- a/jumpD/js/intro.js +++ b/jumpD/js/intro.js @@ -1,4 +1,5 @@ var component; +var intro; class FirstScreen extends Phaser.Scene { constructor() { super("FirstScreen"); @@ -11,46 +12,116 @@ class FirstScreen extends Phaser.Scene { advanced: false } }; + intro = this; } preload() { console.log("preload") new FontFace("LibreBaskerville", `url(assets/fonts/Libre-Baskerville/LibreBaskerville-Regular.ttf)`) } next() { - let nextComponent = this.componentQueue.next(); + let nextComponent = intro.componentQueue.next(); nextComponent.start(); component = nextComponent; + if(nextComponent.wait === false){ + this.next() + } + } + + specialTween(){ + this.scene.tweens.add({ + targets: [this.tObj], + x:150, + y: 50, + duration: 1000 + }) + this.scene.tweens.addCounter({ + from: 30, + to: 70, + duration: 1000, + onUpdate: function (tween) { this.tObj.setFontSize(tween.getValue()); }.bind(this), + onComplete: this.scene.next.bind(this.scene) + }); + + + this.scene.listener.raise("ScreenClear"); + + + } + close(){ + } create(data) { + this.go = 0 + this.letterRate = 60; this.listener = new Listener2(); let smallTS = { fontFace: "libreBaskerville", fontSize: "30px", + size: 30, wordWrap: { - width: 670, + width: 700, advanced: false } } + let longTS = { + fontFace:"libreBasherville", + fontSize: "30px", + wordWrap: { + width: 750 + } + } + let next = this.next.bind(this); + new Button(this, next, "Start", { autostart: true, style: this.style }) //auto start + + let QuickFunction = (func,args=[]) => ({wait: false, args: args, start: () => func.call(...this.args)}); + let wait = {start: () => (null), wait: true}; + + let yes = new Button(this, () => this.listener.raise("Yes"), "Yes", {x: 100, y:200,wait: false, style: longTS }); + let no = new Button(this, () => this.listener.raise("No"), "No", {x: 300, y:200, wait: true, style: longTS}); + + let realWorld = new textScroll(this, next, `"Real World"<1000>`, { style: smallTS, x: 200, y: 320, manualClear: "CLRSPECIAL" }) + this.componentQueue = new Queue2([ - new textScroll(this, next, `I have a fear of growing up. A fear of <1000>being<150> imprissoned<100> by social expectation, <1000>losing my freedom.` + new textScroll(this, next, `I have a fear of growing up.<1000> A fear of being imprissoned<200> by social expectations, <300>losing my freedom.<450>` , { style: smallTS, x: 10, y: 10 }), - new textScroll(this, next, `when I'm older<1000>`, { style: smallTS, x: 10, y: 200 }), - new textScroll(this, next, `when I grow up<1000>`, { style: smallTS, x: 10, y: 230 }), - new textScroll(this, next, `when I get a job<1000>`, { style: smallTS, x: 10, y: 260 }), - new textScroll(this, next, `in the<1000>`, { style: smallTS, x: 10, y: 290 }), - new textScroll(this, next, `Real World<750>`, { style: smallTS, x: 10, y: 320 })/*, - - { - start: function () { - console.log('activate scene'); - Game.scene.add("scenemain", SceneMain, true); + new textScroll(this, next, `when I'm older<900>`, { style: smallTS, x: 200, y: 200 }), + new textScroll(this, next, `when I get a job<900>`, { style: smallTS, x: 200, y: 230 }), + new textScroll(this, next, `in the<100>`, { style: smallTS, x: 200, y: 290 }), + realWorld, + {start: this.specialTween.bind(realWorld)}, + new textScroll(this,next, `<750>A place that is the death of dreams.<500> A place where your joys dissapear.<500> A place of disasters and sorrow<750> and death.<750> A place where you can't "be yourself".<1000>`, { + x:50, y: 150, style:{ + fontFace: "libreBaskerville", + fontSize: "40px", + wordWrap: { + width: 700, + advanced: false + } } - }*/ + }), + {start: () => {this.listener.raise("CLRSPECIAL");this.listener.raise("ScreenClear"); next()}}, + new textScroll(this,next, `I decided not to go to this "Real World"<300>`, {style:longTS, x:25,y:25}), + new textScroll(this,next, `Care to join me?<700>`, {style: longTS, x: 25, y: 100}), + yes, + no, + new textScroll(this, next, `Well, then.<1000>`, {style: smallTS, x: 50, y: 500}), ]); + this.listener.on("Yes", this.componentQueue.add, QuickFunction(this.scene.add, ["scenemain", SceneMain, true])); + this.listener.on("Yes", no.fade.bind(no)); + this.listener.on("No", yes.fade.bind(yes)); + this.listener.on("No", this.listener.raise.bind(this.listener), "ScreenClear"); + + + } update() { + if(this.go < 0){ this.listener.raise("update"); + this.go += 60/this.letterRate; + } else { + this.go -= 1; + } } } \ No newline at end of file diff --git a/jumpD/js/listener.js b/jumpD/js/listener.js index 94823ff..d72426e 100644 --- a/jumpD/js/listener.js +++ b/jumpD/js/listener.js @@ -5,6 +5,7 @@ class Listener2{ //bind your own function, please on(event, func, args){ func.args = args ? args : []; + func.args = func.args.length || func.args.length == 0 ? func.args : [func.args]; if(this.listens[event]){ this.listens[event].push(func); } else { diff --git a/jumpD/js/main.js b/jumpD/js/main.js index 6a8998f..f8ee2c0 100644 --- a/jumpD/js/main.js +++ b/jumpD/js/main.js @@ -26,4 +26,8 @@ var config = { Game = new Phaser.Game(config); var startScene = Game.scene.scenes[0]; -console.log("main finished") \ No newline at end of file +// I have given up and will no + + + +console.log("main finished") diff --git a/jumpD/js/textScroll.js b/jumpD/js/textScroll.js index fb20097..baa24f5 100644 --- a/jumpD/js/textScroll.js +++ b/jumpD/js/textScroll.js @@ -2,26 +2,37 @@ class textScroll{ /* * a class to take care of character by character text. */ - constructor(scene, callback, rawTextScript, config){ + constructor(scene, callback, rawTextScript, config={}){ this.scene = scene; this.callback = callback; this.rawTextScript = rawTextScript; this.config = config; - - this.wait = 0; + this.wait = config.wait; + this.tObj = scene.add.text(config.x,config.y,"",config.style); config.autostart ? this.start() : null; !config.args ? config.args = [] : null; - + this.clearOn = config.manualClear ? config.manualClear : "ScreenClear"; + + this.size = config.style.size; } - + fade(){ + this.scene.tweens.add({ + targets: this.tObj, + alpha: 0, + duration: 1000, + paused: false + }); + } start(){ this.scene.listener.on("update", this.printText.bind(this)); + this.scene.listener.on(this.clearOn, this.fade.bind(this)); + this.wait = 0; } printText(){ if(this.wait > 0){ - this.wait -= 1000/60 + this.wait -= 1000/this.scene.letterRate return true; } if (this.rawTextScript == "") { this.callback.bind(this.scene)(...this.config.args); return false;} diff --git a/start.bat b/start.bat old mode 100644 new mode 100755 index 0122470..70a65cd --- a/start.bat +++ b/start.bat @@ -1 +1,3 @@ -bundle exec jekyll serve --incremental \ No newline at end of file +#!/bin/bash +cd ~/anonymouscript +bundle exec jekyll serve --incremental From d4cef7511fc341924df70f482a231a9292385b45 Mon Sep 17 00:00:00 2001 From: Davis Date: Tue, 19 Apr 2022 19:29:01 -0500 Subject: [PATCH 10/10] shashing --- jumpD/js/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jumpD/js/main.js b/jumpD/js/main.js index f8ee2c0..f33b461 100644 --- a/jumpD/js/main.js +++ b/jumpD/js/main.js @@ -26,7 +26,8 @@ var config = { Game = new Phaser.Game(config); var startScene = Game.scene.scenes[0]; -// I have given up and will no +// I have given up and will not be brewing my own listener. Fine. Remove when done sulking. +var Emitter = new Phaser.Events.EventEmmitter();