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/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/_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/_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/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/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/assets/outro1.txt b/jumpD/assets/outro1.txt new file mode 100644 index 0000000..e69de29 diff --git a/jumpD/index.html b/jumpD/index.html index bebdde1..c17a3ad 100644 --- a/jumpD/index.html +++ b/jumpD/index.html @@ -1,11 +1,46 @@ +--- +--- + JumpD + + +
+ + + + @@ -13,27 +48,29 @@ + + + + +
+ \ No newline at end of file diff --git a/jumpD/js/Button.js b/jumpD/js/Button.js new file mode 100644 index 0000000..f94a10a --- /dev/null +++ b/jumpD/js/Button.js @@ -0,0 +1,44 @@ + class Button{ + constructor(scene, callback, text,config={}){ + this.scene = scene; //scene is required + 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, + onComplete: this.callback + }); + start.on('pointerdown', this.startTween.resume, this.startTween); + start.on('pointerdown', ) + + + + } + +} \ No newline at end of file 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/Queue.js b/jumpD/js/Queue.js new file mode 100644 index 0000000..9102c61 --- /dev/null +++ b/jumpD/js/Queue.js @@ -0,0 +1,19 @@ +class Queue2{ +constructor(objs = []){ + this.start = 0; + this.end = objs.length; // exclusive + for(var i = 0; i < this.end; i++) this[i] = objs[i]; +} +next(){ + console.assert(this.start < this.end); + let nextElement = this[this.start]; + this.start += 1; + return nextElement; +} +add(value){ + this.objs[this.end] = value; + this.end += 1; + return value; +} + +} \ No newline at end of file diff --git a/jumpD/js/SceneMain.js b/jumpD/js/SceneMain.js index 956a367..68b8b19 100644 --- a/jumpD/js/SceneMain.js +++ b/jumpD/js/SceneMain.js @@ -1,6 +1,8 @@ class SceneMain extends Phaser.Scene { constructor() { - super("SceneMain"); + super({ key: "scenemain" }); + scene = this; + } preload() { console.log("loading") @@ -8,6 +10,8 @@ class SceneMain extends Phaser.Scene { this.tilemap = new tilemap(); this.tilemap.loadTilemapForest(); camera = this.cameras.main; + this.scene.setActive(false, 'scenemain'); + } create() { @@ -24,6 +28,7 @@ class SceneMain extends Phaser.Scene { } update() { updatePhysics(); + cleanPhysics(); } } \ 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/into1.js b/jumpD/js/into1.js new file mode 100644 index 0000000..0d59e83 --- /dev/null +++ b/jumpD/js/into1.js @@ -0,0 +1,26 @@ +let intro1 = ` 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 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/js/intro.js b/jumpD/js/intro.js new file mode 100644 index 0000000..8cf39f9 --- /dev/null +++ b/jumpD/js/intro.js @@ -0,0 +1,127 @@ +var component; +var intro; +class FirstScreen extends Phaser.Scene { + constructor() { + super("FirstScreen"); + + this.style = { + fontFace: "libreBaskerville", + fontSize: "75px", + wordWrap: { + width: 670, + advanced: false + } + }; + intro = this; + } + preload() { + console.log("preload") + new FontFace("LibreBaskerville", `url(assets/fonts/Libre-Baskerville/LibreBaskerville-Regular.ttf)`) + } + 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: 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.<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<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/intro.old.js b/jumpD/js/intro.old.js new file mode 100644 index 0000000..7e818d3 --- /dev/null +++ b/jumpD/js/intro.old.js @@ -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.start(); + 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..d72426e --- /dev/null +++ b/jumpD/js/listener.js @@ -0,0 +1,26 @@ +class Listener2{ + constructor(){ + this.listens = {}; + } + //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 { + 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/main.js b/jumpD/js/main.js new file mode 100644 index 0000000..f33b461 --- /dev/null +++ b/jumpD/js/main.js @@ -0,0 +1,34 @@ +var Game; +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 height = 600; +var width = 800; +var config = { + type: Phaser.AUTO, + width: width, + height: height, + physics: { + default: 'arcade', + arcade: { + gravity: { + y: 200 + } + } + }, + pixelArt: true, + scene: FirstScreen +}; + +Game = new Phaser.Game(config); +var startScene = Game.scene.scenes[0]; +// I have given up and will not be brewing my own listener. Fine. Remove when done sulking. +var Emitter = new Phaser.Events.EventEmmitter(); + + + +console.log("main finished") diff --git a/jumpD/js/textScroll.js b/jumpD/js/textScroll.js new file mode 100644 index 0000000..baa24f5 --- /dev/null +++ b/jumpD/js/textScroll.js @@ -0,0 +1,52 @@ +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.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/this.scene.letterRate + 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 = this.rawTextScript.slice(dex+1); + return true; + } + this.tObj.text += this.rawTextScript[0] + this.rawTextScript = this.rawTextScript.slice(1); + return true; + } + + +} \ 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; 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. 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