├── .idea ├── WebsiteTest.iml ├── misc.xml ├── modules.xml ├── vcs.xml └── workspace.xml ├── README.md └── websiteUsingBulma ├── .idea ├── misc.xml ├── modules.xml ├── vcs.xml ├── websiteUsingBulma.iml └── workspace.xml ├── About.html ├── ProjectSketches ├── Creature Creator │ ├── .gitattributes │ ├── .idea │ │ ├── AI-Learns-To-Walk-with-editor.iml │ │ ├── inspectionProfiles │ │ │ └── Project_Default.xml │ │ ├── misc.xml │ │ ├── modules.xml │ │ ├── vcs.xml │ │ └── workspace.xml │ ├── AI learns to walk │ │ ├── ConnectionGene.js │ │ ├── ConnectionHistory.js │ │ ├── Node.js │ │ ├── Player.js │ │ ├── Population.js │ │ ├── Species.js │ │ ├── genome.js │ │ ├── sketch.js │ │ └── sounds │ │ │ ├── LazerSoundEffect.wav │ │ │ ├── burnedByLazer.mp3 │ │ │ ├── lazerShot.mp3 │ │ │ └── screamingSoundWithPause.wav │ ├── Body.js │ ├── Box2dGlobals.js │ ├── CompoundFixture.js │ ├── Creature creator │ │ ├── BodyImage.js │ │ ├── Button.js │ │ ├── ButtonCreationMethods │ │ │ ├── AdvancedButtons │ │ │ │ ├── AllowBodyCollisionsToggleButton.js │ │ │ │ ├── BasicOptionsButton.js │ │ │ │ ├── DeathUponFloorButton.js │ │ │ │ ├── EditShapeLayersButton.js │ │ │ │ ├── LimitJointsButton.js │ │ │ │ ├── ShapeCollisionsButton.js │ │ │ │ └── ShowJointLimitsToggleButton.js │ │ │ ├── ConstructionButton.js │ │ │ ├── CosmeticButtons │ │ │ │ ├── AddImagesToShapeButton.js │ │ │ │ ├── ChangeFillColorButton.js │ │ │ │ ├── DeleteImageButton.js │ │ │ │ ├── MoveResizeImageButton.js │ │ │ │ └── MoveRotateImageButton.js │ │ │ ├── CosmeticsButton.js │ │ │ ├── DefaultButtons │ │ │ │ ├── AddCircleButton.js │ │ │ │ ├── AddJointButton.js │ │ │ │ ├── AddPolygonButton.js │ │ │ │ ├── AddRectangleButton.js │ │ │ │ ├── AdvancedButton.js │ │ │ │ ├── CloneShapeButton.js │ │ │ │ ├── DeleteButton.js │ │ │ │ ├── FuseShapesButton.js │ │ │ │ ├── MoveResizeButton.js │ │ │ │ └── MoveRotateButton.js │ │ │ ├── EvolveButton.js │ │ │ ├── LearningButtons │ │ │ │ ├── DeathLazerSpeedValueButton.js │ │ │ │ ├── EditCreatureButton.js │ │ │ │ ├── MuteButton.js │ │ │ │ ├── NumberOfBatchesValueButton.js │ │ │ │ ├── PopulationSizeValueButton.js │ │ │ │ ├── ReplayEvolutionHighlightsButton.js │ │ │ │ ├── ReplayPopularSpeciesButton.js │ │ │ │ ├── SimulationSpeedValueButton.js │ │ │ │ └── SpeedUpWhenPlayersDieToggleButton.js │ │ │ ├── PlayPauseButton.js │ │ │ └── StopButton.js │ │ ├── ButtonManager.js │ │ ├── CommonColorsArray.js │ │ ├── CosmeticImages │ │ │ ├── CBHead.png │ │ │ ├── Hat 1.png │ │ │ ├── L eye 1.png │ │ │ ├── R eye 1.png │ │ │ ├── eyes1.png │ │ │ ├── face 1.png │ │ │ ├── face 10.png │ │ │ ├── face 2.png │ │ │ ├── face 3.png │ │ │ ├── face 4.png │ │ │ ├── face 5.png │ │ │ ├── face 6.png │ │ │ ├── face 7.png │ │ │ ├── face 8.png │ │ │ ├── face 9.png │ │ │ ├── mouth 1.png │ │ │ ├── mouth 2.png │ │ │ ├── mouth1.png │ │ │ ├── mustache 1.png │ │ │ └── mustache 2.png │ │ ├── Creature.js │ │ ├── HotBar.js │ │ ├── Instruction.js │ │ ├── MouseJoint.js │ │ ├── Warning.js │ │ ├── World.js │ │ └── sketch.js │ ├── Fixtures.js │ ├── Fonts │ │ ├── RobotoMono-Bold.ttf │ │ └── RobotoMono-Regular.ttf │ ├── Joints.js │ ├── README.md │ ├── creatureCreator.html │ ├── libraries │ │ ├── Box2d.js │ │ ├── p5.dom.js │ │ ├── p5.js │ │ └── p5.sound.js │ ├── pics │ │ ├── ConveryerBeltSection.png │ │ ├── dangerFloor.png │ │ ├── floorTiles.png │ │ ├── lazerBurnGround3.png │ │ ├── mutedYellow.png │ │ ├── topImage.png │ │ └── unmutedYellow.png │ └── sketch.js ├── Hill Climb Racing │ ├── .gitattributes │ ├── Car.js │ ├── ConnectionGene.js │ ├── ConnectionHistory.js │ ├── Genome.js │ ├── Ground.js │ ├── Neat.js │ ├── Node.js │ ├── Person.js │ ├── Pics │ │ ├── CBHead2.png │ │ ├── CBHead3.png │ │ ├── car.png │ │ ├── darkness.png │ │ ├── grass.png │ │ ├── grass2.png │ │ ├── grass3.png │ │ ├── grass4.png │ │ ├── grass5.png │ │ ├── grass6.png │ │ ├── head.png │ │ ├── headLarge.png │ │ ├── sky.png │ │ ├── wheel.png │ │ └── wheel2.png │ ├── Player.js │ ├── PlayerOld.js │ ├── Population.js │ ├── README.md │ ├── Species.js │ ├── Wheel.js │ ├── World.js │ ├── hillClimbRacing.html │ └── sketch.js ├── MarbleCalculator │ ├── MarbleCalculator.html │ ├── Object.js │ ├── looseRect.js │ ├── marble.js │ ├── sketch.js │ ├── solid.js │ └── startingMarbles.js ├── WorldsHardestGame │ ├── WHG │ │ ├── Brain.js │ │ ├── Coin.js │ │ ├── Dot.js │ │ ├── Level1 │ │ │ ├── Brain.js │ │ │ ├── Dot.js │ │ │ ├── Node.js │ │ │ ├── Player.js │ │ │ ├── Population.js │ │ │ ├── Solid.js │ │ │ ├── Tile.js │ │ │ ├── assets │ │ │ │ └── DAB.png │ │ │ ├── level1.html │ │ │ ├── setting_level.js │ │ │ └── sketch.js │ │ ├── Level2 │ │ │ ├── Brain.js │ │ │ ├── Coin.js │ │ │ ├── Dot.js │ │ │ ├── Node.js │ │ │ ├── Player.js │ │ │ ├── Population.js │ │ │ ├── Solid.js │ │ │ ├── Tile.js │ │ │ ├── assets │ │ │ │ └── DAB.png │ │ │ ├── level2.html │ │ │ ├── setting_level.js │ │ │ └── sketch.js │ │ ├── Level3 │ │ │ ├── Brain.js │ │ │ ├── Coin.js │ │ │ ├── Dot.js │ │ │ ├── Node.js │ │ │ ├── Player.js │ │ │ ├── Population.js │ │ │ ├── Solid.js │ │ │ ├── Tile.js │ │ │ ├── assets │ │ │ │ └── DAB.png │ │ │ ├── level3.html │ │ │ ├── setting_level.js │ │ │ └── sketch.js │ │ ├── Level4 │ │ │ ├── PlayerLv4Final.js │ │ │ ├── level4.html │ │ │ └── setting_level4.js │ │ ├── Level5 │ │ │ ├── PlayerLv5Final.js │ │ │ ├── level5.html │ │ │ └── setting_level5.js │ │ ├── Level6 │ │ │ ├── PlayerLv6Final.js │ │ │ ├── level6.html │ │ │ └── setting_level6.js │ │ ├── Node.js │ │ ├── PlayerLv4.js │ │ ├── PlayerLv4PoolStrat.js │ │ ├── PlayerLv5.js │ │ ├── Population.js │ │ ├── Population2.js │ │ ├── Solid.js │ │ ├── Tile.js │ │ ├── assets │ │ │ └── DAB.png │ │ ├── localStyle.css │ │ ├── setting_level.js │ │ └── sketch.js │ ├── WHGprojects.html │ └── levelImages │ │ ├── level1.png │ │ ├── level2.png │ │ ├── level3.png │ │ ├── level4.png │ │ ├── level5.png │ │ └── level6.png ├── chess │ ├── Board.js │ ├── MinimaxFunctions.js │ ├── Piece.js │ ├── assets │ │ ├── 2000px-Chess_Pieces_Sprite_01.png │ │ ├── 2000px-Chess_Pieces_Sprite_02.png │ │ ├── 2000px-Chess_Pieces_Sprite_03.png │ │ ├── 2000px-Chess_Pieces_Sprite_04.png │ │ ├── 2000px-Chess_Pieces_Sprite_05.png │ │ ├── 2000px-Chess_Pieces_Sprite_06.png │ │ ├── 2000px-Chess_Pieces_Sprite_07.png │ │ ├── 2000px-Chess_Pieces_Sprite_08.png │ │ ├── 2000px-Chess_Pieces_Sprite_09.png │ │ ├── 2000px-Chess_Pieces_Sprite_10.png │ │ ├── 2000px-Chess_Pieces_Sprite_11.png │ │ └── 2000px-Chess_Pieces_Sprite_12.png │ ├── chess.html │ └── sketch.js └── flappyBird │ ├── ConnectionGene.js │ ├── ConnectionHistory.js │ ├── Genome.js │ ├── Ground.js │ ├── Node.js │ ├── Pipe.js │ ├── PipePair.js │ ├── Population.js │ ├── Species.js │ ├── flappyBird.html │ ├── images │ ├── Untitled-3.psd │ ├── background.png │ ├── bird.png │ ├── christmasberd.png │ ├── fatBird.png │ ├── full pipe bottom.png │ ├── full pipe top.png │ ├── groundPiece.png │ ├── photoshoip thing 1.psd │ ├── pipeHead0000.png │ └── shaft0000.png │ ├── player.js │ └── sketch.js ├── SnakeGame ├── .idea │ ├── SnakeGame.iml │ ├── misc.xml │ ├── modules.xml │ ├── vcs.xml │ └── workspace.xml ├── Apple.js ├── HamiltonianCycle.js ├── Path.js ├── Snake.js ├── s │ └── welcomeText.png └── sketch.js ├── fonts ├── bebas_neue │ ├── About.md │ ├── About.txt │ ├── BebasNeue-Regular.eot │ ├── BebasNeue-Regular.otf │ ├── BebasNeue-Regular.ttf │ ├── BebasNeue-Regular.woff │ ├── BebasNeue-Regular.woff2 │ ├── OFL-FAQ.txt │ ├── OFL.txt │ └── Try_BebasNeuePro.txt └── montserrat │ ├── Montserrat-Black.otf │ ├── Montserrat-BlackItalic.otf │ ├── Montserrat-Bold.otf │ ├── Montserrat-BoldItalic.otf │ ├── Montserrat-ExtraBold.otf │ ├── Montserrat-ExtraBoldItalic.otf │ ├── Montserrat-ExtraLight.otf │ ├── Montserrat-ExtraLightItalic.otf │ ├── Montserrat-Italic.otf │ ├── Montserrat-Light.otf │ ├── Montserrat-LightItalic.otf │ ├── Montserrat-Medium.otf │ ├── Montserrat-MediumItalic.otf │ ├── Montserrat-Regular.otf │ ├── Montserrat-SemiBold.otf │ ├── Montserrat-SemiBoldItalic.otf │ ├── Montserrat-Thin.otf │ ├── Montserrat-ThinItalic.otf │ ├── MontserratAlternates-Black.otf │ ├── MontserratAlternates-BlackItalic.otf │ ├── MontserratAlternates-Bold.otf │ ├── MontserratAlternates-BoldItalic.otf │ ├── MontserratAlternates-ExtraBold.otf │ ├── MontserratAlternates-ExtraBoldItalic.otf │ ├── MontserratAlternates-ExtraLight.otf │ ├── MontserratAlternates-ExtraLightItalic.otf │ ├── MontserratAlternates-Italic.otf │ ├── MontserratAlternates-Light.otf │ ├── MontserratAlternates-LightItalic.otf │ ├── MontserratAlternates-Medium.otf │ ├── MontserratAlternates-MediumItalic.otf │ ├── MontserratAlternates-Regular.otf │ ├── MontserratAlternates-SemiBold.otf │ ├── MontserratAlternates-SemiBoldItalic.otf │ ├── MontserratAlternates-Thin.otf │ ├── MontserratAlternates-ThinItalic.otf │ └── SIL Open Font License.txt ├── images ├── GlowingLogoWithName.png ├── Merch │ ├── 20bucks.png │ ├── Mug.png │ ├── banana.png │ ├── codeBulletsSoul.png │ ├── fireManCalender.png │ ├── laptop.png │ ├── puppy.png │ ├── sneakers.png │ └── sunglasses.png ├── Projects │ ├── chess.png │ ├── flappyBird.png │ ├── hillClimbRacing.png │ ├── marbleCalculator.png │ └── worldsHardestGame.png ├── code Bullet pose.png ├── dummyBackground.png ├── logo-glowing.png ├── logo-head-greenface.png ├── logo.png ├── logo2.png ├── logo3.png ├── logoHead.png └── snakeBackground.gif ├── index.html ├── libraries ├── Box2d.js ├── matter.js ├── p5.dom.js ├── p5.js └── p5.sound.js ├── merch.html ├── pageJs └── sketch.js ├── projectOld.html ├── projectSketch ├── dot.js ├── homeSketch.js └── images │ ├── chess.png │ ├── creatureCreator.png │ ├── flappyBird.png │ ├── hillClimbRacing.png │ ├── marbleCalculator.png │ └── worldsHardestGame.png ├── projects.html └── styles ├── debug.css └── navBarStyle.css /.idea/WebsiteTest.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WebsiteTest -------------------------------------------------------------------------------- /websiteUsingBulma/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /websiteUsingBulma/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /websiteUsingBulma/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /websiteUsingBulma/.idea/websiteUsingBulma.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/.idea/AI-Learns-To-Walk-with-editor.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/AI learns to walk/ConnectionGene.js: -------------------------------------------------------------------------------- 1 | //a connection between 2 nodes 2 | class connectionGene { 3 | constructor(from, to, w, inno) { 4 | this.fromNode = from; 5 | this.toNode = to; 6 | this.weight = w; 7 | this.enabled = true; 8 | this.innovationNo = inno; //each connection is given a innovation number to compare genomes 9 | 10 | } 11 | 12 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 13 | //changes the this.weight 14 | mutateWeight() { 15 | var rand2 = random(1); 16 | if (rand2 < 0.1) { //10% of the time completely change the this.weight 17 | this.weight = random(-1, 1); 18 | } else { //otherwise slightly change it 19 | this.weight += (randomGaussian() / 50); 20 | //keep this.weight between bounds 21 | if (this.weight > 1) { 22 | this.weight = 1; 23 | } 24 | if (this.weight < -1) { 25 | this.weight = -1; 26 | 27 | } 28 | } 29 | } 30 | 31 | //---------------------------------------------------------------------------------------------------------- 32 | //returns a copy of this connectionGene 33 | clone(from, to) { 34 | var clone = new connectionGene(from, to, this.weight, this.innovationNo); 35 | clone.enabled = this.enabled; 36 | 37 | return clone; 38 | } 39 | 40 | 41 | //------------------------------------------------------------------------------------------------------------------- 42 | //returns whether or not these 2 connection genes are the same 43 | isEqualTo(otherConnectionGene) { 44 | return this.fromNode.number === otherConnectionGene.fromNode.number && this.toNode.number === otherConnectionGene.toNode.number 45 | && this.weight === otherConnectionGene.weight && this.enabled === otherConnectionGene.enabled && this.innovationNo === otherConnectionGene.innovationNo; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/AI learns to walk/ConnectionHistory.js: -------------------------------------------------------------------------------- 1 | class connectionHistory { 2 | constructor(from, to, inno, innovationNos) { 3 | this.fromNode = from; 4 | this.toNode = to; 5 | this.innovationNumber = inno; 6 | this.innovationNumbers = []; //the innovation Numbers from the connections of the genome which first had this mutation 7 | //this represents the genome and allows us to test if another genoeme is the same 8 | //this is before this connection was added 9 | arrayCopy(innovationNos, this.innovationNumbers); //copy (from, to) 10 | } 11 | 12 | //---------------------------------------------------------------------------------------------------------------- 13 | //returns whether the genome matches the original genome and the connection is between the same nodes 14 | matches(genome, from, to) { 15 | if (genome.genes.length === this.innovationNumbers.length) { //if the number of connections are different then the genoemes aren't the same 16 | if (from.number === this.fromNode && to.number === this.toNode) { 17 | //next check if all the innovation numbers match from the genome 18 | for (var i = 0; i < genome.genes.length; i++) { 19 | if (!this.innovationNumbers.includes(genome.genes[i].innovationNo)) { 20 | return false; 21 | } 22 | } 23 | //if reached this far then the innovationNumbers match the genes innovation numbers and the connection is between the same nodes 24 | //so it does match 25 | return true; 26 | } 27 | } 28 | return false; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/AI learns to walk/Node.js: -------------------------------------------------------------------------------- 1 | class Node { 2 | 3 | constructor(no) { 4 | this.number = no; 5 | this.inputSum = 0; //current sum i.e. before activation 6 | this.outputValue = 0; //after activation function is applied 7 | this.outputConnections = []; //new ArrayList(); 8 | this.layer = 0; 9 | this.drawPos = createVector(); 10 | } 11 | 12 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 13 | //the node sends its output to the inputs of the nodes its connected to 14 | engage() { 15 | if(this.layer != 0) { //no sigmoid for the inputs and bias 16 | this.outputValue = this.sigmoid(this.inputSum); 17 | } 18 | 19 | for(var i = 0; i < this.outputConnections.length; i++) { //for each connection 20 | if(this.outputConnections[i].enabled) { //dont do shit if not enabled 21 | this.outputConnections[i].toNode.inputSum += this.outputConnections[i].weight * this.outputValue; //add the weighted output to the sum of the inputs of whatever node this node is connected to 22 | } 23 | } 24 | } 25 | //---------------------------------------------------------------------------------------------------------------------------------------- 26 | //not used 27 | stepFunction(x) { 28 | if(x < 0) { 29 | return 0; 30 | } else { 31 | return 1; 32 | } 33 | } 34 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 35 | //sigmoid activation function 36 | sigmoid(x) { 37 | return 1.0 / (1.0 + pow(Math.E, -4.9 * x)); //todo check pow 38 | } 39 | //---------------------------------------------------------------------------------------------------------------------------------------------------------- 40 | //returns whether this node connected to the parameter node 41 | //used when adding a new connection 42 | isConnectedTo(node) { 43 | if(node.layer == this.layer) { //nodes in the same this.layer cannot be connected 44 | return false; 45 | } 46 | 47 | //you get it 48 | if(node.layer < this.layer) { 49 | for(var i = 0; i < node.outputConnections.length; i++) { 50 | if(node.outputConnections[i].toNode == this) { 51 | return true; 52 | } 53 | } 54 | } else { 55 | for(var i = 0; i < this.outputConnections.length; i++) { 56 | if(this.outputConnections[i].toNode == node) { 57 | return true; 58 | } 59 | } 60 | } 61 | 62 | return false; 63 | } 64 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 65 | //returns a copy of this node 66 | clone() { 67 | var clone = new Node(this.number); 68 | clone.layer = this.layer; 69 | return clone; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/AI learns to walk/sounds/LazerSoundEffect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/AI learns to walk/sounds/LazerSoundEffect.wav -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/AI learns to walk/sounds/burnedByLazer.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/AI learns to walk/sounds/burnedByLazer.mp3 -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/AI learns to walk/sounds/lazerShot.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/AI learns to walk/sounds/lazerShot.mp3 -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/AI learns to walk/sounds/screamingSoundWithPause.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/AI learns to walk/sounds/screamingSoundWithPause.wav -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Box2dGlobals.js: -------------------------------------------------------------------------------- 1 | //all the boring global variables which make it easier to use box2d stuff 2 | var Vec2 = Box2D.Common.Math.b2Vec2; 3 | var b2BodyDef = Box2D.Dynamics.b2BodyDef; 4 | var b2Body = Box2D.Dynamics.b2Body; 5 | var b2FixtureDef = Box2D.Dynamics.b2FixtureDef; 6 | var b2Fixture = Box2D.Dynamics.b2Fixture; 7 | var b2World = Box2D.Dynamics.b2World; 8 | var b2MassData = Box2D.Collision.Shapes.b2MassData; 9 | var b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape; 10 | var b2CircleShape = Box2D.Collision.Shapes.b2CircleShape; 11 | var b2EdgeChainDef = Box2D.Collision.Shapes.b2EdgeChainDef; 12 | 13 | var b2DebugDraw = Box2D.Dynamics.b2DebugDraw; 14 | var b2StaticBody = Box2D.Dynamics.b2Body.b2_staticBody; 15 | var b2DynamicBody = Box2D.Dynamics.b2Body.b2_dynamicBody; 16 | var b2RevoluteJoint = Box2D.Dynamics.Joints.b2RevoluteJoint; 17 | var b2MouseJoint = Box2D.Dynamics.Joints.b2MouseJoint; 18 | 19 | var b2RevoluteJointDef = Box2D.Dynamics.Joints.b2RevoluteJointDef; 20 | 21 | var b2PrismaticJoint = Box2D.Dynamics.Joints.b2PrismaticJoint; 22 | 23 | var b2PrismaticJointDef = Box2D.Dynamics.Joints.b2PrismaticJointDef; 24 | var b2MouseJointDef = Box2D.Dynamics.Joints.b2MouseJointDef; 25 | 26 | var b2FilterData = Box2D.Dynamics.b2FilterData; 27 | 28 | var b2DistanceJoint = Box2D.Dynamics.Joints.b2DistanceJoint; 29 | var b2DistanceJointDef = Box2D.Dynamics.Joints.b2DistanceJointDef; 30 | 31 | var b2WeldJoint = Box2D.Dynamics.Joints.b2WeldJoint; 32 | var b2WeldJointDef = Box2D.Dynamics.Joints.b2WeldJointDef; 33 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/AdvancedButtons/AllowBodyCollisionsToggleButton.js: -------------------------------------------------------------------------------- 1 | //this button toggles the allow body collisions boolean 2 | function generateAllowBodyCollisionsToggleButton(x, y, w, h){ 3 | let toggleButton = new ToggleButton(x, y, w, h, "Allow Body Collisions", true); 4 | 5 | toggleButton.toggleOn = () => { 6 | allowBodyCollisions = true; 7 | world.resetBodyCollisions(); 8 | }; 9 | 10 | toggleButton.toggleOff = () => { 11 | allowBodyCollisions = false; 12 | world.resetBodyCollisions(); 13 | }; 14 | 15 | return toggleButton; 16 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/AdvancedButtons/BasicOptionsButton.js: -------------------------------------------------------------------------------- 1 | //returns to the default buttons 2 | function generateBasicOptionsButton(x, y, w, h, modeNumber){ 3 | let buttonText = "Basic Options"; 4 | let mode = new Mode(); 5 | mode.onActivate = function () { 6 | buttonManager.deactivateActiveModes(); 7 | buttonManager.activateDefaultButtons(); 8 | this.deactivate(); 9 | }; 10 | 11 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 12 | } 13 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/AdvancedButtons/DeathUponFloorButton.js: -------------------------------------------------------------------------------- 1 | //this button allows the user to set the death upon floor property for certain bodies in the creature, during training if these bodies touch the floor then the player instantly dies 2 | function generateDeathUponFloorButton(x, y, w, h, modeNumber){ 3 | 4 | let buttonText = "Death upon floor"; 5 | let mode = new Mode(); 6 | mode.onActivate = function () { 7 | 8 | }; 9 | 10 | mode.name = "Death upon floor"; 11 | 12 | mode.everyFrame = function () { 13 | creature.selectBodyMouseIsOverExcluding(); 14 | }; 15 | 16 | mode.onDeactivate = function () { 17 | 18 | this.bodies = []; 19 | creature.unselectAllBodies(); 20 | 21 | }; 22 | mode.onClick = function () { 23 | 24 | if (creature.selectedBody !== -1) { 25 | creature.getSelectedBody().deathIfTouchesGround = !creature.getSelectedBody().deathIfTouchesGround; 26 | } 27 | }; 28 | mode.buttonPressed = function () { 29 | switch (keyCode) { 30 | case ESCAPE: 31 | buttonManager.deactivateActiveModes(); 32 | break; 33 | } 34 | }; 35 | 36 | mode.instructions.getMessages = function () { 37 | let messages = []; 38 | 39 | messages.push("Select shapes which will kill the player if they touch the ground") 40 | messages.push("CLICK: toggle ground kill on shape"); 41 | messages.push("ESC: exit "); 42 | return messages; 43 | }; 44 | 45 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 46 | } 47 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/AdvancedButtons/EditShapeLayersButton.js: -------------------------------------------------------------------------------- 1 | //this button allows the user to reorder the bodies so they appear in different orders 2 | function generateEditShapeLayersButton(x, y, w, h, modeNumber){ 3 | let buttonText = "Edit shape layers"; 4 | let mode = new Mode(); 5 | mode.bodies = []; 6 | 7 | mode.onActivate = function () { 8 | 9 | }; 10 | 11 | 12 | mode.everyFrame = function () { 13 | creature.selectBodyMouseIsOverExcluding(...this.bodies.map((b) => creature.getBodyNo(b))); 14 | }; 15 | 16 | mode.onDeactivate = function () { 17 | 18 | this.bodies = []; 19 | creature.unselectAllBodies(); 20 | 21 | }; 22 | mode.onClick = function () { 23 | 24 | if (creature.selectedBody !== -1) { 25 | this.bodies.push(creature.getSelectedBody()); 26 | creature.getSelectedBody().selectedAsShape1 = true; 27 | 28 | if (this.bodies.length === creature.bodies.length) { 29 | creature.bodies = this.bodies; 30 | 31 | buttonManager.deactivateActiveModes(); 32 | } 33 | } 34 | }; 35 | mode.buttonPressed = function () { 36 | switch (keyCode) { 37 | case ESCAPE: 38 | if (this.bodies.length === 0) { 39 | buttonManager.deactivateActiveModes(); 40 | } else { 41 | this.bodies[this.bodies.length - 1].selectedAsShape1 = false; 42 | this.bodies.splice(this.bodies.length - 1, 1);//remove last element of this.bodies 43 | 44 | } 45 | break; 46 | } 47 | }; 48 | 49 | mode.instructions.getMessages = function () { 50 | let messages = []; 51 | 52 | messages.push("Select the order the shapes should be displayed from back to front"); 53 | messages.push("CLICK: select shape"); 54 | if (buttonManager.getCurrentMode().bodies.length === 0) { 55 | messages.push("ESC: exit "); 56 | } else { 57 | messages.push("ESC: unselect shape") 58 | } 59 | return messages; 60 | }; 61 | 62 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 63 | } 64 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/AdvancedButtons/ShowJointLimitsToggleButton.js: -------------------------------------------------------------------------------- 1 | //toggles the show joint limits boolean 2 | function generateShowJointLimitsToggleButton(x, y, w, h){ 3 | let toggleButton = new ToggleButton(x, y, w, h, "Show Joint Limits", true); 4 | 5 | toggleButton.toggleOn = () => { 6 | showJointLimits = true; 7 | }; 8 | 9 | toggleButton.toggleOff = () => { 10 | showJointLimits = false; 11 | }; 12 | 13 | return toggleButton; 14 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/ConstructionButton.js: -------------------------------------------------------------------------------- 1 | //this button returns the player to the default buttons 2 | function generateConstructionButton(x, y, w, h, modeNumber) { 3 | 4 | let buttonText = "Construction"; 5 | let mode = new Mode(); 6 | 7 | mode.onActivate = function () { 8 | buttonManager.deactivateActiveModes(); 9 | buttonManager.activateDefaultButtons(); 10 | if (creature.selectedBodyToEditCosmetically !== -1) { 11 | creature.bodies[creature.selectedBodyToEditCosmetically].selectedAsShape1 = false; 12 | 13 | } 14 | 15 | }; 16 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 17 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/CosmeticButtons/ChangeFillColorButton.js: -------------------------------------------------------------------------------- 1 | function generateChangeFillColorButton(x, y, w, h, modeNumber) { 2 | let buttonText = "Change Fill Color"; 3 | let mode = new Mode(); 4 | mode.hotBar = new HotBar(200, 70, canvas.width - 400, 60, 7); 5 | mode.hotBar.addColorButtons(); 6 | 7 | //on activation automatically select the bodypart last selected during the previous activation 8 | mode.onActivate = function () { 9 | if (creature.selectedBodyToEditCosmetically !== -1) 10 | creature.bodies[creature.selectedBodyToEditCosmetically].selectedAsShape1 = true; 11 | 12 | }; 13 | mode.onDeactivate = function () { 14 | }; 15 | 16 | //if the hotbar has not selected a button then select the body part the mouse is over, 17 | mode.everyFrame = function () { 18 | creature.selectBodyMouseIsOverExcluding(creature.selectedBodyToEditCosmetically); 19 | 20 | }; 21 | 22 | //draws the hotbar 23 | mode.drawEffects = function () { 24 | this.hotBar.show(); 25 | }; 26 | 27 | //if no hotbar button is selected then select the body the mouse is over as shape 1 and as selecedBodyTOEditCosmetically 28 | //if a hotbar button is selected and the mouse is not over the hotbar(this prevents the item from being immediately placed) the image is attached to the selected body 29 | mode.onClick = function () { 30 | this.hotBar.onClick(); 31 | 32 | if (this.hotBar.selectedButton === -1) { 33 | if (creature.selectedBody === -1) {//if the mouse isnt over a body 34 | return; 35 | } 36 | 37 | if (creature.selectedBodyToEditCosmetically !== -1) 38 | creature.bodies[creature.selectedBodyToEditCosmetically].selectedAsShape1 = false; 39 | 40 | creature.selectedBodyToEditCosmetically = creature.selectedBody; 41 | creature.bodies[creature.selectedBodyToEditCosmetically].selectedAsShape1 = true; 42 | creature.bodies[creature.selectedBodyToEditCosmetically].selected = false; 43 | } else { 44 | if (creature.selectedBodyToEditCosmetically !== -1) { 45 | let button = this.hotBar.getCurrentlySelectedButton(); 46 | creature.bodies[creature.selectedBodyToEditCosmetically].setFillColorOfAllFixtures(button.color); 47 | } 48 | this.hotBar.unclickAllButtons(); 49 | } 50 | }; 51 | mode.buttonPressed = function () { 52 | switch (keyCode) { 53 | case ESCAPE: 54 | buttonManager.deactivateActiveModes(); 55 | break; 56 | } 57 | }; 58 | 59 | 60 | mode.instructions.getMessages = function () { 61 | let messages = []; 62 | messages.push("Change the fill Color of the selected shape"); 63 | messages.push("CLICK: Select Shape To add Images To"); 64 | return messages; 65 | }; 66 | 67 | 68 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 69 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/CosmeticButtons/DeleteImageButton.js: -------------------------------------------------------------------------------- 1 | //this button lets the user remove images 2 | function generateDeleteImageButton(x, y, w, h, modeNumber) { 3 | let buttonText = "Delete Image"; 4 | let mode = new Mode(); 5 | mode.selectedBody = -1; 6 | mode.selectedBodyImage = -1; 7 | 8 | //on activation automatically select the body part last selected during the previous activation 9 | mode.onActivate = function () { 10 | if (creature.selectedBodyToEditCosmetically !== -1) 11 | creature.bodies[creature.selectedBodyToEditCosmetically].selectedAsShape1 = false; 12 | }; 13 | 14 | //when deactivated unselect the current image 15 | mode.onDeactivate = function () { 16 | this.selectedBodyImage = -1; 17 | this.selectedBody = -1; 18 | }; 19 | 20 | //if currently dragging and an image is selected then set the new position of the image 21 | //else select images the mouse is over 22 | mode.everyFrame = function () { 23 | 24 | creature.unselectAllBodyImages(); 25 | let obj = creature.getBodyImageNoMouseIsOver(); 26 | if (obj.bodyNo !== -1) { 27 | this.selectedBody = obj.bodyNo; 28 | this.selectedBodyImage = obj.bodyImageNo; 29 | creature.bodies[this.selectedBody].bodyImages[this.selectedBodyImage].selectedForDelete = true; 30 | } 31 | 32 | }; 33 | 34 | //when the mouse is clicked start dragging if an image is selected 35 | mode.onClick = function () { 36 | if (this.selectedBodyImage !== -1) { 37 | creature.bodies[this.selectedBody].bodyImages.splice(this.selectedBodyImage, 1); 38 | warning = new Warning("Image Deleted", 100, true); 39 | this.selectedBodyImage = -1; 40 | this.selectedBody = -1; 41 | } 42 | }; 43 | mode.buttonPressed = function () { 44 | switch (keyCode) { 45 | case ESCAPE: 46 | buttonManager.deactivateActiveModes(); 47 | break; 48 | } 49 | }; 50 | mode.instructions.getMessages = function () { 51 | let messages = []; 52 | messages.push("Delete Images"); 53 | messages.push("CLICK: delete image"); 54 | messages.push("ESC: exit "); 55 | return messages; 56 | }; 57 | 58 | 59 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 60 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/CosmeticButtons/MoveResizeImageButton.js: -------------------------------------------------------------------------------- 1 | //this button lets the user move and resize images 2 | function generateMoveResizeImageButton(x, y, w, h, modeNumber) { 3 | let buttonText = "Move/Resize Image"; 4 | let mode = new Mode(); 5 | mode.selectedBody = -1; 6 | mode.selectedBodyImage = -1; 7 | 8 | //on activation automatically select the body part last selected during the previous activation 9 | mode.onActivate = function () { 10 | if (creature.selectedBodyToEditCosmetically !== -1) 11 | creature.bodies[creature.selectedBodyToEditCosmetically].selectedAsShape1 = false; 12 | 13 | 14 | }; 15 | 16 | //when deactivated unselect the current image 17 | mode.onDeactivate = function () { 18 | this.selectedBodyImage = -1; 19 | this.selectedBody = -1; 20 | }; 21 | 22 | //if currently dragging and an image is selected then set the new position of the image 23 | //else select images the mouse is over 24 | mode.everyFrame = function () { 25 | if (dragging && this.selectedBodyImage !== -1) { 26 | let difference = createVector(mouseX - dragMouseFrom.x, mouseY - dragMouseFrom.y); 27 | let newPosition = createVector(startingBodyPos.x + difference.x, startingBodyPos.y + difference.y); 28 | creature.bodies[this.selectedBody].bodyImages[this.selectedBodyImage].setPosition(newPosition.x,newPosition.y); 29 | } else { 30 | creature.unselectAllBodyImages(); 31 | let obj = creature.getBodyImageNoMouseIsOver(); 32 | if (obj.bodyNo !== -1) { 33 | this.selectedBody = obj.bodyNo; 34 | this.selectedBodyImage = obj.bodyImageNo; 35 | creature.bodies[this.selectedBody].bodyImages[this.selectedBodyImage].selected = true; 36 | } 37 | 38 | } 39 | 40 | }; 41 | 42 | //when the mouse is clicked start dragging if an image is selected 43 | mode.onClick = function () { 44 | if (this.selectedBodyImage !== -1) { 45 | dragMouseFrom = createVector(mouseX, mouseY); 46 | creature.bodies[this.selectedBody].bodyImages[this.selectedBodyImage].updateGlobalPositionBasedOnBodyAndRelativePositioning(); 47 | window.startingBodyPos = creature.bodies[this.selectedBody].bodyImages[this.selectedBodyImage].center; 48 | } 49 | }; 50 | 51 | 52 | mode.buttonPressed = function () { 53 | switch (keyCode) { 54 | case SHIFT: 55 | shiftIncrease = 10; 56 | break; 57 | 58 | case ESCAPE: 59 | 60 | buttonManager.deactivateActiveModes(); 61 | 62 | break; 63 | } 64 | }; 65 | 66 | 67 | //when the scroll wheel is moved scale the image which is currently selected 68 | mode.scrollWheel = function (mouseDirection) { 69 | if (this.selectedBodyImage !== -1) { 70 | creature.bodies[this.selectedBody].bodyImages[this.selectedBodyImage].scale(1 + (0.02 * shiftIncrease) * mouseDirection); 71 | } 72 | }; 73 | 74 | mode.instructions.getMessages = function () { 75 | let messages = []; 76 | 77 | messages.push("Move And Resize Images"); 78 | messages.push("CLICK AND DRAG: move image"); 79 | messages.push("MOUSE WHEEL: scale image"); 80 | messages.push("HOLD SHIFT: increase scale speed"); 81 | messages.push("ESC: exit "); 82 | 83 | return messages; 84 | }; 85 | 86 | 87 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 88 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/CosmeticButtons/MoveRotateImageButton.js: -------------------------------------------------------------------------------- 1 | //this button lets the user move and rotate iamges 2 | function generateMoveRotateImageButton(x, y, w, h, modeNumber) { 3 | let buttonText = "Move/Rotate Image"; 4 | let mode = new Mode(); 5 | mode.selectedBody = -1; 6 | mode.selectedBodyImage = -1; 7 | 8 | //on activation automatically select the body part last selected during the previous activation 9 | mode.onActivate = function () { 10 | if (creature.selectedBodyToEditCosmetically !== -1) 11 | creature.bodies[creature.selectedBodyToEditCosmetically].selectedAsShape1 = false; 12 | 13 | 14 | }; 15 | 16 | //when deactivated unselect the current image 17 | mode.onDeactivate = function () { 18 | this.selectedBodyImage = -1; 19 | this.selectedBody = -1; 20 | }; 21 | 22 | //if currently dragging and an image is selected then set the new position of the image 23 | //else select images the mouse is over 24 | mode.everyFrame = function () { 25 | if (dragging && this.selectedBodyImage !== -1) { 26 | let difference = createVector(mouseX - dragMouseFrom.x, mouseY - dragMouseFrom.y); 27 | let newPosition = createVector(startingBodyPos.x + difference.x, startingBodyPos.y + difference.y); 28 | creature.bodies[this.selectedBody].bodyImages[this.selectedBodyImage].setPosition(newPosition.x,newPosition.y); 29 | } else { 30 | creature.unselectAllBodyImages(); 31 | let obj = creature.getBodyImageNoMouseIsOver(); 32 | if (obj.bodyNo !== -1) { 33 | this.selectedBody = obj.bodyNo; 34 | this.selectedBodyImage = obj.bodyImageNo; 35 | creature.bodies[this.selectedBody].bodyImages[this.selectedBodyImage].selected = true; 36 | } 37 | 38 | } 39 | 40 | }; 41 | 42 | //when the mouse is clicked start dragging if an image is selected 43 | mode.onClick = function () { 44 | if (this.selectedBodyImage !== -1) { 45 | dragMouseFrom = createVector(mouseX, mouseY); 46 | creature.bodies[this.selectedBody].bodyImages[this.selectedBodyImage].updateGlobalPositionBasedOnBodyAndRelativePositioning(); 47 | window.startingBodyPos = creature.bodies[this.selectedBody].bodyImages[this.selectedBodyImage].center; 48 | } 49 | }; 50 | 51 | 52 | mode.buttonPressed = function () { 53 | switch (keyCode) { 54 | case SHIFT: 55 | shiftIncrease = 10; 56 | break; 57 | 58 | case ESCAPE: 59 | 60 | buttonManager.deactivateActiveModes(); 61 | 62 | break; 63 | } 64 | }; 65 | 66 | 67 | //when the scroll wheel is moved rotate the image which is currently selected 68 | mode.scrollWheel = function (mouseDirection) { 69 | if (this.selectedBodyImage !== -1) { 70 | creature.bodies[this.selectedBody].bodyImages[this.selectedBodyImage].rotate(PI / 200 * shiftIncrease * mouseDirection); 71 | } 72 | }; 73 | 74 | mode.instructions.getMessages = function () { 75 | let messages = []; 76 | 77 | messages.push("Move And Rotate Images"); 78 | messages.push("CLICK AND DRAG: move image"); 79 | messages.push("MOUSE WHEEL: rotate image"); 80 | messages.push("HOLD SHIFT: increase rotation speed"); 81 | messages.push("ESC: exit "); 82 | 83 | return messages; 84 | }; 85 | 86 | 87 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 88 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/CosmeticsButton.js: -------------------------------------------------------------------------------- 1 | 2 | //this button activated the cosmetic buttons 3 | function generateCosmeticsButton(x, y, w, h, modeNumber) { 4 | 5 | let buttonText = "Cosmetics"; 6 | let mode = new Mode(); 7 | 8 | mode.onActivate = function () { 9 | 10 | if (creature.bodies.length === 0) { 11 | warning = new Warning("Ur gonna need to add some shapes and shit before you make it pretty", 250); 12 | this.deactivate(); 13 | return; 14 | } 15 | 16 | buttonManager.deactivateActiveModes(); 17 | buttonManager.activateCosmeticButtons(); 18 | if(creature.bodies.length>0){ 19 | creature.selectedBodyToEditCosmetically = 0; 20 | creature.bodies[creature.selectedBodyToEditCosmetically].selectedAsShape1 = true; 21 | } 22 | 23 | }; 24 | 25 | 26 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 27 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/DefaultButtons/AddCircleButton.js: -------------------------------------------------------------------------------- 1 | //adds a circle to the creature 2 | function generateAddCircleButton(x, y, w, h, modeNumber) { 3 | let buttonText = "Add Circle"; 4 | let mode = new Mode(); 5 | 6 | mode.drawEffects = function () { 7 | fill(selectedBodyFillColor); 8 | stroke(selectedStrokeColor); 9 | ellipse(mouseX, mouseY, newCircleSize * 2); 10 | }; 11 | 12 | 13 | mode.onClick = function () { 14 | let circleBody = new Body(mouseX, mouseY, 0, true); 15 | circleBody.addCircleFixture(0, 0, newCircleSize); 16 | 17 | creature.bodies.push(circleBody); 18 | warning = new Warning("Circle Added", 100, true); 19 | 20 | }; 21 | mode.buttonPressed = function () { 22 | switch (keyCode) { 23 | case SHIFT: 24 | shiftIncrease = 10; 25 | break; 26 | 27 | case ESCAPE: 28 | buttonManager.deactivateActiveModes(); 29 | break; 30 | 31 | } 32 | }; 33 | mode.scrollWheel = function (mouseDirection) { 34 | newCircleSize = max(newCircleSize + (shiftIncrease) * mouseDirection, 1); 35 | }; 36 | 37 | mode.instructions.getMessages = function () { 38 | let messages = []; 39 | messages.push("Add Circle"); 40 | messages.push("MOUSE WHEEL: scale circle"); 41 | messages.push("HOLD SHIFT: increase scale speed"); 42 | messages.push("ESC: cancel"); 43 | return messages; 44 | }; 45 | 46 | 47 | 48 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 49 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/DefaultButtons/AddJointButton.js: -------------------------------------------------------------------------------- 1 | //creates a joint between 2 bodies 2 | function generateAddJointButton(x, y, w, h, modeNumber) { 3 | let buttonText = "Add Joint"; 4 | let mode = new Mode(); 5 | 6 | mode.selectedBody1 = -1; 7 | mode.selectedBody2 = -1; 8 | mode.jointAnchor = null; 9 | 10 | mode.onActivate = function () { 11 | this.selectedBody1 = -1; 12 | this.selectedBody2 = -1; 13 | 14 | 15 | if (creature.bodies.length === 0) { 16 | warning = new Warning("Mate, just a hint, why don't you add some shapes before you try and join them?", 300); 17 | } 18 | if (creature.bodies.length === 1) { 19 | warning = new Warning("So you've got one shape, which is fantastic. \n However what are you gonna join it to?", 400); 20 | } 21 | }; 22 | 23 | mode.drawEffects = function () { 24 | if (this.selectedBody2 !== -1) { 25 | push(); 26 | fill(0, 0, 0); 27 | stroke(255, 255, 0); 28 | strokeWeight(2); 29 | ellipse(mouseX, mouseY, 5); 30 | pop(); 31 | } 32 | }; 33 | 34 | mode.everyFrame = function () { 35 | if (this.selectedBody2 === -1) { 36 | creature.selectBodyMouseIsOverExcluding(this.selectedBody1); 37 | } 38 | }; 39 | 40 | 41 | mode.onClick = function () { 42 | if (creature.selectedBody !== -1) { 43 | if (this.selectedBody1 === -1) { 44 | this.selectedBody1 = creature.selectedBody; 45 | creature.getSelectedBody().selectedAsShape1 = true; 46 | } else if (this.selectedBody2 === -1) { 47 | this.selectedBody2 = creature.selectedBody; 48 | 49 | } else if (this.jointAnchor == null) { 50 | this.jointAnchor = getShiftedMousePos(); 51 | var newRevoluteJoint = new RevoluteJoint(creature.bodies[this.selectedBody1], creature.bodies[this.selectedBody2], this.jointAnchor.x, this.jointAnchor.y); 52 | creature.joints.push(newRevoluteJoint); 53 | this.selectedBody1 = -1; 54 | this.selectedBody2 = -1; 55 | this.jointAnchor = null; 56 | creature.unselectEverything(); 57 | warning = new Warning("Joint Added", 100, true); 58 | } 59 | } 60 | }; 61 | mode.buttonPressed = function () { 62 | switch (keyCode) { 63 | 64 | case ESCAPE: 65 | 66 | if (this.selectedBody1 === -1) { 67 | buttonManager.deactivateActiveModes(); 68 | } else if (this.selectedBody2 === -1) { 69 | this.selectedBody1 = -1; 70 | creature.unselectAllBodies(); 71 | } else { 72 | this.selectedBody2 = -1; 73 | } 74 | 75 | break; 76 | 77 | } 78 | }; 79 | mode.instructions.getMessages = function () { 80 | 81 | let currentMode = buttonManager.getCurrentMode(); 82 | let messages = []; 83 | if (currentMode.selectedBody1 === -1) { 84 | messages.push("Select first shape to join"); 85 | messages.push(" CLICK: select shape"); 86 | messages.push(" ESC: cancel"); 87 | } else if (currentMode.selectedBody2 === -1) { 88 | messages.push("Select second shape to join"); 89 | messages.push("CLICK: select shape"); 90 | messages.push("ESC: unselect first shape"); 91 | } else { 92 | messages.push("Position rotation point"); 93 | messages.push("CLICK: place rotation point"); 94 | messages.push("ESC: unselect second shape"); 95 | } 96 | return messages; 97 | }; 98 | 99 | 100 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 101 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/DefaultButtons/AdvancedButton.js: -------------------------------------------------------------------------------- 1 | //activates the advanced buttons 2 | function generateAdvancedButton(x, y, w, h, modeNumber) { 3 | let buttonText = "Advanced"; 4 | let mode = new Mode(); 5 | mode.onActivate = function () { 6 | buttonManager.deactivateActiveModes(); 7 | buttonManager.activateAdvancedButtons(); 8 | this.deactivate(); 9 | }; 10 | 11 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 12 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/DefaultButtons/CloneShapeButton.js: -------------------------------------------------------------------------------- 1 | //clones a body and allows the user to place it where they want 2 | //also clones any images attached to the body 3 | function generateCloneShapeButton(x, y, w, h, modeNumber) { 4 | 5 | 6 | let buttonText = "Clone Shape"; 7 | let mode = new Mode(); 8 | mode.bodyIsCloned = false; 9 | mode.onActivate = function () { 10 | if (creature.bodies.length === 0) { 11 | warning = new Warning("There is nothing to clone mate", 400); 12 | } 13 | }; 14 | 15 | mode.everyFrame = function () { 16 | if (this.bodyIsCloned) { 17 | creature.moveSelectedBodyOrJointToMousePos(); 18 | } else { 19 | creature.selectBodyMouseIsOverExcluding(); 20 | } 21 | }; 22 | 23 | mode.onDeactivate = function () { 24 | if (this.bodyIsCloned) { 25 | this.removeClone(); 26 | } 27 | }; 28 | 29 | mode.onClick = function () { 30 | if (creature.selectedBody !== -1) { 31 | if (!this.bodyIsCloned) { 32 | 33 | creature.bodies.push(creature.getSelectedBody().clone()); 34 | creature.getSelectedBody().selected = false; 35 | creature.selectBody(creature.bodies.length - 1); 36 | this.bodyIsCloned = true; 37 | dragMouseFrom = createVector(mouseX, mouseY); 38 | window.startingBodyPos = creature.getSelectedBody().getPixelCoordinates(); 39 | } else { 40 | this.bodyIsCloned = false; 41 | warning = new Warning("Shape Cloned", 100, true); 42 | 43 | } 44 | } 45 | }; 46 | mode.buttonPressed = function () { 47 | switch (keyCode) { 48 | case SHIFT: 49 | shiftIncrease = 10; 50 | break; 51 | 52 | case ESCAPE: 53 | if (this.bodyIsCloned) { 54 | this.removeClone(); 55 | } else { 56 | buttonManager.deactivateActiveModes(); 57 | } 58 | break; 59 | } 60 | }; 61 | mode.scrollWheel = function (mouseDirection) { 62 | if (creature.selectedBody !== -1 && this.bodyIsCloned) { 63 | creature.getSelectedBody().rotate(PI / 200 * shiftIncrease * mouseDirection); 64 | } 65 | }; 66 | mode.instructions.getMessages = function () { 67 | let messages = []; 68 | let currentMode = buttonManager.getCurrentMode(); 69 | if (!currentMode.bodyIsCloned) { 70 | messages.push("Select shape to clone"); 71 | messages.push(" CLICK: select shape"); 72 | messages.push(" ESC: cancel"); 73 | } else { 74 | messages.push("Position Clone"); 75 | messages.push("CLICK: confirm position of clone"); 76 | messages.push("MOUSE WHEEL: rotate clone"); 77 | messages.push("HOLD SHIFT: increase rotation speed"); 78 | messages.push("ESC: remove clone"); 79 | } 80 | return messages; 81 | }; 82 | 83 | mode.removeClone= function() { 84 | creature.getSelectedBody().remove(); 85 | creature.bodies.splice(creature.selectedBody, 1); 86 | creature.selectedBody = -1; 87 | this.bodyIsCloned = false; 88 | }; 89 | 90 | 91 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 92 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/DefaultButtons/DeleteButton.js: -------------------------------------------------------------------------------- 1 | //allows the user to delete bodies and joints 2 | function generateDeleteButton(x, y, w, h, modeNumber) { 3 | let buttonText = "Delete"; 4 | let mode = new Mode(); 5 | mode.onActivate = function () { 6 | if (creature.bodies.length === 0) { 7 | warning = new Warning("I'm curious, what exactly do you plan on deleting?", 150); 8 | } 9 | }; 10 | 11 | mode.everyFrame = function () { 12 | creature.selectBodyOrJointMouseIsOver(); 13 | }; 14 | 15 | 16 | mode.onClick = function () { 17 | if (creature.selectedBody !== -1) { 18 | creature.getSelectedBody().remove(); 19 | creature.bodies.splice(creature.selectedBody, 1); 20 | creature.selectedBody = -1; 21 | warning = new Warning("Shape Deleted", 100, true); 22 | 23 | } else if (creature.selectedJoint !== -1) { 24 | creature.getSelectedJoint().remove(); 25 | creature.joints.splice(creature.selectedJoint, 1); 26 | creature.selectedJoint = -1; 27 | warning = new Warning("Joint Deleted", 100, true); 28 | 29 | } 30 | }; 31 | mode.buttonPressed = function () { 32 | switch (keyCode) { 33 | case ESCAPE: 34 | buttonManager.deactivateActiveModes(); 35 | break; 36 | } 37 | }; 38 | mode.instructions.getMessages = function () { 39 | let messages = []; 40 | messages.push("Delete shapes and joints"); 41 | messages.push("CLICK: delete shape or joint"); 42 | messages.push("ESC: exit "); 43 | return messages; 44 | }; 45 | 46 | 47 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 48 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/DefaultButtons/FuseShapesButton.js: -------------------------------------------------------------------------------- 1 | //allows the user to fuse 2 bodies together, which adds all the fixtures of one body to the other and then deletes the first body 2 | function generateFuseShapesButton(x, y, w, h, modeNumber) { 3 | 4 | 5 | let buttonText = "Fuse Shapes"; 6 | let mode = new Mode(); 7 | 8 | mode.selectedBody1 = -1; 9 | mode.selectedBody2 = -1; 10 | 11 | 12 | mode.onActivate = function () { 13 | this.selectedBody1 = -1; 14 | this.selectedBody2 = -1; 15 | if (creature.bodies.length === 0) { 16 | warning = new Warning("What's the plan chief? There isn't anything to fuse", 200); 17 | } 18 | if (creature.bodies.length === 1) { 19 | warning = new Warning("Notice the S at the end of 'FUSE SHAPES' that means you're gonna need at least 2 shapes. \n It's what we call a plural.", 400); 20 | } 21 | }; 22 | 23 | 24 | mode.everyFrame = function () { 25 | creature.selectBodyMouseIsOverExcluding(this.selectedBody1); 26 | }; 27 | 28 | mode.onClick = function () { 29 | if (creature.selectedBody !== -1) { 30 | if (this.selectedBody1 === -1) { 31 | this.selectedBody1 = creature.selectedBody; 32 | creature.getSelectedBody().selectedAsShape1 = true; 33 | } else { 34 | this.selectedBody2 = creature.selectedBody; 35 | creature.fuseBodies(this.selectedBody1,this.selectedBody2); 36 | 37 | creature.unselectAllBodies(); 38 | 39 | this.selectedBody1 = -1; 40 | this.selectedBody2 = -1; 41 | warning = new Warning("Selected shapes are now fused", 100, true); 42 | 43 | } 44 | } 45 | }; 46 | mode.buttonPressed = function () { 47 | switch (keyCode) { 48 | 49 | case ESCAPE: 50 | 51 | if (this.selectedBody1 === -1) { 52 | buttonManager.deactivateActiveModes(); 53 | 54 | } else { 55 | this.selectedBody1 = -1; 56 | creature.unselectAllBodies(); 57 | } 58 | 59 | break; 60 | 61 | 62 | } 63 | }; 64 | mode.instructions.getMessages = function () { 65 | let messages = []; 66 | let currentMode = buttonManager.getCurrentMode(); 67 | if (currentMode.selectedBody1 === -1) { 68 | messages.push("Select first shape to fuse"); 69 | messages.push(" CLICK: select shape"); 70 | messages.push(" ESC: cancel"); 71 | } else { 72 | messages.push("Select second shape to fuse"); 73 | messages.push("CLICK: select shape"); 74 | messages.push("ESC: unselect first shape"); 75 | } 76 | return messages; 77 | }; 78 | 79 | 80 | 81 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 82 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/DefaultButtons/MoveResizeButton.js: -------------------------------------------------------------------------------- 1 | //allows the user to move and resize shit 2 | function generateMoveResizeButton(x, y, w, h, modeNumber) { 3 | 4 | let buttonText = "Move/Resize"; 5 | let mode = new Mode(); 6 | mode.onActivate = function () { 7 | if (creature.bodies.length === 0) { 8 | warning = new Warning("I worked on this for A YEAR and you're here trying to resize nothing \n I clearly overestimated my audience", 400); 9 | } 10 | }; 11 | 12 | 13 | mode.everyFrame = function () { 14 | if (!dragging) { 15 | creature.selectBodyOrJointMouseIsOver(); 16 | } else { 17 | creature.moveSelectedBodyOrJointToMousePos(); 18 | 19 | } 20 | 21 | 22 | }; 23 | 24 | 25 | mode.onClick = function () { 26 | if (creature.selectedBody !== -1) { 27 | dragMouseFrom = createVector(mouseX, mouseY); 28 | window.startingBodyPos = creature.bodies[creature.selectedBody].getPixelCoordinates(); 29 | 30 | } else if (creature.selectedJoint !== -1) { 31 | dragMouseFrom = createVector(mouseX, mouseY); 32 | window.startingAnchorPos = creature.joints[creature.selectedJoint].getPixelCoordinatesOfAnchor(0); 33 | 34 | } 35 | }; 36 | mode.buttonPressed = function () { 37 | switch (keyCode) { 38 | case SHIFT: 39 | shiftIncrease = 10; 40 | break; 41 | 42 | case ESCAPE: 43 | buttonManager.deactivateActiveModes(); 44 | break; 45 | 46 | } 47 | }; 48 | mode.scrollWheel = function (mouseDirection) { 49 | if (creature.selectedBody !== -1) { 50 | creature.bodies[creature.selectedBody].scale(1 + (0.02 * shiftIncrease) * mouseDirection); 51 | } 52 | }; 53 | mode.instructions.getMessages = function () { 54 | let messages = []; 55 | messages.push("Move and Resize"); 56 | messages.push("CLICK AND DRAG: move shape or joint"); 57 | messages.push("MOUSE WHEEL: scale shape"); 58 | messages.push("HOLD SHIFT: increase scale speed"); 59 | messages.push("ESC: exit "); 60 | return messages; 61 | }; 62 | 63 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 64 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/DefaultButtons/MoveRotateButton.js: -------------------------------------------------------------------------------- 1 | //allows the user to move and rotate shit 2 | function generateMoveRotateButton(x, y, w, h, modeNumber) { 3 | let buttonText = "Move/Rotate"; 4 | let mode = new Mode(); 5 | mode.onActivate = function () { 6 | if (creature.bodies.length === 0) { 7 | warning = new Warning("You can't move anything if there is nothing there genius", 150); 8 | } 9 | 10 | }; 11 | 12 | 13 | mode.everyFrame = function () { 14 | if (!dragging) { 15 | creature.selectBodyOrJointMouseIsOver(); 16 | } else { 17 | creature.moveSelectedBodyOrJointToMousePos(); 18 | 19 | } 20 | 21 | 22 | }; 23 | 24 | 25 | mode.onClick = function () { 26 | if (creature.selectedBody !== -1) { 27 | dragMouseFrom = createVector(mouseX, mouseY); 28 | window.startingBodyPos = creature.bodies[creature.selectedBody].getPixelCoordinates(); 29 | 30 | } else if (creature.selectedJoint !== -1) { 31 | dragMouseFrom = createVector(mouseX, mouseY); 32 | window.startingAnchorPos = creature.joints[creature.selectedJoint].getPixelCoordinatesOfAnchor(0); 33 | 34 | } 35 | }; 36 | mode.buttonPressed = function () { 37 | switch (keyCode) { 38 | case SHIFT: 39 | shiftIncrease = 10; 40 | break; 41 | 42 | case ESCAPE: 43 | 44 | buttonManager.deactivateActiveModes(); 45 | 46 | break; 47 | 48 | 49 | } 50 | }; 51 | mode.scrollWheel = function (mouseDirection) { 52 | if (creature.selectedBody !== -1) { 53 | if (creature.bodies[creature.selectedBody].fixtures.length === 1 && creature.bodies[creature.selectedBody].fixtures[0].fixtureType === "circle" && creature.bodies[creature.selectedBody].bodyImages.length === 0) { 54 | warning = new Warning("Did you really just try to rotate a circle", 100); 55 | } 56 | creature.bodies[creature.selectedBody].rotate(PI / 200 * shiftIncrease * mouseDirection); 57 | } 58 | }; 59 | mode.instructions.getMessages = function () { 60 | let messages = []; 61 | messages.push("Move and Rotate"); 62 | messages.push("CLICK AND DRAG: move shape or joint"); 63 | messages.push("MOUSE WHEEL: rotate shape"); 64 | messages.push("HOLD SHIFT: increase rotation speed"); 65 | messages.push("ESC: exit "); 66 | return messages; 67 | }; 68 | 69 | 70 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 71 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/EvolveButton.js: -------------------------------------------------------------------------------- 1 | //this button starts the evolution process 2 | function generateEvolveButton(x, y, w, h, modeNumber) { 3 | 4 | let buttonText = "Evolve"; 5 | let mode = new Mode(); 6 | mode.countDown = 1; 7 | mode.onActivate = function () { 8 | if (creature.bodies.length === 0) { 9 | warning = new Warning("NO", 50); 10 | this.deactivate(); 11 | return; 12 | } 13 | 14 | if (creature.joints.length === 0) { 15 | warning = new Warning("The whole point this entire thing if for the AI to control the creature \n you are going to need some joints for the creature to be able to move", 500); 16 | this.deactivate(); 17 | return; 18 | } 19 | this.countDown =1; 20 | }; 21 | 22 | mode.drawEffects = function(){ 23 | push(); 24 | textSize(50); 25 | fill(0); 26 | noStroke(); 27 | text("LOADING...", canvas.width/2,canvas.height/2); 28 | pop(); 29 | 30 | }; 31 | 32 | mode.everyFrame = function(){ 33 | if(this.countDown-- <= 0 ){ 34 | world.reset(); 35 | isCreatureScreaming = creature.isScreaming(); 36 | creatureObject = creature.getCreatureAsObject(); 37 | inCreatureCreatorMode = false; 38 | world.paused = false; 39 | buttonManager.activateLearningButtons(); 40 | AILearnsToWalkSetup(); 41 | this.deactivate(); 42 | paused = false; 43 | } 44 | }; 45 | 46 | 47 | 48 | 49 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 50 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/LearningButtons/DeathLazerSpeedValueButton.js: -------------------------------------------------------------------------------- 1 | //lets the user adjust the death lazer speed 2 | function generateDeathLazerSpeedValueButton(x, y, w, h) { 3 | let valueButton = new ValueButton(x, y, w, h, "DEATH Lazer Speed"); 4 | valueButton.getValue = () => deathLazerSpeed; 5 | valueButton.increaseValue = () => { 6 | deathLazerSpeed++; 7 | 8 | //reset everything since all previous scores are invalid 9 | 10 | population.bestOfEachSpecies=[]; 11 | population.bestScore = 0; 12 | population.globalBestScore = 0; 13 | for (let p of population.players) { 14 | p.bestScore = 0; 15 | } 16 | 17 | speciesNumber =0; 18 | for (let s of population.species) { 19 | s.rep.bestScore = 0; 20 | s.champ.bestScore = 0; 21 | s.bestFitness = 0; 22 | s.maxPlayerLength = 0; 23 | 24 | s.speciesNumber = speciesNumber; 25 | speciesNumber++; 26 | population.bestOfEachSpecies.push({champ: s.champ.cloneForReplay(), maxPlayerLength: 1}); 27 | 28 | 29 | 30 | } 31 | population.bestScoreOfAPreviousBatch = 0; 32 | population.resetGeneration(); 33 | resetAudio(); 34 | warning = new Warning("Generation Reset, all previous scores reset to 0 as they are now invalid", 300, true); 35 | }; 36 | valueButton.decreaseValue = () => deathLazerSpeed = max(1, deathLazerSpeed - 1); 37 | return valueButton; 38 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/LearningButtons/EditCreatureButton.js: -------------------------------------------------------------------------------- 1 | //this button returns the program to the creature creator section 2 | function generateEditCreatureButton(x, y, w, h, modeNumber) { 3 | 4 | let buttonText = "Edit Creature"; 5 | let mode = new Mode(); 6 | 7 | mode.onActivate = function () { 8 | world.reset(); 9 | inCreatureCreatorMode = true; 10 | setDefaultInstructions(); 11 | world.paused = true; 12 | panX = 0; 13 | buttonManager.activateDefaultButtons(); 14 | this.deactivate(); 15 | resetAudio(); 16 | }; 17 | 18 | 19 | return new ModeButton(x, y, w, h, buttonText, mode, modeNumber); 20 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/LearningButtons/MuteButton.js: -------------------------------------------------------------------------------- 1 | //this button allows the user to mute the audio because it kinda annoying 2 | function generateMuteButton(x, y, w, h) { 3 | let button = new Button(x, y, w, h, ""); 4 | button.show = function(){ 5 | if (muted) { 6 | image(mutedImage,this.x,this.y,this.w,this.h); 7 | } else { 8 | image(unmutedImage,this.x,this.y,this.w,this.h); 9 | } 10 | 11 | }; 12 | 13 | button.onClick = function(){ 14 | muted = !muted; 15 | manageSounds(); 16 | }; 17 | 18 | return button; 19 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/LearningButtons/NumberOfBatchesValueButton.js: -------------------------------------------------------------------------------- 1 | //this button allows the user to adjust the number of batches 2 | function generateNumberOfBatchesValueButton(x, y, w, h) { 3 | let valueButton = new ValueButton(x, y, w, h, "Number of Batches"); 4 | valueButton.getValue = () => population.numberOfBatches; 5 | valueButton.increaseValue = () => { 6 | 7 | population.setNumberOfBatches(population.numberOfBatches+1); 8 | population.resetGeneration(); 9 | resetAudio(); 10 | warning = new Warning(`Number of Batches: ${population.numberOfBatches}, Players Per Batch: ${population.playersPerBatch}`, 100, true); 11 | }; 12 | valueButton.decreaseValue = () =>{ 13 | if(population.numberOfBatches===1){ 14 | return; 15 | } 16 | 17 | population.setNumberOfBatches( population.numberOfBatches -1); 18 | population.resetGeneration(); 19 | resetAudio(); 20 | warning = new Warning(`Number of Batches: ${population.numberOfBatches}, Players Per Batch: ${population.playersPerBatch}`, 100, true); 21 | }; 22 | return valueButton; 23 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/LearningButtons/PopulationSizeValueButton.js: -------------------------------------------------------------------------------- 1 | //this button allows the user to adjust the number of players in the popyulation 2 | function generatePopulationSizeValueButton(x, y, w, h) { 3 | let valueButton = new ValueButton(x, y, w, h, "Population Size"); 4 | valueButton.getValue = () => populationSize; 5 | valueButton.increaseValue = () => { 6 | populationSize += 20; 7 | warning = new Warning("Population size will be updated at the start of the next generation", 300, true); 8 | 9 | 10 | }; 11 | valueButton.decreaseValue = () => { 12 | if(populationSize ===20) 13 | return; 14 | populationSize = max(20, populationSize - 20); 15 | warning = new Warning("Population size will be updated at the start of the next generation", 300, true); 16 | 17 | 18 | }; 19 | return valueButton; 20 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/LearningButtons/SimulationSpeedValueButton.js: -------------------------------------------------------------------------------- 1 | ////this button allows the user to adjust the simulation speed 2 | function generateSimulationSpeedValueButton(x, y, w, h) { 3 | let valueButton = new ValueButton(x, y, w, h, "Simulation Speed"); 4 | valueButton.getValue = ()=>simulationSpeed; 5 | valueButton.increaseValue = ()=>simulationSpeed++; 6 | valueButton.decreaseValue = ()=>simulationSpeed = max(1,simulationSpeed-1); 7 | return valueButton; 8 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/LearningButtons/SpeedUpWhenPlayersDieToggleButton.js: -------------------------------------------------------------------------------- 1 | //this button allows the user to toggle the auto speed up boolean, which will increase the simulation speed in proportion to the number of players which are dead. 2 | function generateSpeedUpWhenPlayersDieToggleButton(x, y, w, h) { 3 | let toggleButton = new ToggleButton(x, y, w, h, "Speed Up When Players Die", false); 4 | 5 | toggleButton.toggleOn = () => { 6 | autoSpeedUp = true; 7 | showDeath = false; 8 | warning = new Warning("Speed will increase as players die, Death animation removed for better performance", 300, true); 9 | 10 | }; 11 | 12 | toggleButton.toggleOff = () => { 13 | autoSpeedUp = false; 14 | showDeath = true; 15 | }; 16 | 17 | return toggleButton; 18 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/PlayPauseButton.js: -------------------------------------------------------------------------------- 1 | //this button allows the user to play/pause the simulation 2 | function generatePlayPauseButton(x, y, w, h) { 3 | let button = new Button(x, y, w, h, ""); 4 | button.show = function(){ 5 | push(); 6 | !this.mouseOverButton()? fill(255,241,0):fill(150,150,0); 7 | strokeWeight(2); 8 | stroke(0); 9 | rectMode(CORNER); 10 | 11 | if (world.paused) { 12 | beginShape(); 13 | vertex(this.x, this.y); 14 | vertex(this.x, this.y + this.h); 15 | vertex(this.x + this.w, this.y + this.w / 2.0); 16 | endShape(CLOSE); 17 | 18 | } else { 19 | rect(this.x, this.y, 2 * this.w / 5, this.h); 20 | rect(this.x + 3 * this.w / 5, y, 2 * this.w / 5, this.h); 21 | 22 | } 23 | pop(); 24 | }; 25 | 26 | button.onClick = function(){ 27 | world.togglePause(); 28 | }; 29 | 30 | return button; 31 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/ButtonCreationMethods/StopButton.js: -------------------------------------------------------------------------------- 1 | //this button allows the user to stop the simulation 2 | function generateStopButton(x, y, w, h) { 3 | let button = new Button(x, y, w, h, ""); 4 | button.show = function(){ 5 | push(); 6 | !this.mouseOverButton()? fill(255,241,0):fill(150,150,0); 7 | strokeWeight(2); 8 | stroke(0); 9 | rectMode(CORNER); 10 | rect(x, y, this.w, this.h); 11 | pop(); 12 | }; 13 | 14 | button.onClick = function(){ 15 | world.reset(); 16 | }; 17 | 18 | return button; 19 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CommonColorsArray.js: -------------------------------------------------------------------------------- 1 | // a list of common colors ripped from the internet 2 | 3 | let commonColors = [[128, 0, 0] 4 | , [139, 0, 0] 5 | , [165, 42, 42] 6 | , [178, 34, 34] 7 | , [220, 20, 60] 8 | , [255, 0, 0] 9 | , [255, 99, 71] 10 | , [255, 127, 80] 11 | , [205, 92, 92] 12 | , [240, 128, 128] 13 | , [233, 150, 122] 14 | , [250, 128, 114] 15 | , [255, 160, 122] 16 | , [255, 69, 0] 17 | , [255, 140, 0] 18 | , [255, 165, 0] 19 | , [255, 215, 0] 20 | , [184, 134, 11] 21 | , [218, 165, 32] 22 | , [238, 232, 170] 23 | , [189, 183, 107] 24 | , [240, 230, 140] 25 | , [128, 128, 0] 26 | , [255, 255, 0] 27 | , [154, 205, 50] 28 | , [85, 107, 47] 29 | , [107, 142, 35] 30 | , [124, 252, 0] 31 | , [127, 255, 0] 32 | , [173, 255, 47] 33 | , [0, 100, 0] 34 | , [0, 128, 0] 35 | , [34, 139, 34] 36 | , [0, 255, 0] 37 | , [50, 205, 50] 38 | , [144, 238, 144] 39 | , [152, 251, 152] 40 | , [143, 188, 143] 41 | , [0, 250, 154] 42 | , [0, 255, 127] 43 | , [46, 139, 87] 44 | , [102, 205, 170] 45 | , [60, 179, 113] 46 | , [32, 178, 170] 47 | , [47, 79, 79] 48 | , [0, 128, 128] 49 | , [0, 139, 139] 50 | , [0, 255, 255] 51 | , [0, 255, 255] 52 | , [224, 255, 255] 53 | , [0, 206, 209] 54 | , [64, 224, 208] 55 | , [72, 209, 204] 56 | , [175, 238, 238] 57 | , [127, 255, 212] 58 | , [176, 224, 230] 59 | , [95, 158, 160] 60 | , [70, 130, 180] 61 | , [100, 149, 237] 62 | , [0, 191, 255] 63 | , [30, 144, 255] 64 | , [173, 216, 230] 65 | , [135, 206, 235] 66 | , [135, 206, 250] 67 | , [25, 25, 112] 68 | , [0, 0, 128] 69 | , [0, 0, 139] 70 | , [0, 0, 205] 71 | , [0, 0, 255] 72 | , [65, 105, 225] 73 | , [138, 43, 226] 74 | , [75, 0, 130] 75 | , [72, 61, 139] 76 | , [106, 90, 205] 77 | , [123, 104, 238] 78 | , [147, 112, 219] 79 | , [139, 0, 139] 80 | , [148, 0, 211] 81 | , [153, 50, 204] 82 | , [186, 85, 211] 83 | , [128, 0, 128] 84 | , [216, 191, 216] 85 | , [221, 160, 221] 86 | , [238, 130, 238] 87 | , [255, 0, 255] 88 | , [218, 112, 214] 89 | , [199, 21, 133] 90 | , [219, 112, 147] 91 | , [255, 20, 147] 92 | , [255, 105, 180] 93 | , [255, 182, 193] 94 | , [255, 192, 203] 95 | , [250, 235, 215] 96 | , [245, 245, 220] 97 | , [255, 228, 196] 98 | , [255, 235, 205] 99 | , [245, 222, 179] 100 | , [255, 248, 220] 101 | , [255, 250, 205] 102 | , [250, 250, 210] 103 | , [255, 255, 224] 104 | , [139, 69, 19] 105 | , [160, 82, 45] 106 | , [210, 105, 30] 107 | , [205, 133, 63] 108 | , [244, 164, 96] 109 | , [222, 184, 135] 110 | , [210, 180, 140] 111 | , [188, 143, 143] 112 | , [255, 228, 181] 113 | , [255, 222, 173] 114 | , [255, 218, 185] 115 | , [255, 228, 225] 116 | , [255, 240, 245] 117 | , [250, 240, 230] 118 | , [253, 245, 230] 119 | , [255, 239, 213] 120 | , [255, 245, 238] 121 | , [245, 255, 250] 122 | , [112, 128, 144] 123 | , [119, 136, 153] 124 | , [176, 196, 222] 125 | , [230, 230, 250] 126 | , [255, 250, 240] 127 | , [240, 248, 255] 128 | , [248, 248, 255] 129 | , [240, 255, 240] 130 | , [255, 255, 240] 131 | , [240, 255, 255] 132 | , [255, 250, 250]]; 133 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/CBHead.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/CBHead.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/Hat 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/Hat 1.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/L eye 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/L eye 1.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/R eye 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/R eye 1.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/eyes1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/eyes1.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 1.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 10.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 2.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 3.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 4.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 5.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 6.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 7.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 8.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/face 9.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/mouth 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/mouth 1.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/mouth 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/mouth 2.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/mouth1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/mouth1.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/mustache 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/mustache 1.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/mustache 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/CosmeticImages/mustache 2.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/Instruction.js: -------------------------------------------------------------------------------- 1 | //a class designed to have its getMessages function overwritten so it displays different messages depending on what mode its in 2 | class Instruction { 3 | 4 | getMessages() { 5 | return [] 6 | } 7 | 8 | 9 | //writes the defaultInstructions to the screen. 10 | show() { 11 | 12 | let messages = this.getMessages(); 13 | if (messages.length === 0) { 14 | return; 15 | } 16 | 17 | //full message is the everything except for the heading 18 | let fullMessage = ""; 19 | for (var i = 1; i < messages.length; i++) { 20 | fullMessage += messages[i] + "\t\t\t"; 21 | } 22 | 23 | 24 | push(); 25 | //show Heading 26 | textAlign(CENTER, CENTER); 27 | 28 | fill(255,255,0); 29 | stroke(255,255,0); 30 | strokeWeight(1); 31 | textSize(20); 32 | noStroke(); 33 | 34 | 35 | textSize(25); 36 | text(messages[0], canvas.width / 2, 15); 37 | 38 | 39 | 40 | //show defaultInstructions 41 | textFont(smallFont); 42 | 43 | textSize(15); 44 | noStroke(); 45 | text(fullMessage, canvas.width / 2+25, 45); 46 | pop(); 47 | } 48 | } 49 | //sets the default defaultInstructions when the player is not in a mode, for when they just chillin 50 | function setDefaultInstructions() { 51 | defaultInstructions = new Instruction(); 52 | if(inCreatureCreatorMode) { 53 | defaultInstructions.getMessages = function () { 54 | let messages = []; 55 | messages.push("Creature Creator"); 56 | messages.push("SPACE: play/pause simulation"); 57 | if (!world.isReset) { 58 | messages.push("CLICK AND DRAG: move shapes"); 59 | messages.push("R: reset/stop simulation"); 60 | } 61 | return messages; 62 | } 63 | }else{ 64 | defaultInstructions.getMessages = function () { 65 | let messages = []; 66 | messages.push("Training your creature"); 67 | messages.push("TAB: change view mode"); 68 | messages.push("SPACE: play/pause"); 69 | 70 | 71 | return messages; 72 | } 73 | } 74 | } 75 | 76 | //show the bar and the defaultInstructions at the top of the screen 77 | function showInstructions() { 78 | 79 | //draw black bar at top of screen 80 | push(); 81 | strokeWeight(2); 82 | stroke(0, 0, 0); 83 | fill(0,50); 84 | image(topImage, 0,0,canvas.width,60); 85 | rect(1, 1, canvas.width-2, 60); 86 | pop(); 87 | 88 | //write the default Instructions to the screen if not in a mode 89 | if (buttonManager.modeNo === -1) { 90 | defaultInstructions.show(); 91 | } else {//otherwise show the modes instructions 92 | buttonManager.getCurrentMode().instructions.show(); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/MouseJoint.js: -------------------------------------------------------------------------------- 1 | //a class which handles all the mouse Joint logic which is used to drag bodies around in the creature creator mode 2 | class MouseJoint { 3 | 4 | constructor() { 5 | this.mouseJoint; 6 | this.isActive = false; 7 | 8 | } 9 | 10 | //create a new mouse joint if a body is clicked on 11 | onClick(){ 12 | this.destroyJoint(); 13 | let bodyClickedOn = creature.getBodyNoMouseIsOver(); 14 | 15 | if (bodyClickedOn === -1) { 16 | return; 17 | } 18 | 19 | //create mouse joint definition with the clicked on body at the point where the mouse clicked 20 | let mouseJointDef = new b2MouseJointDef(); 21 | let groundBody = new Body(0, 0, 0, false);// the mouse joint needs a static object to "ground it" whatever that means, all i know is that it works. 22 | mouseJointDef.bodyA = groundBody.body; 23 | mouseJointDef.bodyB = creature.bodies[bodyClickedOn].body; 24 | mouseJointDef.collideConnected = true; 25 | mouseJointDef.maxForce = 10000000; 26 | mouseJointDef.dampingRatio = 0; 27 | this.mouseJoint = world.box2dWorld.CreateJoint(mouseJointDef); 28 | this.mouseJoint.m_localAnchor = creature.bodies[bodyClickedOn].getLocalWorldCoordinatesOfPixelLocation(getShiftedMousePos()); 29 | 30 | this.updateTarget(); 31 | this.isActive = true; 32 | } 33 | 34 | //updates the target of the joint to the new mouse position 35 | updateTarget(){ 36 | if(this.isActive) { 37 | this.mouseJoint.SetTarget(new Vec2((getShiftedMousePos().x) / SCALE, (getShiftedMousePos().y) / SCALE)); 38 | } 39 | } 40 | 41 | //removes the joint from the box2dWorld 42 | destroyJoint(){ 43 | if (this.isActive) { 44 | world.box2dWorld.DestroyJoint(this.mouseJoint); 45 | this.isActive = false; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Creature creator/Warning.js: -------------------------------------------------------------------------------- 1 | //a warning is a message to the user which will appear at the bottom of the screen for lifespan frames. 2 | class Warning { 3 | 4 | constructor(message, lifespan, isMessage) { 5 | this.message = message;//if the warning is a message then it will be yellow, otherwise it will be red 6 | this.lifespan = lifespan; 7 | 8 | if (isMessage) { 9 | this.isMessage = isMessage; 10 | } else { 11 | this.isMessage = false; 12 | } 13 | 14 | } 15 | 16 | //show the warning and reduce its lifespan 17 | show() { 18 | if (this.lifespan > 0) { 19 | this.lifespan--; 20 | push(); 21 | textAlign(CENTER, CENTER); 22 | this.isMessage ? fill(255, 255, 0, 230) : fill(255, 0, 0, 255); 23 | 24 | stroke(0, 200); 25 | 26 | strokeWeight(3); 27 | textSize(25); 28 | 29 | text(this.message, canvas.width / 2, canvas.height - 50); 30 | pop(); 31 | } 32 | } 33 | 34 | //returns whether or not the lifespan is 0 35 | isFinished() { 36 | return this.lifespan <= 0; 37 | } 38 | } 39 | 40 | let warningFade = 0; 41 | let maxWarningFade = 100; 42 | let warningFadeSpeed = 20; 43 | 44 | //shows the current warning 45 | function showWarning() { 46 | if (!warning) { 47 | return; 48 | } 49 | //fade the warning out 50 | if (warning.isFinished()) { 51 | warningFade = max(0, warningFade - warningFadeSpeed); 52 | warning.isMessage ? fill(100, 100, 0, warningFade) : fill(100, 0, 0, warningFade); 53 | noStroke(); 54 | rect(0, canvas.height - 95, canvas.width, 100); 55 | return; 56 | } 57 | 58 | //fade the warning in 59 | warningFade = min(maxWarningFade, warningFade + warningFadeSpeed); 60 | warning.isMessage ? fill(100, 100, 0, warningFade) : fill(100, 0, 0, warningFade); 61 | noStroke(); 62 | rect(0, canvas.height - 95, canvas.width, 100); 63 | 64 | warning.show(); 65 | } -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Fonts/RobotoMono-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Fonts/RobotoMono-Bold.ttf -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/Fonts/RobotoMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/Fonts/RobotoMono-Regular.ttf -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/README.md: -------------------------------------------------------------------------------- 1 | # AI Learns To Walk with editor 2 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/pics/ConveryerBeltSection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/pics/ConveryerBeltSection.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/pics/dangerFloor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/pics/dangerFloor.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/pics/floorTiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/pics/floorTiles.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/pics/lazerBurnGround3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/pics/lazerBurnGround3.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/pics/mutedYellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/pics/mutedYellow.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/pics/topImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/pics/topImage.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Creature Creator/pics/unmutedYellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Creature Creator/pics/unmutedYellow.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/ConnectionGene.js: -------------------------------------------------------------------------------- 1 | //a connection between 2 nodes 2 | class connectionGene { 3 | constructor(from, to, w, inno) { 4 | this.fromNode = from; 5 | this.toNode = to; 6 | this.weight = w; 7 | this.enabled = true; 8 | this.innovationNo = inno; //each connection is given a innovation number to compare genomes 9 | 10 | } 11 | 12 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 13 | //changes the this.weight 14 | mutateWeight() { 15 | var rand2 = random(1); 16 | if (rand2 < 0.1) { //10% of the time completely change the this.weight 17 | this.weight = random(-1, 1); 18 | } else { //otherwise slightly change it 19 | this.weight += (randomGaussian() / 50); 20 | //keep this.weight between bounds 21 | if (this.weight > 1) { 22 | this.weight = 1; 23 | } 24 | if (this.weight < -1) { 25 | this.weight = -1; 26 | 27 | } 28 | } 29 | } 30 | 31 | //---------------------------------------------------------------------------------------------------------- 32 | //returns a copy of this connectionGene 33 | clone(from, to) { 34 | var clone = new connectionGene(from, to, this.weight, this.innovationNo); 35 | clone.enabled = this.enabled; 36 | 37 | return clone; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/ConnectionHistory.js: -------------------------------------------------------------------------------- 1 | class connectionHistory { 2 | constructor(from, to, inno, innovationNos) { 3 | this.fromNode = from; 4 | this.toNode = to; 5 | this.innovationNumber = inno; 6 | this.innovationNumbers = []; 7 | arrayCopy(innovationNos, this.innovationNumbers); //copy (from, to) 8 | } 9 | 10 | 11 | // ArrayList innovationNumbers = new ArrayList();//the innovation Numbers from the connections of the genome which first had this mutation 12 | //this represents the genome and allows us to test if another genoeme is the same 13 | //this is before this connection was added 14 | 15 | //--------------------------------------------------------------------------------------------------------------------------------------------------------- 16 | // //constructor 17 | // connectionHistory(int from, int to, int inno, ArrayList innovationNos) { 18 | // fromNode = from; 19 | // toNode = to; 20 | // innovationNumber = inno; 21 | // innovationNumbers = (ArrayList)innovationNos.clone(); 22 | // } 23 | // //--------------------------------------------------------------------------------------------------------------------------------------------------------- 24 | //returns whether the genome matches the original genome and the connection is between the same nodes 25 | matches(genome, from, to) { 26 | if(genome.genes.length === this.innovationNumbers.length) { //if the number of connections are different then the genoemes aren't the same 27 | if(from.number === this.fromNode && to.number === this.toNode) { 28 | //next check if all the innovation numbers match from the genome 29 | for(var i = 0; i < genome.genes.length; i++) { 30 | if(!this.innovationNumbers.includes(genome.genes[i].innovationNo)) { 31 | return false; 32 | } 33 | } 34 | //if reached this far then the innovationNumbers match the genes innovation numbers and the connection is between the same nodes 35 | //so it does match 36 | return true; 37 | } 38 | } 39 | return false; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Node.js: -------------------------------------------------------------------------------- 1 | class Node { 2 | 3 | constructor(no) { 4 | this.number = no; 5 | this.inputSum = 0; //current sum i.e. before activation 6 | this.outputValue = 0; //after activation function is applied 7 | this.outputConnections = []; //new ArrayList(); 8 | this.layer = 0; 9 | this.drawPos = createVector(); 10 | } 11 | 12 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 13 | //the node sends its output to the inputs of the nodes its connected to 14 | engage() { 15 | if(this.layer != 0) { //no sigmoid for the inputs and bias 16 | this.outputValue = this.sigmoid(this.inputSum); 17 | } 18 | 19 | for(var i = 0; i < this.outputConnections.length; i++) { //for each connection 20 | if(this.outputConnections[i].enabled) { //dont do shit if not enabled 21 | this.outputConnections[i].toNode.inputSum += this.outputConnections[i].weight * this.outputValue; //add the weighted output to the sum of the inputs of whatever node this node is connected to 22 | } 23 | } 24 | } 25 | //---------------------------------------------------------------------------------------------------------------------------------------- 26 | //not used 27 | stepFunction(x) { 28 | if(x < 0) { 29 | return 0; 30 | } else { 31 | return 1; 32 | } 33 | } 34 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 35 | //sigmoid activation function 36 | sigmoid(x) { 37 | return 1.0 / (1.0 + pow(Math.E, -4.9 * x)); //todo check pow 38 | } 39 | //---------------------------------------------------------------------------------------------------------------------------------------------------------- 40 | //returns whether this node connected to the parameter node 41 | //used when adding a new connection 42 | isConnectedTo(node) { 43 | if(node.layer == this.layer) { //nodes in the same this.layer cannot be connected 44 | return false; 45 | } 46 | 47 | //you get it 48 | if(node.layer < this.layer) { 49 | for(var i = 0; i < node.outputConnections.length; i++) { 50 | if(node.outputConnections[i].toNode == this) { 51 | return true; 52 | } 53 | } 54 | } else { 55 | for(var i = 0; i < this.outputConnections.length; i++) { 56 | if(this.outputConnections[i].toNode == node) { 57 | return true; 58 | } 59 | } 60 | } 61 | 62 | return false; 63 | } 64 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 65 | //returns a copy of this node 66 | clone() { 67 | var clone = new Node(this.number); 68 | clone.layer = this.layer; 69 | return clone; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/CBHead2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/CBHead2.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/CBHead3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/CBHead3.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/car.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/car.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/darkness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/darkness.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/grass.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/grass2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/grass2.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/grass3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/grass3.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/grass4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/grass4.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/grass5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/grass5.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/grass6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/grass6.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/head.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/headLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/headLarge.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/sky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/sky.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/wheel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/wheel.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/wheel2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/Hill Climb Racing/Pics/wheel2.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/README.md: -------------------------------------------------------------------------------- 1 | # Hill Climb Racing AI 2 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/Wheel.js: -------------------------------------------------------------------------------- 1 | class Wheel { 2 | constructor(x, y, r, chassisBody, world) { 3 | 4 | this.startingPosition = createVector(x, y); 5 | this.radius = r; 6 | this.body; 7 | this.world = world; 8 | this.id = "wheel"; 9 | this.onGround = false; 10 | this.createBody(); 11 | 12 | this.rimBody; 13 | let bodyDef = new b2BodyDef(); 14 | bodyDef.type = b2DynamicBody; 15 | 16 | bodyDef.position.x = this.startingPosition.x / SCALE; 17 | bodyDef.position.y = this.startingPosition.y / SCALE; 18 | bodyDef.angle = 0; 19 | 20 | let fixDef = new b2FixtureDef(); 21 | fixDef.density = 0.05; 22 | fixDef.friction = 0.99; 23 | fixDef.restitution = 0.2; 24 | fixDef.shape = new b2CircleShape(this.radius / SCALE); 25 | 26 | 27 | this.rimBody = this.world.CreateBody(bodyDef); 28 | 29 | 30 | var filtData = new b2FilterData(); 31 | filtData.groupIndex = -1; 32 | this.rimBody.CreateFixture(fixDef).SetFilterData(filtData); 33 | 34 | this.rimBody.SetUserData(this); 35 | 36 | if (chassisBody != null) { 37 | var revJointDef = new b2RevoluteJointDef(); 38 | revJointDef.Initialize(this.body, this.rimBody, this.body.GetPosition()); 39 | this.joint = this.world.CreateJoint(revJointDef); 40 | } 41 | 42 | if (chassisBody != null) { 43 | var prisJointDef = new b2PrismaticJointDef(); 44 | prisJointDef.Initialize(this.rimBody, chassisBody, this.body.GetPosition(), new Vec2(0, -1)); 45 | this.prisJoint = this.world.CreateJoint(prisJointDef); 46 | 47 | 48 | 49 | var distJointDef = new b2DistanceJointDef(); 50 | var anchorWheel = new Vec2(x / SCALE, y / SCALE); 51 | var anchorCar = new Vec2((x) / SCALE, (y - r * 3) / SCALE); 52 | distJointDef.Initialize(this.rimBody, chassisBody, anchorWheel, anchorCar); 53 | distJointDef.frequencyHz = 70; 54 | distJointDef.dampingRatio = 25; 55 | this.distJoint = this.world.CreateJoint(distJointDef); 56 | 57 | 58 | 59 | // var weldJointDef = new b2WeldJointDef(); 60 | // weldJointDef.Initialize(this.rimBody, chassisBody, anchorWheel); 61 | // this.weldJoint = this.world.CreateJoint(weldJointDef); 62 | // 63 | 64 | 65 | } 66 | this.body.SetAngularDamping(1.8); 67 | 68 | 69 | 70 | } 71 | 72 | 73 | createBody() { 74 | let bodyDef = new b2BodyDef(); 75 | bodyDef.type = b2DynamicBody; 76 | 77 | bodyDef.position.x = this.startingPosition.x / SCALE; 78 | bodyDef.position.y = this.startingPosition.y / SCALE; 79 | bodyDef.angle = 0; 80 | 81 | let fixDef = new b2FixtureDef(); 82 | fixDef.density = 1; 83 | fixDef.friction = 1.5; //0.99; 84 | fixDef.restitution = 0.1; 85 | fixDef.shape = new b2CircleShape(this.radius / SCALE); 86 | 87 | this.body = this.world.CreateBody(bodyDef); 88 | 89 | var filtData = new b2FilterData(); 90 | // filtData.groupIndex = -1; 91 | filtData.categoryBits = WHEEL_CATEGORY; 92 | filtData.maskBits = WHEEL_MASK; 93 | this.body.CreateFixture(fixDef).SetFilterData(filtData); 94 | this.body.SetUserData(this); 95 | 96 | } 97 | 98 | show() { 99 | push(); 100 | 101 | let x = this.body.GetPosition().x * SCALE; 102 | let y = this.body.GetPosition().y * SCALE; 103 | let angle = this.body.GetAngle(); 104 | translate(x - panX, y - panY); 105 | rotate(angle); 106 | 107 | image(wheelSprite, -this.radius, -this.radius, this.radius * 2, this.radius * 2); 108 | 109 | pop(); 110 | 111 | } 112 | 113 | 114 | 115 | } 116 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/Hill Climb Racing/World.js: -------------------------------------------------------------------------------- 1 | class World { 2 | constructor() { 3 | this.world = new b2World(new Vec2(0, 10), true); 4 | this.playersInWorld = 0; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/MarbleCalculator/looseRect.js: -------------------------------------------------------------------------------- 1 | class LooseRect { 2 | constructor(x1, y1, x2, y2, thickness, mass = 1) { 3 | this.startingX1 = x1; 4 | this.startingX2 = x2; 5 | this.startingY1 = y1; 6 | this.startingY2 = y2; 7 | this.center = createVector((x1 + x2) / 2, (y1 + y2) / 2); 8 | this.width = dist(x1, y1, x2, y2); 9 | this.height = thickness; 10 | this.rotation = atan((y2 - y1) / (x2 - x1)); 11 | this.mass = mass; 12 | this.selected = false; 13 | this.zoomedPosition; 14 | if(mass == 1) { 15 | var options = { 16 | angle: this.rotation, 17 | friction: 0.01, 18 | restitution: 0.1 19 | } 20 | } else { 21 | var options = { 22 | angle: this.rotation, 23 | friction: 0.01, 24 | restitution: 0.1, 25 | mass: this.mass 26 | } 27 | } 28 | this.body = Bodies.rectangle(this.center.x, this.center.y, this.width, this.height, options); 29 | 30 | 31 | World.add(world, this.body); 32 | } 33 | 34 | show() { 35 | noStroke(); 36 | push(); 37 | this.zoomedPosition = createVector(this.body.position.x, this.body.position.y); 38 | this.zoomedPosition.mult(zoom); 39 | translate(this.zoomedPosition.x - cameraX, this.zoomedPosition.y - cameraY); 40 | rotate(this.body.angle); 41 | fill(255, 50, 255); 42 | if(this.selected) { 43 | fill(255, 255, 0); 44 | } 45 | 46 | 47 | fill(150); 48 | rectMode(CENTER); 49 | rect(0, 0, this.width * zoom, this.height * zoom); 50 | 51 | pop(); 52 | 53 | 54 | 55 | } 56 | 57 | 58 | removeFromWorld() { 59 | World.remove(world, this.body); 60 | } 61 | 62 | reset() { 63 | this.removeFromWorld(); 64 | 65 | this.center = createVector((this.startingX1 + this.startingX2) / 2, (this.startingY1 + this.startingY2) / 2); 66 | 67 | this.rotation = atan((this.startingY2 - this.startingY1) / (this.startingX2 - this.startingX1)); 68 | if(this.mass == 1) { 69 | var options = { 70 | angle: this.rotation, 71 | friction: 0.01, 72 | restitution: 0.1 73 | } 74 | } else { 75 | var options = { 76 | angle: this.rotation, 77 | friction: 0.01, 78 | restitution: 0.1, 79 | mass: this.mass 80 | } 81 | } 82 | this.body = Bodies.rectangle(this.center.x, this.center.y, this.width, this.height, 83 | options); 84 | 85 | 86 | World.add(world, this.body); 87 | // this = new LooseRect(startingX1, startingY1, startingX2, startingY2, 10); 88 | // this.body = Bodies.rect(this.startingX, this.startingY, this.diameter / 89 | // 2.0, this.options); 90 | // World.add(this.world, this.body); 91 | 92 | 93 | } 94 | 95 | 96 | 97 | } 98 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/MarbleCalculator/marble.js: -------------------------------------------------------------------------------- 1 | class Marble { 2 | constructor(x, y, diam) { 3 | 4 | var options = { 5 | friction: 0, 6 | restitution: 0.2 7 | 8 | } 9 | this.x = x; 10 | this.y = y; 11 | this.diameter = diam; 12 | 13 | this.body = Bodies.circle(x, y, this.diameter / 2.0, options); 14 | this.zoomedPosition; 15 | World.add(world, this.body); 16 | this.selected = false; 17 | 18 | } 19 | 20 | 21 | show() { 22 | fill(204, 0, 0); 23 | if(this.selected) { 24 | fill(255, 255, 0); 25 | } 26 | noStroke(); 27 | this.zoomedPosition = createVector(this.body.position.x, this.body.position.y); 28 | this.zoomedPosition.mult(zoom); 29 | ellipse((this.zoomedPosition.x - cameraX), (this.zoomedPosition.y - cameraY), this.diameter * zoom); 30 | } 31 | 32 | removeFromWorld() { 33 | 34 | World.remove(world, this.body); 35 | } 36 | 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/MarbleCalculator/solid.js: -------------------------------------------------------------------------------- 1 | class Solid { 2 | constructor(x1, y1, x2, y2, thickness) { 3 | this.x1 = x1; 4 | this.x2 = x2; 5 | this.y1 = y1; 6 | this.y2 = y2; 7 | this.center = createVector((x1 + x2) / 2, (y1 + y2) / 2); 8 | this.width = dist(x1, y1, x2, y2); 9 | this.height = thickness; 10 | this.rotation = atan((y2 - y1) / (x2 - x1)); 11 | this.selected = false; 12 | this.zoomedPosition; 13 | var options = { 14 | isStatic: true, 15 | angle: this.rotation, 16 | friction: 0.01, 17 | restitution: 0.1 18 | } 19 | this.body = Bodies.rectangle(this.center.x, this.center.y, this.width, 20 | this.height, 21 | options); 22 | 23 | 24 | World.add(world, this.body); 25 | } 26 | 27 | show() { 28 | noStroke(); 29 | push(); 30 | this.zoomedPosition = createVector(this.body.position.x, this.body.position.y); 31 | this.zoomedPosition.mult(zoom); 32 | translate(this.zoomedPosition.x - cameraX, this.zoomedPosition.y - cameraY); 33 | rotate(this.body.angle); 34 | fill(40); 35 | if(this.selected) { 36 | fill(255, 255, 0); 37 | } 38 | rectMode(CENTER); 39 | rect(0, 0, this.width * zoom, this.height * zoom); 40 | pop(); 41 | 42 | 43 | } 44 | 45 | 46 | removeFromWorld() { 47 | 48 | World.remove(world, this.body); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/MarbleCalculator/startingMarbles.js: -------------------------------------------------------------------------------- 1 | class StartingMarble { 2 | constructor(x, y, diam) { 3 | 4 | this.options = { 5 | friction: 0, 6 | restitution: 0.2 7 | 8 | } 9 | this.startingX = x; 10 | this.startingY = y; 11 | this.diameter = diam; 12 | this.zoomedPosition; 13 | 14 | this.body = Bodies.circle(x, y, this.diameter / 2.0, this.options); 15 | World.add(world, this.body); 16 | this.selected = false; 17 | 18 | } 19 | 20 | 21 | show() { 22 | fill(204, 0, 0); 23 | if(this.selected) { 24 | fill(255, 255, 0); 25 | } 26 | noStroke(); 27 | 28 | 29 | this.zoomedPosition = createVector(this.body.position.x, this.body.position.y); 30 | this.zoomedPosition.mult(zoom); 31 | ellipse((this.zoomedPosition.x - cameraX), (this.zoomedPosition.y - cameraY), this.diameter * zoom); 32 | // ellipse(this.body.position.x - cameraX, this.body.position.y - cameraY, this.diameter); 33 | 34 | } 35 | 36 | removeFromWorld() { 37 | World.remove(world, this.body); 38 | } 39 | 40 | reset() { 41 | this.removeFromWorld(); 42 | this.body = Bodies.circle(this.startingX, this.startingY, this.diameter / 43 | 2.0, this.options); 44 | World.add(world, this.body); 45 | 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Brain.js: -------------------------------------------------------------------------------- 1 | class Brain { 2 | constructor(size) { 3 | this.directions = []; 4 | this.step = 0; 5 | this.randomize(size); 6 | 7 | } 8 | //-------------------------------------------------------------------------------------------------------------------------------- 9 | //sets all the vectors in directions to a random vector with length 1 10 | randomize(size) { 11 | for(var i = 0; i < size; i++) { 12 | this.directions[i] = this.getRandomDirection(); 13 | } 14 | } 15 | 16 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------- 17 | //returns a random PVector 18 | getRandomDirection(directionOfNode) { 19 | if(directionOfNode) { 20 | var randomNumber = floor(random(11)); 21 | 22 | } else { 23 | var randomNumber = floor(random(9)); 24 | 25 | } 26 | switch(randomNumber) { 27 | case 0: 28 | return createVector(0, 1); 29 | case 1: 30 | return createVector(1, 1); 31 | case 2: 32 | return createVector(1, 0); 33 | case 3: 34 | return createVector(1, -1); 35 | case 4: 36 | return createVector(0, -1); 37 | case 5: 38 | return createVector(-1, -1); 39 | case 6: 40 | return createVector(-1, 0); 41 | case 7: 42 | return createVector(-1, 1); 43 | case 8: 44 | return createVector(0, 0); 45 | case 9: 46 | return directionOfNode; 47 | case 10: 48 | return directionOfNode; 49 | } 50 | 51 | return createVector(); 52 | } 53 | 54 | //------------------------------------------------------------------------------------------------------------------------------------- 55 | //returns a perfect copy of this brain object 56 | clone() { 57 | var clone = new Brain(this.directions.length); 58 | for(var i = 0; i < this.directions.length; i++) { 59 | clone.directions[i] = this.directions[i].copy(); 60 | } 61 | return clone; 62 | } 63 | 64 | //---------------------------------------------------------------------------------------------------------------------------------------- 65 | 66 | //mutates the brain by setting some of the directions to random vectors 67 | mutate(died, deathStep, preferedDirection) { 68 | //chance that any vector in directions gets changed 69 | if(died) { 70 | for(var i = max(0, deathStep - increaseMovesBy); i < deathStep; i++) { 71 | var rand = random(map(i, max(0, deathStep - increaseMovesBy), deathStep, 0.1, 0.01)); 72 | // if(died && i > deathStep - increaseMovesBy * 2) { 73 | // rand = random(0.2); 74 | // } 75 | 76 | if(rand < mutationRate) { 77 | //set this direction as a random direction 78 | this.directions[i] = this.getRandomDirection(preferedDirection); 79 | } 80 | } 81 | } 82 | for(var i = max(0, this.directions.length - increaseMovesBy); i < this.directions.length; i++) { 83 | var rand = random(map(i, max(0, this.directions.length - increaseMovesBy), this.directions.length, 0.4, 0.15)); 84 | // if(died && i > deathStep - increaseMovesBy * 2) { 85 | // rand = random(0.2); 86 | // } 87 | 88 | if(rand < mutationRate) { 89 | //set this direction as a random direction 90 | this.directions[i] = this.getRandomDirection(preferedDirection); 91 | } 92 | } 93 | } 94 | 95 | //--------------------------------------------------------------------------------------------------------------------------------------------------------- 96 | //increases the number of elements in directions by 5 97 | increaseMoves() { 98 | for(var i = 0; i < increaseMovesBy; i++) { 99 | this.directions.push(this.getRandomDirection()); 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Coin.js: -------------------------------------------------------------------------------- 1 | class Coin { 2 | constructor(x, y) { 3 | this.taken = false; 4 | this.pos = createVector(x, y); 5 | this.diameter = tileSize / 2.0; 6 | 7 | 8 | } 9 | 10 | show() { 11 | if(!this.coinAlreadyShowed() && !this.taken) { 12 | stroke(0); 13 | fill(255, 255, 0); 14 | ellipse(this.pos.x, this.pos.y, this.diameter); 15 | coinShow.push(this.pos.copy()); 16 | } 17 | 18 | } 19 | 20 | coinAlreadyShowed() { 21 | for(var i = 0; i < coinShow.length; i++) { 22 | if(coinShow[i].x == this.pos.x && coinShow[i].y == this.pos.y) { 23 | return true; 24 | } 25 | } 26 | return false; 27 | 28 | } 29 | 30 | collides(ptl, pbr) { //player dimensions 31 | if(this.taken) { 32 | return false; 33 | } 34 | 35 | var topLeft = createVector(this.pos.x - this.diameter / 2, this.pos.y - this.diameter / 2); 36 | var bottomRight = createVector(this.pos.x + this.diameter / 2, this.pos.y + this.diameter / 2); 37 | if((ptl.x < bottomRight.x && pbr.x > topLeft.x) && (ptl.y < bottomRight.y && pbr.y > topLeft.y)) { 38 | 39 | this.taken = true; 40 | return; 41 | 42 | } 43 | return; 44 | } 45 | 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level1/Brain.js: -------------------------------------------------------------------------------- 1 | class Brain { 2 | constructor(size){ 3 | this.directions = []; 4 | this.step =0; 5 | this.randomize(size); 6 | 7 | } 8 | //-------------------------------------------------------------------------------------------------------------------------------- 9 | //sets all the vectors in directions to a random vector with length 1 10 | randomize(size) { 11 | for (var i = 0; i< size; i++) { 12 | this.directions[i] = this.getRandomDirection(); 13 | } 14 | } 15 | 16 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------- 17 | //returns a random PVector 18 | getRandomDirection() { 19 | var randomNumber = floor(random(9)); 20 | switch(randomNumber) { 21 | case 0: 22 | return createVector(0, 1); 23 | case 1: 24 | return createVector(1, 1); 25 | case 2: 26 | return createVector(1, 0); 27 | case 3: 28 | return createVector(1, -1); 29 | case 4: 30 | return createVector(0, -1); 31 | case 5: 32 | return createVector(-1, -1); 33 | case 6: 34 | return createVector(-1, 0); 35 | case 7: 36 | return createVector(-1, 1); 37 | case 8: 38 | return createVector(0, 0); 39 | } 40 | 41 | return createVector(); 42 | } 43 | 44 | //------------------------------------------------------------------------------------------------------------------------------------- 45 | //returns a perfect copy of this brain object 46 | clone() { 47 | var clone = new Brain(this.directions.length); 48 | for (var i = 0; i < this.directions.length; i++) { 49 | clone.directions[i] = this.directions[i].copy(); 50 | } 51 | return clone; 52 | } 53 | 54 | //---------------------------------------------------------------------------------------------------------------------------------------- 55 | 56 | //mutates the brain by setting some of the directions to random vectors 57 | mutate(died, deathStep) { 58 | //chance that any vector in directions gets changed 59 | for (var i =0; i< this.directions.length; i++) { 60 | var rand = random(1); 61 | if (died && i > deathStep - 10) { 62 | rand = random(0.2); 63 | } 64 | 65 | if (rand < mutationRate) { 66 | //set this direction as a random direction 67 | this.directions[i] = this.getRandomDirection(); 68 | } 69 | } 70 | } 71 | 72 | //--------------------------------------------------------------------------------------------------------------------------------------------------------- 73 | //increases the number of elements in directions by 5 74 | increaseMoves() { 75 | for(var i = 0 ; i< increaseMovesBy ;i++){ 76 | this.directions.push(this.getRandomDirection()); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level1/Dot.js: -------------------------------------------------------------------------------- 1 | class Dot { 2 | 3 | constructor( t1, t2, velX) { 4 | this.position = createVector(t1.pixelPos.x + tileSize/2, t1.pixelPos.y + tileSize/2); 5 | this.startingPos = createVector(t1.pixelPos.x + tileSize/2, t1.pixelPos.y + tileSize/2); 6 | this.speed = floor(tileSize/6.6); 7 | this.velocity = createVector(velX*this.speed, 0); 8 | this.startingVel = createVector(velX*this.speed, 0); 9 | this.bouncers = []; 10 | this.bouncers[0] = t1; 11 | this.bouncers[1] = t2; 12 | this.diameter = tileSize/2.0; 13 | this.bounceWait = -1; 14 | this.bounceTimer = 10; 15 | } 16 | 17 | //------------------------------------------------------------------------------------------------------------ 18 | //moves the dot 19 | move() { 20 | 21 | for (var i = 0; i < this.bouncers.length; i++) { 22 | if (this.bounceTimer < 0 && dist(this.position.x, this.position.y, this.bouncers[i].pixelPos.x + tileSize/2, this.bouncers[i].pixelPos.y + tileSize/2) < this.speed) {//if reached bouncer 23 | this.bounceTimer = 10; 24 | this.bounceWait= 1;//wait 1 frames then change direction 25 | } 26 | } 27 | if (this.bounceWait ==0) { 28 | //change direction 29 | this.velocity.x *= -1; 30 | } 31 | 32 | this.position.add(this.velocity);//move dot 33 | this.bounceTimer --; 34 | this.bounceWait --; 35 | } 36 | 37 | //------------------------------------------------------------------------------------------------------------ 38 | //draws the dot 39 | show() { 40 | fill(0, 0, 255); 41 | stroke(0); 42 | strokeWeight(4); 43 | ellipse(this.position.x, this.position.y, this.diameter, this.diameter); 44 | } 45 | 46 | 47 | //------------------------------------------------------------------------------------------------------------ 48 | //returns true of the Pvectors define a square which collides with this dot 49 | collides(ptl, pbr) {//player dimensions 50 | 51 | var topLeft = createVector(this.position.x - this.diameter/2, this.position.y-this.diameter/2); 52 | var bottomRight = createVector(this.position.x + this.diameter/2, this.position.y + this.diameter/2); 53 | var playerSize = bottomRight.x - topLeft.x; 54 | if ((ptl.x topLeft.x) &&( ptl.y < bottomRight.y && pbr.y > topLeft.y)) { 55 | 56 | if (dist(this.position.x, this.position.y, (ptl.x + pbr.x) /2.0, (ptl.y + pbr.y) /2.0)< this.diameter/2 + sqrt(playerSize*playerSize *2)/2) { 57 | return true; 58 | } 59 | } 60 | return false; 61 | } 62 | //------------------------------------------------------------------------------------------------------------ 63 | //returns the dot to its starting state 64 | 65 | resetDot() { 66 | this.position = this.startingPos.copy(); 67 | this.velocity = this.startingVel.copy(); 68 | this.bounceTimer = 10; 69 | this.bounceWait = -1; 70 | } 71 | //------------------------------------------------------------------------------------------------------------ 72 | //returns a copy of this dot object 73 | clone() { 74 | var clone = new Dot(this.bouncers[0], this.bouncers[1], floor(this.velocity.x)); 75 | clone.velocity = this.velocity.copy(); 76 | clone.position = this.position.copy(); 77 | clone.startingVel = this.startingVel.copy(); 78 | clone.bounceTimer = this.bounceTimer; 79 | clone.bounceWait = this.bounceWait; 80 | return clone; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level1/Node.js: -------------------------------------------------------------------------------- 1 | class Node { //used to define short term goals for the players 2 | //------------------------------------------------------------------------------------------------------------------------------ 3 | constructor(nodeTile) { 4 | this.reached = false; 5 | this.distToFinish = 0.0; 6 | this.pos = createVector(nodeTile.pixelPos.x, nodeTile.pixelPos.y); 7 | this.w = tileSize; 8 | this.h = tileSize; 9 | this.bottomRight = createVector(this.pos.x + this.w, this.pos.y + this.h); 10 | } 11 | //------------------------------------------------------------------------------------------------------------------------------ 12 | collision( ptl, pbr) {//player dimensions 13 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 14 | this.reached = true; 15 | return true; 16 | }else if(pbr.x < this.pos.x){ 17 | this.reached = false; 18 | 19 | } 20 | return false; 21 | } 22 | //------------------------------------------------------------------------------------------------------------------------------ 23 | //set the distance to finish by adding the distance to the finish for the node n plus the distance from this node to node n 24 | setDistanceToFinish(n) { 25 | this.distToFinish = n.distToFinish + dist(this.pos.x, this.pos.y, n.pos.x, n.pos.y); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level1/Solid.js: -------------------------------------------------------------------------------- 1 | class Solid { 2 | 3 | constructor(topL,botR){ 4 | var lineWidth = 1; 5 | this.pos = createVector(topL.pixelPos.x-lineWidth, topL.pixelPos.y-lineWidth); 6 | this.w = botR.pixelPos.x + tileSize - this.pos.x + lineWidth; 7 | this.h = botR.pixelPos.y + tileSize - this.pos.y + lineWidth; 8 | this.bottomRight = createVector(this.pos.x + this.w, this.pos.y + this.h); 9 | 10 | } 11 | 12 | 13 | restrictMovement(tl, br, movement) {//player dimensions 14 | //add the x first 15 | 16 | var x = movement.x; 17 | var y = movement.y; 18 | // 19 | // movement.x = round(movement.x); 20 | // movement.y = round(movement.y); 21 | var ptl = createVector(tl.x+movement.x, tl.y); 22 | var pbr = createVector(br.x+movement.x, br.y); 23 | 24 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 25 | 26 | x=0; 27 | } 28 | 29 | //check the y movement 30 | ptl = createVector(tl.x, tl.y +movement.y); 31 | pbr = createVector(br.x, br.y + movement.y); 32 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 33 | y=0; 34 | } 35 | 36 | return createVector(x, y); 37 | } 38 | 39 | collision(ptl, pbr) {//player dimensions 40 | //add the x first 41 | 42 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 43 | return true; 44 | } 45 | return false; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level1/Tile.js: -------------------------------------------------------------------------------- 1 | class Tile{ 2 | 3 | constructor(x,y){ 4 | this.matrixPos = createVector(x,y); 5 | this.pixelPos = createVector(x*tileSize+xoff, y*tileSize+yoff); 6 | this.safe = false; 7 | this.goal = false; 8 | this.wall = false; 9 | this.edges = []; 10 | 11 | } 12 | 13 | show(){ 14 | if ((this.matrixPos.x +this.matrixPos.y) % 2 ==0) { 15 | fill(247,247,255); 16 | } else { 17 | fill(230,230,255); 18 | } 19 | if (this.wall) { 20 | fill(180, 181, 254); 21 | } 22 | if (this.goal || this.safe) { 23 | fill(181, 254, 180); 24 | } 25 | noStroke(); 26 | rect(this.pixelPos.x,this.pixelPos.y,tileSize,tileSize); 27 | 28 | } 29 | 30 | showEdges(){ 31 | for (var i = 0; i< this.edges.length; i++) { 32 | stroke(0); 33 | strokeWeight(4); 34 | switch(this.edges[i]) { 35 | case 4: 36 | line(this.pixelPos.x, this.pixelPos.y, this.pixelPos.x+tileSize,this.pixelPos.y); 37 | break; 38 | case 1: 39 | line(this.pixelPos.x+tileSize, this.pixelPos.y, this.pixelPos.x+tileSize, this.pixelPos.y+tileSize); 40 | break; 41 | case 2: 42 | line(this.pixelPos.x, this.pixelPos.y+tileSize, this.pixelPos.x+tileSize, this.pixelPos.y+tileSize); 43 | break; 44 | case 3: 45 | line(this.pixelPos.x, this.pixelPos.y, this.pixelPos.x, this.pixelPos.y+tileSize); 46 | break; 47 | } 48 | } 49 | } 50 | 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level1/assets/DAB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level1/assets/DAB.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level2/Brain.js: -------------------------------------------------------------------------------- 1 | class Brain { 2 | constructor(size){ 3 | this.directions = []; 4 | this.step =0; 5 | this.randomize(size); 6 | 7 | } 8 | //-------------------------------------------------------------------------------------------------------------------------------- 9 | //sets all the vectors in directions to a random vector with length 1 10 | randomize(size) { 11 | for (var i = 0; i< size; i++) { 12 | this.directions[i] = this.getRandomDirection(); 13 | } 14 | } 15 | 16 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------- 17 | //returns a random PVector 18 | getRandomDirection() { 19 | var randomNumber = floor(random(9)); 20 | switch(randomNumber) { 21 | case 0: 22 | return createVector(0, 1); 23 | case 1: 24 | return createVector(1, 1); 25 | case 2: 26 | return createVector(1, 0); 27 | case 3: 28 | return createVector(1, -1); 29 | case 4: 30 | return createVector(0, -1); 31 | case 5: 32 | return createVector(-1, -1); 33 | case 6: 34 | return createVector(-1, 0); 35 | case 7: 36 | return createVector(-1, 1); 37 | case 8: 38 | return createVector(0, 0); 39 | } 40 | 41 | return createVector(); 42 | } 43 | 44 | //------------------------------------------------------------------------------------------------------------------------------------- 45 | //returns a perfect copy of this brain object 46 | clone() { 47 | var clone = new Brain(this.directions.length); 48 | for (var i = 0; i < this.directions.length; i++) { 49 | clone.directions[i] = this.directions[i].copy(); 50 | } 51 | return clone; 52 | } 53 | 54 | //---------------------------------------------------------------------------------------------------------------------------------------- 55 | 56 | //mutates the brain by setting some of the directions to random vectors 57 | mutate(died, deathStep) { 58 | //chance that any vector in directions gets changed 59 | for (var i =0; i< this.directions.length; i++) { 60 | var rand = random(1); 61 | if (died && i > deathStep - 10) { 62 | rand = random(0.2); 63 | } 64 | 65 | if (rand < mutationRate) { 66 | //set this direction as a random direction 67 | this.directions[i] = this.getRandomDirection(); 68 | } 69 | } 70 | } 71 | 72 | //--------------------------------------------------------------------------------------------------------------------------------------------------------- 73 | //increases the number of elements in directions by 5 74 | increaseMoves() { 75 | for(var i = 0 ; i< increaseMovesBy ;i++){ 76 | this.directions.push(this.getRandomDirection()); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level2/Coin.js: -------------------------------------------------------------------------------- 1 | class Coin{ 2 | constructor(x,y){ 3 | this.taken = false; 4 | this.pos = createVector(x,y); 5 | this.diameter = tileSize/2.0; 6 | } 7 | 8 | show(){ 9 | if(!showedCoin && !this.taken){ 10 | stroke(0); 11 | fill(255,255,0); 12 | ellipse(this.pos.x,this.pos.y,this.diameter); 13 | showedCoin = true; 14 | } 15 | 16 | } 17 | 18 | collides(ptl, pbr) {//player dimensions 19 | if(this.taken){ return false;} 20 | 21 | var topLeft = createVector(this.pos.x - this.diameter/2, this.pos.y-this.diameter/2); 22 | var bottomRight = createVector(this.pos.x + this.diameter/2, this.pos.y + this.diameter/2); 23 | if ((ptl.x topLeft.x) &&( ptl.y < bottomRight.y && pbr.y > topLeft.y)) { 24 | 25 | this.taken = true; 26 | return; 27 | 28 | } 29 | return; 30 | } 31 | 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level2/Dot.js: -------------------------------------------------------------------------------- 1 | class Dot { 2 | 3 | constructor( t1, t2, velX,velY) { 4 | this.position = createVector(t1.pixelPos.x + tileSize/2, t1.pixelPos.y + tileSize/2); 5 | this.startingPos = createVector(t1.pixelPos.x + tileSize/2, t1.pixelPos.y + tileSize/2); 6 | this.speed = floor(tileSize/6.6); 7 | this.velocity = createVector(velX*this.speed, velY*this.speed); 8 | this.startingVel = createVector(velX*this.speed, velY*this.speed); 9 | this.bouncers = []; 10 | this.bouncers[0] = t1; 11 | this.bouncers[1] = t2; 12 | this.diameter = tileSize/2.0; 13 | this.bounceWait = -1; 14 | this.bounceTimer = 10; 15 | } 16 | 17 | //------------------------------------------------------------------------------------------------------------ 18 | //moves the dot 19 | move() { 20 | 21 | for (var i = 0; i < this.bouncers.length; i++) { 22 | if (this.bounceTimer < 0 && dist(this.position.x, this.position.y, this.bouncers[i].pixelPos.x + tileSize/2, this.bouncers[i].pixelPos.y + tileSize/2) < this.speed) {//if reached bouncer 23 | this.bounceTimer = 10; 24 | this.bounceWait= 1;//wait 1 frames then change direction 25 | } 26 | } 27 | if (this.bounceWait ==0) { 28 | //change direction 29 | this.velocity.y *= -1; 30 | this.velocity.x *= -1; 31 | 32 | } 33 | 34 | this.position.add(this.velocity);//move dot 35 | this.bounceTimer --; 36 | this.bounceWait --; 37 | } 38 | 39 | //------------------------------------------------------------------------------------------------------------ 40 | //draws the dot 41 | show() { 42 | fill(0, 0, 255); 43 | stroke(0); 44 | strokeWeight(4); 45 | ellipse(this.position.x, this.position.y, this.diameter, this.diameter); 46 | } 47 | 48 | 49 | //------------------------------------------------------------------------------------------------------------ 50 | //returns true of the Pvectors define a square which collides with this dot 51 | collides(ptl, pbr) {//player dimensions 52 | 53 | var topLeft = createVector(this.position.x - this.diameter/2, this.position.y-this.diameter/2); 54 | var bottomRight = createVector(this.position.x + this.diameter/2, this.position.y + this.diameter/2); 55 | var playerSize = bottomRight.x - topLeft.x; 56 | if ((ptl.x topLeft.x) &&( ptl.y < bottomRight.y && pbr.y > topLeft.y)) { 57 | 58 | if (dist(this.position.x, this.position.y, (ptl.x + pbr.x) /2.0, (ptl.y + pbr.y) /2.0)< this.diameter/2 + sqrt(playerSize*playerSize *2)/2) { 59 | return true; 60 | } 61 | } 62 | return false; 63 | } 64 | //------------------------------------------------------------------------------------------------------------ 65 | //returns the dot to its starting state 66 | 67 | resetDot() { 68 | this.position = this.startingPos.copy(); 69 | this.velocity = this.startingVel.copy(); 70 | this.bounceTimer = 10; 71 | this.bounceWait = -1; 72 | } 73 | //------------------------------------------------------------------------------------------------------------ 74 | //returns a copy of this dot object 75 | clone() { 76 | var clone = new Dot(this.bouncers[0], this.bouncers[1], floor(this.velocity.x), floor(this.velocity.y)); 77 | clone.velocity = this.velocity.copy(); 78 | clone.position = this.position.copy(); 79 | clone.startingVel = this.startingVel.copy(); 80 | clone.bounceTimer = this.bounceTimer; 81 | clone.bounceWait = this.bounceWait; 82 | return clone; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level2/Node.js: -------------------------------------------------------------------------------- 1 | class Node { //used to define short term goals for the players 2 | //------------------------------------------------------------------------------------------------------------------------------ 3 | constructor(nodeTileOrCoin, isTile, isCoin) { 4 | this.reached = false; 5 | this.distToFinish = 0.0; 6 | this.isCoin = isCoin; 7 | 8 | if(isTile){ 9 | this.pos = createVector(nodeTileOrCoin.pixelPos.x, nodeTileOrCoin.pixelPos.y); 10 | this.w = tileSize; 11 | this.h = tileSize; 12 | }else if(isCoin){ 13 | this.pos = createVector(nodeTileOrCoin.pos.x- nodeTileOrCoin.diameter/2.0, nodeTileOrCoin.pos.y- nodeTileOrCoin.diameter/2.0); 14 | this.w = nodeTileOrCoin.diameter; 15 | this.h = nodeTileOrCoin.diameter; 16 | } 17 | this.bottomRight = createVector(this.pos.x + this.w, this.pos.y + this.h); 18 | 19 | } 20 | 21 | //------------------------------------------------------------------------------------------------------------------------------ 22 | collision( ptl, pbr) {//player dimensions 23 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 24 | this.reached = true; 25 | return true; 26 | }else if(!this.isCoin && pbr.x < this.pos.x){ 27 | this.reached = false; 28 | 29 | } 30 | return false; 31 | } 32 | //------------------------------------------------------------------------------------------------------------------------------ 33 | //set the distance to finish by adding the distance to the finish for the node n plus the distance from this node to node n 34 | setDistanceToFinish(n) { 35 | this.distToFinish = n.distToFinish + dist(this.pos.x, this.pos.y, n.pos.x, n.pos.y); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level2/Solid.js: -------------------------------------------------------------------------------- 1 | class Solid { 2 | 3 | constructor(topL,botR){ 4 | var lineWidth = 1; 5 | this.pos = createVector(topL.pixelPos.x-lineWidth, topL.pixelPos.y-lineWidth); 6 | this.w = botR.pixelPos.x + tileSize - this.pos.x + lineWidth; 7 | this.h = botR.pixelPos.y + tileSize - this.pos.y + lineWidth; 8 | this.bottomRight = createVector(this.pos.x + this.w, this.pos.y + this.h); 9 | 10 | } 11 | 12 | 13 | restrictMovement(tl, br, movement) {//player dimensions 14 | //add the x first 15 | 16 | var x = movement.x; 17 | var y = movement.y; 18 | // 19 | // movement.x = round(movement.x); 20 | // movement.y = round(movement.y); 21 | var ptl = createVector(tl.x+movement.x, tl.y); 22 | var pbr = createVector(br.x+movement.x, br.y); 23 | 24 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 25 | 26 | x=0; 27 | } 28 | 29 | //check the y movement 30 | ptl = createVector(tl.x, tl.y +movement.y); 31 | pbr = createVector(br.x, br.y + movement.y); 32 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 33 | y=0; 34 | } 35 | 36 | return createVector(x, y); 37 | } 38 | 39 | collision(ptl, pbr) {//player dimensions 40 | //add the x first 41 | 42 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 43 | return true; 44 | } 45 | return false; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level2/Tile.js: -------------------------------------------------------------------------------- 1 | class Tile{ 2 | 3 | constructor(x,y){ 4 | this.matrixPos = createVector(x,y); 5 | this.pixelPos = createVector(x*tileSize+xoff, y*tileSize+yoff); 6 | this.safe = false; 7 | this.goal = false; 8 | this.wall = false; 9 | this.edges = []; 10 | 11 | } 12 | 13 | show(){ 14 | if ((this.matrixPos.x +this.matrixPos.y) % 2 ==0) { 15 | fill(247,247,255); 16 | } else { 17 | fill(230,230,255); 18 | } 19 | if (this.wall) { 20 | fill(180, 181, 254); 21 | } 22 | if (this.goal || this.safe) { 23 | fill(181, 254, 180); 24 | } 25 | noStroke(); 26 | rect(this.pixelPos.x,this.pixelPos.y,tileSize,tileSize); 27 | 28 | } 29 | 30 | showEdges(){ 31 | for (var i = 0; i< this.edges.length; i++) { 32 | stroke(0); 33 | strokeWeight(4); 34 | switch(this.edges[i]) { 35 | case 4: 36 | line(this.pixelPos.x, this.pixelPos.y, this.pixelPos.x+tileSize,this.pixelPos.y); 37 | break; 38 | case 1: 39 | line(this.pixelPos.x+tileSize, this.pixelPos.y, this.pixelPos.x+tileSize, this.pixelPos.y+tileSize); 40 | break; 41 | case 2: 42 | line(this.pixelPos.x, this.pixelPos.y+tileSize, this.pixelPos.x+tileSize, this.pixelPos.y+tileSize); 43 | break; 44 | case 3: 45 | line(this.pixelPos.x, this.pixelPos.y, this.pixelPos.x, this.pixelPos.y+tileSize); 46 | break; 47 | } 48 | } 49 | } 50 | 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level2/assets/DAB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level2/assets/DAB.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level3/Brain.js: -------------------------------------------------------------------------------- 1 | class Brain { 2 | constructor(size){ 3 | this.directions = []; 4 | this.step =0; 5 | this.randomize(size); 6 | 7 | } 8 | //-------------------------------------------------------------------------------------------------------------------------------- 9 | //sets all the vectors in directions to a random vector with length 1 10 | randomize(size) { 11 | for (var i = 0; i< size; i++) { 12 | this.directions[i] = this.getRandomDirection(); 13 | } 14 | } 15 | 16 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------- 17 | //returns a random PVector 18 | getRandomDirection() { 19 | var randomNumber = floor(random(9)); 20 | switch(randomNumber) { 21 | case 0: 22 | return createVector(0, 1); 23 | case 1: 24 | return createVector(1, 1); 25 | case 2: 26 | return createVector(1, 0); 27 | case 3: 28 | return createVector(1, -1); 29 | case 4: 30 | return createVector(0, -1); 31 | case 5: 32 | return createVector(-1, -1); 33 | case 6: 34 | return createVector(-1, 0); 35 | case 7: 36 | return createVector(-1, 1); 37 | case 8: 38 | return createVector(0, 0); 39 | } 40 | 41 | return createVector(); 42 | } 43 | 44 | //------------------------------------------------------------------------------------------------------------------------------------- 45 | //returns a perfect copy of this brain object 46 | clone() { 47 | var clone = new Brain(this.directions.length); 48 | for (var i = 0; i < this.directions.length; i++) { 49 | clone.directions[i] = this.directions[i].copy(); 50 | } 51 | return clone; 52 | } 53 | 54 | //---------------------------------------------------------------------------------------------------------------------------------------- 55 | 56 | //mutates the brain by setting some of the directions to random vectors 57 | mutate(died, deathStep) { 58 | //chance that any vector in directions gets changed 59 | for (var i =0; i< this.directions.length; i++) { 60 | var rand = random(1); 61 | if (died && i > deathStep - 10) { 62 | rand = random(0.2); 63 | } 64 | 65 | if (rand < mutationRate) { 66 | //set this direction as a random direction 67 | this.directions[i] = this.getRandomDirection(); 68 | } 69 | } 70 | } 71 | 72 | //--------------------------------------------------------------------------------------------------------------------------------------------------------- 73 | //increases the number of elements in directions by 5 74 | increaseMoves() { 75 | for(var i = 0 ; i< increaseMovesBy ;i++){ 76 | this.directions.push(this.getRandomDirection()); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level3/Coin.js: -------------------------------------------------------------------------------- 1 | class Coin{ 2 | constructor(x,y){ 3 | this.taken = false; 4 | this.pos = createVector(x,y); 5 | this.diameter = tileSize/2.0; 6 | } 7 | 8 | show(){ 9 | if(!showedCoin && !this.taken){ 10 | stroke(0); 11 | fill(255,255,0); 12 | ellipse(this.pos.x,this.pos.y,this.diameter); 13 | showedCoin = true; 14 | } 15 | 16 | } 17 | 18 | collides(ptl, pbr) {//player dimensions 19 | if(this.taken){ return false;} 20 | 21 | var topLeft = createVector(this.pos.x - this.diameter/2, this.pos.y-this.diameter/2); 22 | var bottomRight = createVector(this.pos.x + this.diameter/2, this.pos.y + this.diameter/2); 23 | if ((ptl.x topLeft.x) &&( ptl.y < bottomRight.y && pbr.y > topLeft.y)) { 24 | 25 | this.taken = true; 26 | return; 27 | 28 | } 29 | return; 30 | } 31 | 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level3/Node.js: -------------------------------------------------------------------------------- 1 | class Node { //used to define short term goals for the players 2 | //------------------------------------------------------------------------------------------------------------------------------ 3 | constructor(nodeTileOrCoin, isTile, isCoin) { 4 | this.reached = false; 5 | this.distToFinish = 0.0; 6 | this.isCoin = isCoin; 7 | 8 | if(isTile){ 9 | this.pos = createVector(nodeTileOrCoin.pixelPos.x, nodeTileOrCoin.pixelPos.y); 10 | this.w = tileSize; 11 | this.h = tileSize; 12 | }else if(isCoin){ 13 | this.pos = createVector(nodeTileOrCoin.pos.x- nodeTileOrCoin.diameter/2.0, nodeTileOrCoin.pos.y- nodeTileOrCoin.diameter/2.0); 14 | this.w = nodeTileOrCoin.diameter; 15 | this.h = nodeTileOrCoin.diameter; 16 | } 17 | this.bottomRight = createVector(this.pos.x + this.w, this.pos.y + this.h); 18 | 19 | } 20 | 21 | //------------------------------------------------------------------------------------------------------------------------------ 22 | collision( ptl, pbr) {//player dimensions 23 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 24 | this.reached = true; 25 | return true; 26 | }else if(!this.isCoin && pbr.x < this.pos.x){ 27 | this.reached = false; 28 | 29 | } 30 | return false; 31 | } 32 | //------------------------------------------------------------------------------------------------------------------------------ 33 | //set the distance to finish by adding the distance to the finish for the node n plus the distance from this node to node n 34 | setDistanceToFinish(n) { 35 | this.distToFinish = n.distToFinish + dist(this.pos.x, this.pos.y, n.pos.x, n.pos.y); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level3/Solid.js: -------------------------------------------------------------------------------- 1 | class Solid { 2 | 3 | constructor(topL,botR){ 4 | var lineWidth = 1; 5 | this.pos = createVector(topL.pixelPos.x-lineWidth, topL.pixelPos.y-lineWidth); 6 | this.w = botR.pixelPos.x + tileSize - this.pos.x + lineWidth; 7 | this.h = botR.pixelPos.y + tileSize - this.pos.y + lineWidth; 8 | this.bottomRight = createVector(this.pos.x + this.w, this.pos.y + this.h); 9 | 10 | } 11 | 12 | 13 | restrictMovement(tl, br, movement) {//player dimensions 14 | //add the x first 15 | 16 | var x = movement.x; 17 | var y = movement.y; 18 | // 19 | // movement.x = round(movement.x); 20 | // movement.y = round(movement.y); 21 | var ptl = createVector(tl.x+movement.x, tl.y); 22 | var pbr = createVector(br.x+movement.x, br.y); 23 | 24 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 25 | 26 | x=0; 27 | } 28 | 29 | //check the y movement 30 | ptl = createVector(tl.x, tl.y +movement.y); 31 | pbr = createVector(br.x, br.y + movement.y); 32 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 33 | y=0; 34 | } 35 | 36 | return createVector(x, y); 37 | } 38 | 39 | collision(ptl, pbr) {//player dimensions 40 | //add the x first 41 | 42 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 43 | return true; 44 | } 45 | return false; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level3/Tile.js: -------------------------------------------------------------------------------- 1 | class Tile{ 2 | 3 | constructor(x,y){ 4 | this.matrixPos = createVector(x,y); 5 | this.pixelPos = createVector(x*tileSize+xoff, y*tileSize+yoff); 6 | this.safe = false; 7 | this.goal = false; 8 | this.wall = false; 9 | this.edges = []; 10 | 11 | } 12 | 13 | show(){ 14 | if ((this.matrixPos.x +this.matrixPos.y) % 2 ==0) { 15 | fill(247,247,255); 16 | } else { 17 | fill(230,230,255); 18 | } 19 | if (this.wall) { 20 | fill(180, 181, 254); 21 | } 22 | if (this.goal || this.safe) { 23 | fill(181, 254, 180); 24 | } 25 | noStroke(); 26 | rect(this.pixelPos.x,this.pixelPos.y,tileSize,tileSize); 27 | 28 | } 29 | 30 | showEdges(){ 31 | for (var i = 0; i< this.edges.length; i++) { 32 | stroke(0); 33 | strokeWeight(4); 34 | switch(this.edges[i]) { 35 | case 4: 36 | line(this.pixelPos.x, this.pixelPos.y, this.pixelPos.x+tileSize,this.pixelPos.y); 37 | break; 38 | case 1: 39 | line(this.pixelPos.x+tileSize, this.pixelPos.y, this.pixelPos.x+tileSize, this.pixelPos.y+tileSize); 40 | break; 41 | case 2: 42 | line(this.pixelPos.x, this.pixelPos.y+tileSize, this.pixelPos.x+tileSize, this.pixelPos.y+tileSize); 43 | break; 44 | case 3: 45 | line(this.pixelPos.x, this.pixelPos.y, this.pixelPos.x, this.pixelPos.y+tileSize); 46 | break; 47 | } 48 | } 49 | } 50 | 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level3/assets/DAB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Level3/assets/DAB.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Node.js: -------------------------------------------------------------------------------- 1 | class Node { //used to define short term goals for the players 2 | //------------------------------------------------------------------------------------------------------------------------------ 3 | constructor(nodeTileOrCoin, isTile, isCoin) { 4 | this.reached = false; 5 | this.distToFinish = 0.0; 6 | this.isCoin = isCoin; 7 | 8 | if(isTile) { 9 | this.pos = createVector(nodeTileOrCoin.pixelPos.x, nodeTileOrCoin.pixelPos.y); 10 | 11 | this.w = tileSize; 12 | this.h = tileSize; 13 | } else if(isCoin) { 14 | this.pos = createVector(nodeTileOrCoin.pos.x - nodeTileOrCoin.diameter / 2.0, nodeTileOrCoin.pos.y - nodeTileOrCoin.diameter / 2.0); 15 | this.w = nodeTileOrCoin.diameter; 16 | this.h = nodeTileOrCoin.diameter; 17 | 18 | } else { //noteTileorcorin is a vector 19 | this.pos = createVector(nodeTileOrCoin.x - tileSize / 2, nodeTileOrCoin.y - tileSize / 2); 20 | this.w = tileSize; 21 | this.h = tileSize; 22 | } 23 | this.center = createVector(this.pos.x + this.w / 2, this.pos.y + this.h / 2); 24 | 25 | this.bottomRight = createVector(this.pos.x + this.w, this.pos.y + this.h); 26 | } 27 | 28 | show() { 29 | fill(240, 0, 0, 100); 30 | noStroke(); 31 | ellipse(this.center.x, this.center.y, 20); 32 | 33 | } 34 | 35 | //------------------------------------------------------------------------------------------------------------------------------ 36 | collision(ptl, pbr) { //player dimensions 37 | if((ptl.x < this.bottomRight.x && pbr.x > this.pos.x) && (ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 38 | this.reached = true; 39 | return true; 40 | } 41 | return false; 42 | } 43 | //------------------------------------------------------------------------------------------------------------------------------ 44 | //set the distance to finish by adding the distance to the finish for the node n plus the distance from this node to node n 45 | setDistanceToFinish(n) { 46 | this.distToFinish = n.distToFinish + dist(this.pos.x, this.pos.y, n.pos.x, n.pos.y); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Solid.js: -------------------------------------------------------------------------------- 1 | class Solid { 2 | 3 | constructor(topL,botR){ 4 | var lineWidth = 1; 5 | this.pos = createVector(topL.pixelPos.x-lineWidth, topL.pixelPos.y-lineWidth); 6 | this.w = botR.pixelPos.x + tileSize - this.pos.x + lineWidth; 7 | this.h = botR.pixelPos.y + tileSize - this.pos.y + lineWidth; 8 | this.bottomRight = createVector(this.pos.x + this.w, this.pos.y + this.h); 9 | 10 | } 11 | 12 | 13 | restrictMovement(tl, br, movement) {//player dimensions 14 | //add the x first 15 | 16 | var x = movement.x; 17 | var y = movement.y; 18 | // 19 | // movement.x = round(movement.x); 20 | // movement.y = round(movement.y); 21 | var ptl = createVector(tl.x+movement.x, tl.y); 22 | var pbr = createVector(br.x+movement.x, br.y); 23 | 24 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 25 | 26 | x=0; 27 | } 28 | 29 | //check the y movement 30 | ptl = createVector(tl.x, tl.y +movement.y); 31 | pbr = createVector(br.x, br.y + movement.y); 32 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 33 | y=0; 34 | } 35 | 36 | return createVector(x, y); 37 | } 38 | 39 | collision(ptl, pbr) {//player dimensions 40 | //add the x first 41 | 42 | if ((ptl.x this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) { 43 | return true; 44 | } 45 | return false; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/Tile.js: -------------------------------------------------------------------------------- 1 | class Tile{ 2 | 3 | constructor(x,y){ 4 | this.matrixPos = createVector(x,y); 5 | this.pixelPos = createVector(x*tileSize+xoff, y*tileSize+yoff); 6 | this.safe = false; 7 | this.goal = false; 8 | this.wall = false; 9 | this.edges = []; 10 | 11 | } 12 | 13 | show(){ 14 | if ((this.matrixPos.x +this.matrixPos.y) % 2 ==0) { 15 | fill(247,247,255); 16 | } else { 17 | fill(230,230,255); 18 | } 19 | if (this.wall) { 20 | fill(180, 181, 254); 21 | } 22 | if (this.goal || this.safe) { 23 | fill(181, 254, 180); 24 | } 25 | noStroke(); 26 | rect(this.pixelPos.x,this.pixelPos.y,tileSize,tileSize); 27 | 28 | } 29 | 30 | showEdges(){ 31 | for (var i = 0; i< this.edges.length; i++) { 32 | stroke(0); 33 | strokeWeight(4); 34 | switch(this.edges[i]) { 35 | case 4: 36 | line(this.pixelPos.x, this.pixelPos.y, this.pixelPos.x+tileSize,this.pixelPos.y); 37 | break; 38 | case 1: 39 | line(this.pixelPos.x+tileSize, this.pixelPos.y, this.pixelPos.x+tileSize, this.pixelPos.y+tileSize); 40 | break; 41 | case 2: 42 | line(this.pixelPos.x, this.pixelPos.y+tileSize, this.pixelPos.x+tileSize, this.pixelPos.y+tileSize); 43 | break; 44 | case 3: 45 | line(this.pixelPos.x, this.pixelPos.y, this.pixelPos.x, this.pixelPos.y+tileSize); 46 | break; 47 | } 48 | } 49 | } 50 | 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/assets/DAB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/assets/DAB.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/WHG/localStyle.css: -------------------------------------------------------------------------------- 1 | #main{ 2 | width : 1306px; 3 | padding: 2%; 4 | /* margin: 2%; */ 5 | margin-left: 0%; 6 | /* left: 10%; */ 7 | /* transform: translateX(25%); */ 8 | } 9 | #main h2{ 10 | text-align: center; 11 | background-color: black; 12 | color: rgb(20,200,20); 13 | padding: 2%; 14 | font-size: 200%; 15 | 16 | } 17 | 18 | #canvas{ 19 | padding: 10px; 20 | border-color: black; 21 | border: 1%; 22 | background-color: black; 23 | border-style: solid; 24 | 25 | 26 | } 27 | #main hr{ 28 | padding:0.1%; 29 | background-color: black; 30 | /* rgb(20,200,20); */ 31 | border-color: rgb(20,200,20); 32 | /* border-style: solid; */ 33 | } 34 | #buttons { 35 | width: 50%; 36 | margin-left: 22%; 37 | font-size: 120%; 38 | font-weight: bolder; 39 | background-color: white; 40 | padding:3%; 41 | /* padding-top: 5%; */ 42 | border-color: black; 43 | /* rgb(20,200,20); */ 44 | border-style: solid; 45 | text-align: center; 46 | 47 | } 48 | 49 | /* #buttons div{ 50 | float: left; 51 | 52 | } */ 53 | #instructions{ 54 | text-align: center; 55 | } 56 | button{ 57 | 58 | background-color: rgb(20,180,20); 59 | color: black; 60 | /* rgb(20,200,20); */ 61 | border-color: black; 62 | /* rgb(20,200,20); */ 63 | margin:0.2%; 64 | /* font-size: 120%; */ 65 | width: 5%; 66 | } 67 | button:hover{ 68 | background-color: rgb(20,220,20); 69 | color: black; 70 | /* rgb(20,200,20); */ 71 | border-color: black; 72 | /* rgb(20,200,20); */ 73 | margin:0.2%; 74 | /* font-size: 105%; */ 75 | width: 5%; 76 | /* float: right; */ 77 | } 78 | #resetButton button{ 79 | width: 20%; 80 | } 81 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/levelImages/level1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/WorldsHardestGame/levelImages/level1.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/levelImages/level2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/WorldsHardestGame/levelImages/level2.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/levelImages/level3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/WorldsHardestGame/levelImages/level3.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/levelImages/level4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/WorldsHardestGame/levelImages/level4.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/levelImages/level5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/WorldsHardestGame/levelImages/level5.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/WorldsHardestGame/levelImages/level6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/WorldsHardestGame/levelImages/level6.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_01.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_02.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_03.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_04.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_05.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_06.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_07.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_08.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_09.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_10.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_11.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/chess/assets/2000px-Chess_Pieces_Sprite_12.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/chess/sketch.js: -------------------------------------------------------------------------------- 1 | var test; 2 | var moving = false; 3 | 4 | var tileSize = 100; 5 | var movingPiece; 6 | var whitesMove = true; 7 | var moveCounter = 10; 8 | var images = []; 9 | var whiteAI = false; 10 | var blackAI = true; 11 | 12 | var depthPara; 13 | var depthPlus; 14 | var depthMinus; 15 | var tempMaxDepth = 3; 16 | 17 | function setup() { 18 | window.canvas = createCanvas(800, 800); 19 | canvas.parent("canvas"); 20 | htmlStuff(); 21 | 22 | for (var i = 1; i < 10; i++) { 23 | images.push(loadImage("assets/2000px-Chess_Pieces_Sprite_0" + i + ".png")); 24 | } 25 | for (var i = 10; i < 13; i++) { 26 | images.push(loadImage("assets/2000px-Chess_Pieces_Sprite_" + i + ".png")); 27 | } 28 | test = new Board(); 29 | } 30 | 31 | function draw() { 32 | 33 | background(100); 34 | showGrid(); 35 | test.show(); 36 | 37 | runAIs(); 38 | 39 | } 40 | 41 | function runAIs() { 42 | maxDepth = tempMaxDepth; 43 | if (!test.isDead() && !test.hasWon()) { 44 | if (blackAI) { 45 | if (!whitesMove) { 46 | if (moveCounter < 0) { 47 | test = maxFunAB(test, -400, 400, 0); 48 | // test = maxFun(test, 0); 49 | print(test); 50 | whitesMove = true; 51 | moveCounter = 10; 52 | } else { 53 | moveCounter--; 54 | } 55 | } 56 | } 57 | if (whiteAI) { 58 | if (whitesMove) { 59 | if (moveCounter < 0) { 60 | test = minFunAB(test, -400, 400, 0); 61 | // test = minFun(test, 0); 62 | 63 | print("test", test); 64 | 65 | whitesMove = false; 66 | moveCounter = 10; 67 | } else { 68 | moveCounter--; 69 | } 70 | } 71 | } 72 | } 73 | } 74 | 75 | function showGrid() { 76 | for (var i = 0; i < 8; i++) { 77 | for (var j = 0; j < 8; j++) { 78 | if ((i + j) % 2 == 1) { 79 | fill(0); 80 | } else { 81 | fill(240); 82 | } 83 | noStroke(); 84 | rect(i * tileSize, j * tileSize, tileSize, tileSize); 85 | 86 | } 87 | } 88 | 89 | 90 | } 91 | 92 | function keyPressed() { 93 | 94 | } 95 | 96 | function mousePressed() { 97 | var x = floor(mouseX / tileSize); 98 | var y = floor(mouseY / tileSize); 99 | if (!test.isDone()) { 100 | if (!moving) { 101 | movingPiece = test.getPieceAt(x, y); 102 | if (movingPiece != null && movingPiece.white == whitesMove) { 103 | 104 | movingPiece.movingThisPiece = true; 105 | } else { 106 | return; 107 | } 108 | } else { 109 | if (movingPiece.canMove(x, y, test)) { 110 | movingPiece.move(x, y, test); 111 | movingPiece.movingThisPiece = false; 112 | whitesMove = !whitesMove; 113 | } else { 114 | movingPiece.movingThisPiece = false; 115 | 116 | } 117 | } 118 | moving = !moving; 119 | } 120 | } 121 | //--------------------------------------------------------------------------------------------------------------------- 122 | function htmlStuff() { 123 | 124 | depthPara = createP("Thinking " + maxDepth + " moves ahead"); 125 | depthMinus = createButton("-"); 126 | depthPlus = createButton('+'); 127 | depthPara.parent("htmlStuff"); 128 | depthMinus.parent("htmlStuff"); 129 | depthPlus.parent("htmlStuff"); 130 | 131 | depthPlus.mousePressed(plusDepth); 132 | depthMinus.mousePressed(minusDepth); 133 | depthMinus.class("button"); 134 | depthPlus.class("button"); 135 | } 136 | 137 | function minusDepth() { 138 | if (tempMaxDepth > 1) { 139 | tempMaxDepth -= 1; 140 | depthPara.html("Thinking " + tempMaxDepth + " moves ahead"); 141 | } 142 | } 143 | 144 | function plusDepth() { 145 | if (tempMaxDepth < 5) { 146 | tempMaxDepth += 1; 147 | depthPara.html("Thinking " + tempMaxDepth + " moves ahead"); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/ConnectionGene.js: -------------------------------------------------------------------------------- 1 | //a connection between 2 nodes 2 | class connectionGene { 3 | constructor(from, to, w, inno) { 4 | this.fromNode = from; 5 | this.toNode = to; 6 | this.weight = w; 7 | this.enabled = true; 8 | this.innovationNo = inno; //each connection is given a innovation number to compare genomes 9 | 10 | } 11 | 12 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 13 | //changes the this.weight 14 | mutateWeight() { 15 | var rand2 = random(1); 16 | if (rand2 < 0.1) { //10% of the time completely change the this.weight 17 | this.weight = random(-1, 1); 18 | } else { //otherwise slightly change it 19 | this.weight += (randomGaussian() / 50); 20 | //keep this.weight between bounds 21 | if (this.weight > 1) { 22 | this.weight = 1; 23 | } 24 | if (this.weight < -1) { 25 | this.weight = -1; 26 | 27 | } 28 | } 29 | } 30 | 31 | //---------------------------------------------------------------------------------------------------------- 32 | //returns a copy of this connectionGene 33 | clone(from, to) { 34 | var clone = new connectionGene(from, to, this.weight, this.innovationNo); 35 | clone.enabled = this.enabled; 36 | 37 | return clone; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/ConnectionHistory.js: -------------------------------------------------------------------------------- 1 | class connectionHistory { 2 | constructor(from, to, inno, innovationNos) { 3 | this.fromNode = from; 4 | this.toNode = to; 5 | this.innovationNumber = inno; 6 | this.innovationNumbers = []; //the innovation Numbers from the connections of the genome which first had this mutation 7 | //this represents the genome and allows us to test if another genoeme is the same 8 | //this is before this connection was added 9 | arrayCopy(innovationNos, this.innovationNumbers); //copy (from, to) 10 | } 11 | 12 | //---------------------------------------------------------------------------------------------------------------- 13 | //returns whether the genome matches the original genome and the connection is between the same nodes 14 | matches(genome, from, to) { 15 | if (genome.genes.length === this.innovationNumbers.length) { //if the number of connections are different then the genoemes aren't the same 16 | if (from.number === this.fromNode && to.number === this.toNode) { 17 | //next check if all the innovation numbers match from the genome 18 | for (var i = 0; i < genome.genes.length; i++) { 19 | if (!this.innovationNumbers.includes(genome.genes[i].innovationNo)) { 20 | return false; 21 | } 22 | } 23 | //if reached this far then the innovationNumbers match the genes innovation numbers and the connection is between the same nodes 24 | //so it does match 25 | return true; 26 | } 27 | } 28 | return false; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/Ground.js: -------------------------------------------------------------------------------- 1 | class Ground { 2 | 3 | constructor() { 4 | this.height = 30; 5 | this.topPixelCoord = canvas.height - this.height; 6 | this.pixelOffset = 0; 7 | 8 | } 9 | 10 | show() { 11 | fill(0); 12 | rect(0, this.topPixelCoord, canvas.width, this.height); 13 | for (var i = this.pixelOffset; i < canvas.width; i += groundSprite.width) { 14 | image(groundSprite, i, this.topPixelCoord); 15 | } 16 | } 17 | 18 | 19 | 20 | update() { 21 | this.pixelOffset -= panSpeed; 22 | if (this.pixelOffset <= -groundSprite.width) { 23 | this.pixelOffset += groundSprite.width; 24 | } 25 | 26 | 27 | } 28 | 29 | collided(p) { 30 | return p.y + p.size / 2 >= this.topPixelCoord; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/Node.js: -------------------------------------------------------------------------------- 1 | class Node { 2 | 3 | constructor(no) { 4 | this.number = no; 5 | this.inputSum = 0; //current sum i.e. before activation 6 | this.outputValue = 0; //after activation function is applied 7 | this.outputConnections = []; //new ArrayList(); 8 | this.layer = 0; 9 | this.drawPos = createVector(); 10 | } 11 | 12 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 13 | //the node sends its output to the inputs of the nodes its connected to 14 | engage() { 15 | if(this.layer != 0) { //no sigmoid for the inputs and bias 16 | this.outputValue = this.sigmoid(this.inputSum); 17 | } 18 | 19 | for(var i = 0; i < this.outputConnections.length; i++) { //for each connection 20 | if(this.outputConnections[i].enabled) { //dont do shit if not enabled 21 | this.outputConnections[i].toNode.inputSum += this.outputConnections[i].weight * this.outputValue; //add the weighted output to the sum of the inputs of whatever node this node is connected to 22 | } 23 | } 24 | } 25 | //---------------------------------------------------------------------------------------------------------------------------------------- 26 | //not used 27 | stepFunction(x) { 28 | if(x < 0) { 29 | return 0; 30 | } else { 31 | return 1; 32 | } 33 | } 34 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 35 | //sigmoid activation function 36 | sigmoid(x) { 37 | return 1.0 / (1.0 + pow(Math.E, -4.9 * x)); //todo check pow 38 | } 39 | //---------------------------------------------------------------------------------------------------------------------------------------------------------- 40 | //returns whether this node connected to the parameter node 41 | //used when adding a new connection 42 | isConnectedTo(node) { 43 | if(node.layer == this.layer) { //nodes in the same this.layer cannot be connected 44 | return false; 45 | } 46 | 47 | //you get it 48 | if(node.layer < this.layer) { 49 | for(var i = 0; i < node.outputConnections.length; i++) { 50 | if(node.outputConnections[i].toNode == this) { 51 | return true; 52 | } 53 | } 54 | } else { 55 | for(var i = 0; i < this.outputConnections.length; i++) { 56 | if(this.outputConnections[i].toNode == node) { 57 | return true; 58 | } 59 | } 60 | } 61 | 62 | return false; 63 | } 64 | //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 65 | //returns a copy of this node 66 | clone() { 67 | var clone = new Node(this.number); 68 | clone.layer = this.layer; 69 | return clone; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/Pipe.js: -------------------------------------------------------------------------------- 1 | class Pipe { 2 | constructor(isTop, height) { 3 | this.width = 100; 4 | this.height = height; 5 | this.x = canvas.width; 6 | this.isTop = isTop; 7 | // this.randomMultiplier = random(5); 8 | this.randomMultiplier=1; 9 | if (isTop) { 10 | this.topY = 0; 11 | this.bottomY = this.height; 12 | } else { 13 | this.topY = canvas.height - this.height; 14 | this.bottomY = canvas.height; 15 | } 16 | } 17 | 18 | show() { 19 | // fill(0, 204, 0); 20 | // rect(this.x, this.topY, this.width, this.height); 21 | 22 | if (this.isTop) { 23 | image(topPipeSprite, this.x, this.topY + this.height - 800); 24 | } else { 25 | image(bottomPipeSprite, this.x, this.topY); 26 | } 27 | 28 | } 29 | 30 | update() { 31 | this.x -= panSpeed * this.randomMultiplier; 32 | } 33 | 34 | colided(p) { 35 | 36 | if (p.x + p.size / 2 >= this.x && p.x - p.size / 2 <= this.x + this.width) { 37 | if (!this.isTop && p.y + p.size / 2 >= this.topY) { 38 | return true; 39 | } 40 | if (this.isTop && p.y - p.size / 2 <= this.bottomY) { 41 | return true; 42 | } 43 | 44 | } 45 | return false; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/PipePair.js: -------------------------------------------------------------------------------- 1 | class PipePair { 2 | constructor(firstPipe, previousPipe, upToRandNo) { 3 | var minDistFromEdge = 50; 4 | this.gap = 160; 5 | this.maxPipeDifference = 300; 6 | this.passed = false; 7 | if (firstPipe) { 8 | this.topHeight = (canvas.height - 30) / 2 - this.gap / 2; 9 | } else { 10 | if (randomPipeHeights.length >= upToRandNo) { 11 | randomPipeHeights.push(floor(random(minDistFromEdge, canvas.height - minDistFromEdge - 30 - this.gap))); 12 | } 13 | this.topHeight = randomPipeHeights[upToRandNo]; //floor(random(minDistFromEdge, canvas.height - minDistFromEdge - 30 - this.gap)); 14 | if (previousPipe) { 15 | while (abs(this.topHeight - previousPipe.topHeight) > this.maxPipeDifference) { 16 | randomPipeHeights[upToRandNo] = floor(random(minDistFromEdge, canvas.height - minDistFromEdge - 30 - this.gap)); 17 | this.topHeight = randomPipeHeights[upToRandNo]; 18 | } 19 | } 20 | } 21 | this.bottomHeight = canvas.height - this.topHeight - this.gap; 22 | this.bottomPipe = new Pipe(false, this.bottomHeight); 23 | this.topPipe = new Pipe(true, this.topHeight); 24 | } 25 | 26 | 27 | 28 | show() { 29 | this.bottomPipe.show(); 30 | this.topPipe.show(); 31 | 32 | } 33 | 34 | update() { 35 | this.bottomPipe.update(); 36 | this.topPipe.update(); 37 | 38 | } 39 | 40 | 41 | offScreen() { 42 | if (this.bottomPipe.x + this.bottomPipe.width < 0) { 43 | return true; 44 | } 45 | return false; 46 | 47 | } 48 | 49 | playerPassed(playerX) { 50 | if (!this.passed && playerX > this.bottomPipe.x + this.bottomPipe.width) { 51 | this.passed = true; 52 | return true; 53 | } 54 | return false; 55 | 56 | } 57 | 58 | colided(p) { 59 | return this.bottomPipe.colided(p) || this.topPipe.colided(p); 60 | 61 | } 62 | 63 | setX(newX) { 64 | this.bottomPipe.x = newX; 65 | this.topPipe.x = newX; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/images/Untitled-3.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/flappyBird/images/Untitled-3.psd -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/images/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/flappyBird/images/background.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/images/bird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/flappyBird/images/bird.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/images/christmasberd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/flappyBird/images/christmasberd.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/images/fatBird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/flappyBird/images/fatBird.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/images/full pipe bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/flappyBird/images/full pipe bottom.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/images/full pipe top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/flappyBird/images/full pipe top.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/images/groundPiece.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/flappyBird/images/groundPiece.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/images/photoshoip thing 1.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/flappyBird/images/photoshoip thing 1.psd -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/images/pipeHead0000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/flappyBird/images/pipeHead0000.png -------------------------------------------------------------------------------- /websiteUsingBulma/ProjectSketches/flappyBird/images/shaft0000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/ProjectSketches/flappyBird/images/shaft0000.png -------------------------------------------------------------------------------- /websiteUsingBulma/SnakeGame/.idea/SnakeGame.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /websiteUsingBulma/SnakeGame/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /websiteUsingBulma/SnakeGame/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /websiteUsingBulma/SnakeGame/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /websiteUsingBulma/SnakeGame/Apple.js: -------------------------------------------------------------------------------- 1 | class Apple { 2 | constructor(snake) { 3 | this.x = floor(random(blocksX)); 4 | this.y = floor(random(blocksY)); 5 | 6 | while (snake.isAppleOnSnake(this)) { 7 | this.x = floor(random(blocksX)); 8 | this.y = floor(random(blocksY)); 9 | } 10 | print(snake, this); 11 | } 12 | 13 | 14 | show() { 15 | noStroke(); 16 | fill(0, 150, 0); 17 | // fill(100); 18 | // fill(255, 0, 0);\ 19 | push(); 20 | translate(this.x * blockSize + outlineLength, this.y * blockSize + outlineLength); 21 | scale((blockSize - 2*outlineLength)/3.0); 22 | rect(1,0,1,1); 23 | rect(1,2,1,1); 24 | rect(0,1,1,1); 25 | rect(2,1,1,1); 26 | 27 | pop(); 28 | // rect(this.x * blockSize + outlineLength, this.y * blockSize + outlineLength, , blockSize - 2*outlineLength); 29 | 30 | } 31 | 32 | isAtPosition(x, y) { 33 | return this.x === x && this.y === y; 34 | } 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /websiteUsingBulma/SnakeGame/s/welcomeText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/SnakeGame/s/welcomeText.png -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/bebas_neue/About.md: -------------------------------------------------------------------------------- 1 | # Bebas Neue by Dharma Type 2 | You downloaded Bebas Neue V2.000. 3 | When you need lowercases and Italics, please visit [http://bebasneue.com/](http://bebasneue.com/) 4 | 5 | ## License of Bebas Neue V2.00 6 | This font is licensed under the SIL Open Font License 1.1 7 | http://scripts.sil.org/OFL 8 | http://scripts.sil.org/OFL-FAQ_web 9 | 10 | ## Detail 11 | Please visit http://bebasneue.com/ for more detail and web fonts. 12 | 13 | ## FAQ 14 | Q_ Can I use this for a commercial product? 15 | A_ Yes, You can. 16 | 17 | ## Contact 18 | Ryoichi Tsunekawa 19 | Dharma Type 20 | http://dharmatype.com 21 | info@dharmatype.com 22 | 23 | 24 | # History of Bebas Neue by Dharma Type 25 | 26 | * [Bebas Neue Pro (2019) – Commercial font](https://www.myfonts.com/fonts/flat-it/bebas-neue-pro/?refby=dharmatype) 27 | Bebas Neue Pro is a premium font family with 40 styles including lowercase and *Italic* based on Bebas Neue version 2.000 (2018) . Available from [Myfonts](https://www.myfonts.com/fonts/flat-it/bebas-neue-pro/?refby=dharmatype). 28 | 29 | * [Bebas Neue Rounded (2018) — Commercial font](https://www.myfonts.com/fonts/flat-it/bebas-neue-rounded/?refby=dharmatype) 30 | Bebas Neue Rounded is rounded derivative work based on Bebas Neue (2018) 31 | Available from [Our partners](https://dharmatype.com/shop) such like [Myfonts](https://www.myfonts.com/fonts/flat-it/bebas-neue-rounded/?refby=dharmatype) and [Patreon](https://www.patreon.com/dharmatype). 32 | 33 | * [Bebas Neue SemiRounded (2018) — Commercial font](https://www.myfonts.com/fonts/flat-it/bebas-neue-semi-rounded/?refby=dharmatype) 34 | Bebas Neue SemiRounded is semi-rounded derivative work based on Bebas Neue (2018) 35 | Available from [Our partners](https://dharmatype.com/shop) such like [Myfonts](https://www.myfonts.com/fonts/flat-it/bebas-neue-semi-rounded/?refby=dharmatype) and [Patreon](https://www.patreon.com/dharmatype). 36 | 37 | * [Bebas Neue version 2.000 (2018) — Free font](https://github.com/dharmatype/Bebas-Neue) 38 | *- This repository.* 39 | From version 2.000, Bebas Neue has become open source font. 40 | In this repository, you can download the font files(.eot, .otf, .ttf, .woff and .woff2) and its source file(.glyphs) 41 | Licensed under the SIL Open Font License v1.1. 42 | 43 | * [Bebas Kai (2014) — Free font](https://github.com/dharmatype/Bebas-Kai) 44 | Bebas Kai is one of derivative works based upon Bebas (2005) 45 | From 2018, Bebas Kai has become open sourced font. 46 | Licensed under the SIL Open Font License v1.1. 47 | 48 | * [Bebas Neue Family (2014) — Free font](http://www.fontfabric.com/bebas-neue/) 49 | Fontfabric designed additional weights and glyphs. 50 | They are distributing the font family under the same name of "Bebas Neue". 51 | Please read more information below. 52 | 53 | * [Mocha Mattari (2011) — Commercial font](https://www.myfonts.com/fonts/flat-it/mocha-mattari/?refby=dharmatype) 54 | Mocha Mattari is distressed font designed based on Bebas Neue (2010) 55 | Available from [Our partners](https://dharmatype.com/shop) such like [Myfonts](https://www.myfonts.com/fonts/flat-it/mocha-mattari/?refby=dharmatype) . 56 | 57 | * [Bebas Neue version 1.xxx (2010) — Free font](https://github.com/dharmatype/Bebas-Neue) 58 | Bebas Neue was re-designed from Bebas (2005) font for the same purpose. First released in 2010. 59 | Bebas Neue have same proportion and theory as original Bebas (2005) font. 60 | Licensed under the SIL Open Font License v1.1. 61 | 62 | * [Boycott (2006) — Commercial font](https://www.myfonts.com/fonts/flat-it/boycott/?refby=dharmatype) 63 | Boycott is distressed font designed based on Bebas(2005). 64 | Available from [Our partners](https://dharmatype.com/shop) such like [Myfonts](https://www.myfonts.com/fonts/flat-it/boycott/?refby=dharmatype). 65 | 66 | * [Bebas (2005) — Free font](https://github.com/dharmatype/Bebas) 67 | Bebas is a free font for the purpose of type design training/practice for myself and to get feedback from the world. 68 | Originally released in 2005. *Development was terminated.* 69 | -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/bebas_neue/About.txt: -------------------------------------------------------------------------------- 1 | Bebas Neue by Dharma Type 2 | You downloaded Bebas Neue V2.000. 3 | When you need lowercases and Italics, please visit [http://bebasneue.com/] 4 | 5 | License of Bebas Neue V2.00 6 | This font is licensed under the SIL Open Font License 1.1 7 | [http://scripts.sil.org/OFL] 8 | [http://scripts.sil.org/OFL-FAQ_web] 9 | 10 | Detail 11 | Please visit [http://bebasneue.com/] for more detail and web fonts. 12 | 13 | FAQ 14 | Q_ Can I use this for a commercial product? 15 | A_ Yes, You can. 16 | 17 | Contact 18 | Ryoichi Tsunekawa 19 | Dharma Type 20 | [http://dharmatype.com] 21 | [info@dharmatype.com] 22 | 23 | 24 | History of Bebas Neue by Dharma Type 25 | 26 | - Bebas Neue Pro (2019) – Commercial font - [https://www.myfonts.com/fonts/flat-it/bebas-neue-pro/?refby=dharmatype] 27 | Bebas Neue Pro is a premium font family with 40 styles including lowercase and Italic and Cyrillic based on Bebas Neue version 2.000 (2018). 28 | Available from [https://www.myfonts.com/fonts/flat-it/bebas-neue-pro/?refby=dharmatype] 29 | 30 | 31 | - Bebas Neue Rounded (2018) — Commercial font - [https://www.myfonts.com/fonts/flat-it/bebas-neue-rounded/?refby=dharmatype] 32 | Bebas Neue Rounded is rounded derivative work based on Bebas Neue Version 2.000(2018) 33 | Available from our partners such like Myfonts[https://www.myfonts.com/fonts/flat-it/bebas-neue-rounded/?refby=dharmatype] and Patreon[https://www.patreon.com/dharmatype]. 34 | Please see [https://dharmatype.com/shop]. 35 | 36 | - Bebas Neue SemiRounded (2018) — Commercial font - [https://www.myfonts.com/fonts/flat-it/bebas-neue-semi-rounded/?refby=dharmatype] 37 | Bebas Neue SemiRounded is semi-rounded derivative work based on Bebas Neue Version 2.000(2018) 38 | Available from our partners such like Myfonts[https://www.myfonts.com/fonts/flat-it/bebas-neue-rounded/?refby=dharmatype] and Patreon[https://www.patreon.com/dharmatype]. 39 | Please see [https://dharmatype.com/shop]. 40 | 41 | - Bebas Neue version 2.000 (2018) — Free font - [https://github.com/dharmatype/Bebas-Neue] 42 | From version 2.000, Bebas Neue has become open source font. 43 | In this repository, you can download the font files(.eot, .otf, .ttf, .woff and .woff2) and its source file(.glyphs) 44 | Licensed under the SIL Open Font License v1.1. 45 | 46 | - Bebas Kai (2014) — Free font - [https://github.com/dharmatype/Bebas-Kai] 47 | Bebas Kai is one of derivative works based upon Bebas (2005) 48 | From 2018, Bebas Kai has become open sourced font. 49 | Licensed under the SIL Open Font License v1.1. 50 | 51 | - Bebas Neue Family (2014) — Free font - [http://www.fontfabric.com/bebas-neue/] 52 | Fontfabric designed additional weights and glyphs. 53 | They are distributing the font family under the same name of "Bebas Neue". 54 | 55 | - Mocha Mattari (2011) — Commercial font - [https://www.myfonts.com/fonts/flat-it/mocha-mattari/?refby=dharmatype] 56 | Mocha Mattari is distressed font designed based on Bebas Neue version 1.xxx (2010) 57 | Available from our partners such like Myfonts[https://www.myfonts.com/fonts/flat-it/mocha-mattari/?refby=dharmatype]. 58 | Please see [https://dharmatype.com/shop]. 59 | 60 | - Bebas Neue version 1.xxx (2010) — Free font - [https://github.com/dharmatype/Bebas-Neue] 61 | Bebas Neue was re-designed from Bebas (2005) font for the same purpose. First released in 2010. 62 | Bebas Neue have same proportion and theory as original Bebas (2005) font. 63 | Licensed under the SIL Open Font License v1.1. 64 | 65 | - Boycott (2006) — Commercial font - [https://www.myfonts.com/fonts/flat-it/boycott/?refby=dharmatype] 66 | Boycott is distressed font designed based on Bebas(2005). 67 | Available from Our partners such like Myfonts[https://www.myfonts.com/fonts/flat-it/boycott/?refby=dharmatype]. 68 | Please see [https://dharmatype.com/shop]. 69 | 70 | - Bebas (2005) — Free font - [https://github.com/dharmatype/Bebas] 71 | Bebas is a free font for the purpose of type design training/practice for myself and to get feedback from the world. 72 | Originally released in 2005. *Development was terminated.* 73 | -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/bebas_neue/BebasNeue-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/bebas_neue/BebasNeue-Regular.eot -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/bebas_neue/BebasNeue-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/bebas_neue/BebasNeue-Regular.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/bebas_neue/BebasNeue-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/bebas_neue/BebasNeue-Regular.ttf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/bebas_neue/BebasNeue-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/bebas_neue/BebasNeue-Regular.woff -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/bebas_neue/BebasNeue-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/bebas_neue/BebasNeue-Regular.woff2 -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/bebas_neue/Try_BebasNeuePro.txt: -------------------------------------------------------------------------------- 1 | Bebas Neue Pro is a premium font family with 40 styles including lowercase and Italic and Cyrillic. 2 | 3 | Please visit 4 | [http://bebasneue.com/] or 5 | [https://www.myfonts.com/fonts/flat-it/bebas-neue-pro/?refby=dharmatype] -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-Black.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-Black.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-BlackItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-BlackItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-Bold.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-BoldItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-BoldItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-ExtraBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-ExtraBold.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-ExtraBoldItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-ExtraBoldItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-ExtraLight.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-ExtraLight.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-ExtraLightItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-ExtraLightItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-Italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-Italic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-Light.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-LightItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-LightItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-Medium.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-MediumItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-MediumItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-Regular.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-SemiBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-SemiBold.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-SemiBoldItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-SemiBoldItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-Thin.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-Thin.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/Montserrat-ThinItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/Montserrat-ThinItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-Black.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-Black.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-BlackItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-BlackItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-Bold.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-BoldItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-BoldItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-ExtraBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-ExtraBold.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-ExtraBoldItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-ExtraBoldItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-ExtraLight.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-ExtraLight.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-ExtraLightItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-ExtraLightItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-Italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-Italic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-Light.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-LightItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-LightItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-Medium.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-MediumItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-MediumItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-Regular.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-SemiBold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-SemiBold.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-SemiBoldItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-SemiBoldItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-Thin.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-Thin.otf -------------------------------------------------------------------------------- /websiteUsingBulma/fonts/montserrat/MontserratAlternates-ThinItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/fonts/montserrat/MontserratAlternates-ThinItalic.otf -------------------------------------------------------------------------------- /websiteUsingBulma/images/GlowingLogoWithName.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/GlowingLogoWithName.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Merch/20bucks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Merch/20bucks.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Merch/Mug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Merch/Mug.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Merch/banana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Merch/banana.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Merch/codeBulletsSoul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Merch/codeBulletsSoul.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Merch/fireManCalender.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Merch/fireManCalender.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Merch/laptop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Merch/laptop.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Merch/puppy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Merch/puppy.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Merch/sneakers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Merch/sneakers.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Merch/sunglasses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Merch/sunglasses.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Projects/chess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Projects/chess.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Projects/flappyBird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Projects/flappyBird.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Projects/hillClimbRacing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Projects/hillClimbRacing.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Projects/marbleCalculator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Projects/marbleCalculator.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/Projects/worldsHardestGame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/Projects/worldsHardestGame.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/code Bullet pose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/code Bullet pose.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/dummyBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/dummyBackground.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/logo-glowing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/logo-glowing.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/logo-head-greenface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/logo-head-greenface.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/logo.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/logo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/logo2.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/logo3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/logo3.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/logoHead.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/logoHead.png -------------------------------------------------------------------------------- /websiteUsingBulma/images/snakeBackground.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/images/snakeBackground.gif -------------------------------------------------------------------------------- /websiteUsingBulma/pageJs/sketch.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | function setup(){ 4 | setupElements(); 5 | } 6 | function windowResized() { 7 | onResize(); 8 | } -------------------------------------------------------------------------------- /websiteUsingBulma/projectSketch/images/chess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/projectSketch/images/chess.png -------------------------------------------------------------------------------- /websiteUsingBulma/projectSketch/images/creatureCreator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/projectSketch/images/creatureCreator.png -------------------------------------------------------------------------------- /websiteUsingBulma/projectSketch/images/flappyBird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/projectSketch/images/flappyBird.png -------------------------------------------------------------------------------- /websiteUsingBulma/projectSketch/images/hillClimbRacing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/projectSketch/images/hillClimbRacing.png -------------------------------------------------------------------------------- /websiteUsingBulma/projectSketch/images/marbleCalculator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/projectSketch/images/marbleCalculator.png -------------------------------------------------------------------------------- /websiteUsingBulma/projectSketch/images/worldsHardestGame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Bullet/WebsiteTest/d6db9d99117133b2e9c83ccb77793b47c5f88540/websiteUsingBulma/projectSketch/images/worldsHardestGame.png -------------------------------------------------------------------------------- /websiteUsingBulma/styles/debug.css: -------------------------------------------------------------------------------- 1 | /*! debug.css | MIT License | zaydek.github.com/debug.css */ 2 | *:not(path):not(g) { 3 | color: hsla(210, 100%, 100%, 0.9) !important; 4 | background: hsla(210, 100%, 50%, 0.5) !important; 5 | outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; 6 | 7 | box-shadow: none !important; 8 | } --------------------------------------------------------------------------------