From 186001ddc6564dabdec78ce063e1403870c5630f Mon Sep 17 00:00:00 2001
From: 201flaviosilva <55815265+201flaviosilva@users.noreply.github.com>
Date: Wed, 2 Oct 2024 21:57:20 +0000
Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20201flavi?=
=?UTF-8?q?osilva/201flaviosilva.github.io@0a49c71b285051f3edbd76738f24df1?=
=?UTF-8?q?c3b7a8254=20=F0=9F=9A=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
PDF/index.html | 11 ++++--
PDF/style.css | 33 +++++++++++++++-
PDF/style.min.css | 2 +-
PDF/style.scss | 39 ++++++++++++++++++-
.../{index.e946b8ae.js => index.cdceccd2.js} | 2 +-
index.html | 2 +-
6 files changed, 80 insertions(+), 9 deletions(-)
rename assets/{index.e946b8ae.js => index.cdceccd2.js} (96%)
diff --git a/PDF/index.html b/PDF/index.html
index 4697d41..5eb6537 100644
--- a/PDF/index.html
+++ b/PDF/index.html
@@ -49,10 +49,13 @@
diff --git a/PDF/style.css b/PDF/style.css
index 861c206..7c36ec5 100644
--- a/PDF/style.css
+++ b/PDF/style.css
@@ -21,10 +21,13 @@ body a.language-switch {
right: 0;
font-family: "VT323", monospace;
font-size: 24px;
- color: red;
+ color: #f28157;
+ border-radius: 4px;
+ background-color: rgba(47, 44, 64, 0.25);
}
body div.container {
+ margin: 0 auto;
padding: 0 8px;
display: flex;
flex-direction: column;
@@ -111,3 +114,31 @@ body div.container main section.education li ul li p.title {
body div.container main section.education {
margin-bottom: 0;
}
+
+@media only screen and (max-width: 800px) {
+ body {
+ background-color: #2f2c40;
+ }
+ body a.language-switch {
+ margin: 8px 2px;
+ padding: 4px 8px;
+ font-size: 16px;
+ color: rgba(242, 128, 87, 0.5);
+ z-index: 1;
+ }
+ body div.container {
+ width: 100vw;
+ }
+ body div.container main img.sticker {
+ right: 32px;
+ width: 64px;
+ height: 64px;
+ }
+ body div.container main section {
+ margin-top: 12px;
+ }
+ body div.container main div.columns {
+ grid-template-columns: 1fr;
+ gap: 0;
+ }
+}
diff --git a/PDF/style.min.css b/PDF/style.min.css
index 3320207..f131d7a 100644
--- a/PDF/style.min.css
+++ b/PDF/style.min.css
@@ -1 +1 @@
-@import url("https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&display=swap");@import url("https://fonts.googleapis.com/css2?family=VT323&display=swap");p,span,li{font-family:"Source Code Pro", monospace;font-weight:500;font-size:16px;color:#f2f2f2}body{display:flex;justify-content:center;background-color:black}body a.language-switch{position:fixed;top:0;right:0;font-family:"VT323", monospace;font-size:24px;color:red}body div.container{padding:0 8px;display:flex;flex-direction:column;position:relative;width:794px;height:1123px;background-color:#2f2c40}body div.container .heading{color:#f28157}body div.container .symbol{color:#80f2e7}body div.container .symbol-alternative{color:#f28157}body div.container img.sticker{position:absolute;top:16px;right:16px;width:128px;height:128px;object-fit:contain;object-position:center}body div.container header p.tag-cv-container *,body div.container footer p.tag-cv-container *{font-size:50px}body div.container header p.name{font-size:24px;color:#80f2e7}body div.container main{flex:1}body div.container main h2.heading-container *{font-size:32px}body div.container main div.columns{display:grid;grid-template-columns:1fr 1fr;gap:16px}body div.container main section.work-experience li span.title,body div.container main section.work-experience li p.title,body div.container main section.education li span.title,body div.container main section.education li p.title{font-size:24px;color:#80f2e7}body div.container main section.work-experience li span.role,body div.container main section.work-experience li span.time,body div.container main section.work-experience li span.institution,body div.container main section.education li span.role,body div.container main section.education li span.time,body div.container main section.education li span.institution{color:#f28157;font-size:24px}body div.container main section.work-experience li ul,body div.container main section.education li ul{margin-left:16px}body div.container main section.work-experience li ul li p.title,body div.container main section.education li ul li p.title{font-size:16px}body div.container main section.education{margin-bottom:0}
+@import url("https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&display=swap");@import url("https://fonts.googleapis.com/css2?family=VT323&display=swap");p,span,li{font-family:"Source Code Pro", monospace;font-weight:500;font-size:16px;color:#f2f2f2}body{display:flex;justify-content:center;background-color:black}body a.language-switch{position:fixed;top:0;right:0;font-family:"VT323", monospace;font-size:24px;color:#f28157;border-radius:4px;background-color:rgba(47,44,64,0.25)}body div.container{margin:0 auto;padding:0 8px;display:flex;flex-direction:column;position:relative;width:794px;height:1123px;background-color:#2f2c40}body div.container .heading{color:#f28157}body div.container .symbol{color:#80f2e7}body div.container .symbol-alternative{color:#f28157}body div.container img.sticker{position:absolute;top:16px;right:16px;width:128px;height:128px;object-fit:contain;object-position:center}body div.container header p.tag-cv-container *,body div.container footer p.tag-cv-container *{font-size:50px}body div.container header p.name{font-size:24px;color:#80f2e7}body div.container main{flex:1}body div.container main h2.heading-container *{font-size:32px}body div.container main div.columns{display:grid;grid-template-columns:1fr 1fr;gap:16px}body div.container main section.work-experience li span.title,body div.container main section.work-experience li p.title,body div.container main section.education li span.title,body div.container main section.education li p.title{font-size:24px;color:#80f2e7}body div.container main section.work-experience li span.role,body div.container main section.work-experience li span.time,body div.container main section.work-experience li span.institution,body div.container main section.education li span.role,body div.container main section.education li span.time,body div.container main section.education li span.institution{color:#f28157;font-size:24px}body div.container main section.work-experience li ul,body div.container main section.education li ul{margin-left:16px}body div.container main section.work-experience li ul li p.title,body div.container main section.education li ul li p.title{font-size:16px}body div.container main section.education{margin-bottom:0}@media only screen and (max-width: 800px){body{background-color:#2f2c40}body a.language-switch{margin:8px 2px;padding:4px 8px;font-size:16px;color:rgba(242,128,87,0.5);z-index:1}body div.container{width:100vw}body div.container main img.sticker{right:32px;width:64px;height:64px}body div.container main section{margin-top:12px}body div.container main div.columns{grid-template-columns:1fr;gap:0}}
diff --git a/PDF/style.scss b/PDF/style.scss
index f379fdf..f8fd989 100644
--- a/PDF/style.scss
+++ b/PDF/style.scss
@@ -38,10 +38,13 @@ body {
right: 0;
font-family: "VT323", monospace;
font-size: $space-l;
- color: red;
+ color: $txt-heading-color;
+ border-radius: 4px;
+ background-color: rgba(47, 44, 64, 0.25);
}
div.container {
+ margin: 0 auto;
padding: 0 $space-xs;
display: flex;
flex-direction: column;
@@ -136,4 +139,38 @@ body {
}
}
}
+
+ // scale to fit on mobile
+ @media only screen and (max-width: 800px) {
+ background-color: $background-color;
+
+ a.language-switch {
+ margin: $space-xs $space-xxxs;
+ padding: $space-xxs $space-xs;
+ font-size: $space-m;
+ color: rgba(242, 128, 87, 0.5);
+ z-index: 1;
+ }
+
+ div.container {
+ width: 100vw;
+
+ main {
+ img.sticker {
+ right: $space-xl;
+ width: $space-xxl;
+ height: $space-xxl;
+ }
+
+ section {
+ margin-top: $space-s;
+ }
+
+ div.columns {
+ grid-template-columns: 1fr;
+ gap: 0;
+ }
+ }
+ }
+ }
}
diff --git a/assets/index.e946b8ae.js b/assets/index.cdceccd2.js
similarity index 96%
rename from assets/index.e946b8ae.js
rename to assets/index.cdceccd2.js
index 7813cd9..437cfbb 100644
--- a/assets/index.e946b8ae.js
+++ b/assets/index.cdceccd2.js
@@ -6006,4 +6006,4 @@ return new `+this.key+`();
* @author Richard Davey
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
-*/var v=t(33),a=t(17),o={Actions:t(275),Animations:t(723),BlendModes:t(35),Cache:t(735),Cameras:t(738),Core:t(806),Class:t(0),Create:t(888),Curves:t(894),Data:t(896),Display:t(898),DOM:t(917),Events:t(918),Game:t(920),GameObjects:t(1011),Geom:t(483),Input:t(1308),Loader:t(1338),Math:t(193),Physics:t(1493),Plugins:t(1403),Renderer:t(1405),Scale:t(1412),ScaleModes:t(168),Scene:t(418),Scenes:t(1413),Structs:t(1415),Textures:t(1416),Tilemaps:t(1418),Time:t(1461),Tweens:t(1463),Utils:t(1481)};o.Sound=t(1492),o=a(!1,o,v),c.exports=o,e.Phaser=o}).call(this,t(600))}])})})(qt);const Ut=re(qt.exports);class Wt{constructor(){this.events={}}on(Y,c){this.has(Y)||(this.events[Y]=[]),this.events[Y].push(c)}emit(Y,...c){this.has(Y)&&this.events[Y].forEach(S=>{S(...c)})}off(Y){delete this.events[Y]}once(Y,c){let S=(...t)=>{c(...t),this.off(Y)};this.on(Y,S)}clear(){this.events={}}has(Y){return this.events[Y]!==void 0}}new Wt;const Xt={enter:13,escape:27,space:32,left:37,up:38,right:39,down:40,num0:48,num1:49,num2:50,num3:51,num4:52,num5:53,num6:54,num7:55,num8:56,num9:57,q:81,w:87,e:69,r:82,t:84,y:89,u:85,i:73,o:79,p:80,a:65,s:83,d:68,f:70,g:71,h:72,j:74,k:75,l:76,z:90,x:88,c:67,v:86,b:66,n:78,m:77};class ae{constructor(){this.isPressed={},this.events=new Wt,window.addEventListener("keydown",this._keyDown.bind(this)),window.addEventListener("keypress",this._keyPress.bind(this)),window.addEventListener("keyup",this._keyUp.bind(this))}getNameByKeyCode(Y){return Object.keys(Xt).find(c=>Xt[c]===Y)}getKeyCodeByName(Y){return Xt[Y]}isKeyPressed(Y){if(typeof Y=="string")return this.isKeyPressedName(Y);if(typeof Y=="number")return this.isKeyPressedKeyCode(Y)}isKeyPressedName(Y){return!!this.isPressed[Y]}isKeyPressedKeyCode(Y){return!!this.isPressed[this.getNameByKeyCode(Y)]}_keyDown({keyCode:Y}){this.isPressed[this.getNameByKeyCode(Y)]=!0;const c=this.getNameByKeyCode(Y);this.events.emit(`keyDown-${c}`,{code:Y,name:c})}_keyPress(Y){}_keyUp({keyCode:Y}){this.isPressed[this.getNameByKeyCode(Y)]=!1;const c=this.getNameByKeyCode(Y);this.events.emit(`keyUp-${this.getNameByKeyCode(Y)}`,{code:Y,name:c})}}new ae;const Ot={left:0,middle:1,right:2};class oe{constructor(Y=!1){this.x=0,this.y=0,this.MouseButton=Ot,this.isDown={},this.events=new Wt,window.addEventListener("mousemove",this._mousemove.bind(this)),window.addEventListener("mousedown",this._mousedown.bind(this)),window.addEventListener("mouseup",this._mouseup.bind(this)),Y&&window.addEventListener("contextmenu",c=>c.preventDefault())}getPosition(Y){if(!Y)return{x:this.x,y:this.y};const{x:c,y:S}=Y.getBoundingClientRect();return{x:this.x-c,y:this.y-S}}getNameByButtonCode(Y){switch(Y){case Ot.left:return"left";case Ot.middle:return"middle";case Ot.right:return"right";default:return""}}getButtonKeyByName(Y){switch(Y){case"left":return Ot.left;case"middle":return Ot.middle;case"right":return Ot.right;default:return-1}}isButtonDown(Y){if(typeof Y=="string")return this.isButtonDownByName(Y);if(typeof Y=="number")return this.isButtonDownByButtonCode(Y)}isButtonDownByName(Y){return!!this.isDown[Y]}isButtonDownByButtonCode(Y){return!!this.isDown[this.getNameByButtonCode(Y)]}_updateMousePosition(Y){const{clientX:c,clientY:S}=Y;this.x=c,this.y=S}_mousemove(Y){this._updateMousePosition(Y)}_mousedown(Y){this._updateMousePosition(Y);const c=this.getNameByButtonCode(Y.button);this.isDown[c]=!0,this.events.emit(`buttonDown-${c}`,{code:Y.button,name:c})}_mouseup(Y){this._updateMousePosition(Y);const c=this.getNameByButtonCode(Y.button);this.isDown[c]=!1,this.events.emit(`buttonUp-${c}`,{code:Y.button,name:c})}}new oe;const Zt={minWidth:"80%",position:"fixed",top:"-50px",left:"50%",zIndex:1e3,transform:"translate(-50%, 0)",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 10px",border:"2px solid #000000",borderRadius:"4px",backgroundColor:"#f0f0f0",boxShadow:"0px 0px 5px 1px rgba(0, 0, 0, 0.75)"},Jt={},Qt={padding:"2px 6px",borderRadius:"4px",background:"none"};function he({text:k="",animated:Y=!0,animationTime:c=2,closeButton:S=!0,endPosition:t=100,style:e=Zt,textStyle:v=Jt,buttonStyle:a=Qt,parent:o=document.body}){e={...Zt,...e},v={...Jt,...v},a={...Qt,...a};let r=0;const i=t+"px",s=document.createElement("div");Object.assign(s.style,{...e}),Y?s.style.transition=c+"s":s.style.top=i;const l=document.createElement("span");if(Object.assign(l.style,{...v}),l.innerHTML=k,s.appendChild(l),S){const n=document.createElement("button");Object.assign(n.style,{...a}),n.innerHTML="X",n.addEventListener("click",()=>o.removeChild(s)),s.appendChild(n)}Y?(s.addEventListener("transitionend",()=>{r++,r>=2&&o.removeChild(s)}),setTimeout(()=>{s.style.top=i},10),setTimeout(()=>{s.style.top="-100px"},(c+1)*1e3)):setTimeout(()=>{o.removeChild(s)},(c+1)*1e3),o.appendChild(s)}function Tt(k,Y){return Y||(Y=k,k=0),Math.floor(k+Math.random()*(Y-k))}function wt(k){return k[Tt(k.length)]}function le(k){const Y=new URLSearchParams(window.location.search);return Object.fromEntries(Y.entries())[k]}function Ft(k,Y,c=1,S=[]){const t=[];for(let e=k;e{e>=a&&e<=o&&(v=!0)}),v||t.push(e)}return t}const $t=le("debug"),st={screen:{width:1280,height:720,middleWidth:0,middleHeight:0},debug:!($t=="false"||$t==null),language:"en",snakeTileSize:32,snakeSprites:["CSS3","Godot","HTML5","JS","Lazarus","Pascal","Phaser","React","SASS","VisualBasic"],gamingSprites:["Godot","Phaser"],controllers:{start:{left1:"LEFT",left2:"A",right1:"RIGHT",right2:"D",acceleration1:"UP",acceleration2:"W",back1:"DOWN",back2:"S"},platform:{left1:"LEFT",left2:"A",right1:"RIGHT",right2:"D",jump1:"UP",jump2:"W",down1:"DOWN",down2:"S",shoot:"SPACE"},shootUp:{shoot:"SPACE"},snake:{left1:"LEFT",left2:"A",right1:"RIGHT",right2:"D",up1:"UP",up2:"W",down1:"DOWN",down2:"S",boost1:"SHIFT",boost2:"SPACE"},gaming:{left1:"LEFT",left2:"A",right1:"RIGHT",right2:"D",shoot1:"SPACE",shoot2:"UP",shoot3:"W"}}};st.screen.middleWidth=st.screen.width/2;st.screen.middleHeight=st.screen.height/2;const fe="201flaviosilva",ue="2.3.0",de="My Site",ve="https://201flaviosilva.github.io/",ce="MIT",pe={name:"Fl\xE1vio Silva",email:"flavioandre_ls2001@hotmail.com",url:"https://201flaviosilva.github.io/"},xe="src/index.js",me={clear:"rm -rf build && rm -rf out && rm -rf dist",start:"vite --config vite.config.js",build:"npm run clear && vite build",preview:"vite preview",bump:"npm run build && np --any-branch --no-tests --no-publish --no-yarn"},ge={"201flaviosilva-utils":"^1.2.9",phaser:"^3.55.2"},ye={np:"^7.6.2",vite:"^3.1.3"},Te=[],Se={type:"git",url:"git+https://github.com/201flaviosilva/201flaviosilva.github.io"},Ee={url:"https://github.com/201flaviosilva/201flaviosilva.github.io/issues"},zt={name:fe,version:ue,description:de,homepage:ve,private:!1,license:ce,author:pe,main:xe,scripts:me,dependencies:ge,devDependencies:ye,keywords:Te,repository:Se,bugs:Ee},St="'Press Start 2P'",bt={text:"#ffffff",background:["#ffffff","#0000ff","#00ff00","#ff0000","#000000"]},gt={white:"#ffffff",black:"#000000",green:"#00dd00",platformBackground:"#E2F7FE"},ct={base:{fontFamily:St,fontSize:20,fill:gt.white,stroke:gt.black,strokeThickness:1,boundsAlignH:"center",boundsAlignV:"middle",align:"center",shadow:{offsetX:2,offsetY:2,color:gt.green,blur:2,fill:!0}},home:{menu:{normal:{fontFamily:St,fontSize:40,fill:gt.green,stroke:gt.white,strokeThickness:2,shadow:{fill:!1}},over:{fontFamily:St,fontSize:60,fill:gt.white,stroke:gt.black,strokeThickness:2,shadow:{offsetX:0,offsetY:0,color:gt.green,blur:20,fill:!0}}}},web:{scoreLabel:{fontFamily:St,fontSize:"32px",align:"center",color:"#ffff00"},updateScoreLabel:{fontFamily:St,fontSize:"16px",align:"center"}},loading:{keys:{fontFamily:St,fontSize:20,fill:gt.platformBackground}},snake:{scoreLabel:{fontFamily:St,fontSize:"32px",align:"center",color:"#ffff00"},updateScoreLabel:{fontFamily:St,fontSize:"16px",align:"center"}},start:{},objects:{signals:{fontFamily:St,fontSize:16,fill:"#633E25",stroke:gt.black,strokeThickness:1}},components:{animateTitle:{fontFamily:St,fontSize:80,fill:gt.platformBackground,stroke:"#B5F1DB",strokeThickness:2,shadow:{offsetX:0,offsetY:0,color:gt.black,blur:20,fill:!0}},progressBar:{fontFamily:St,fontSize:60,fill:gt.white,stroke:gt.black,strokeThickness:2}}};class Ce extends Phaser.GameObjects.Graphics{constructor(Y,c){super(Y,c),Y.add.existing(this),this.drawProgress()}drawProgress(){const{width:Y,height:c,middleWidth:S,middleHeight:t}=st.screen;this.percentText=this.scene.add.text(S,t,"0%",ct.components.progressBar).setOrigin(.5)}updateBar(Y){var c;this.percentText.setText("Load: "+Math.round(Y*100)+"% - "+((c=this==null?void 0:this.lastFileLoad)==null?void 0:c.key))}fileLoad(Y){this.lastFileLoad=Y}complete(){this.percentText.destroy()}}const Pe=""+new URL("Idle.4557b68b.png",import.meta.url).href,Ae=""+new URL("Jump.60498867.png",import.meta.url).href,Me=""+new URL("Walk.5aefb0de.png",import.meta.url).href,Re=""+new URL("PlayerShip.c26aa63e.png",import.meta.url).href,Le=""+new URL("CSS3.e5e24a5a.png",import.meta.url).href,Fe=""+new URL("Godot.fd814eaa.png",import.meta.url).href,Oe=""+new URL("HTML5.5d068b98.png",import.meta.url).href,De=""+new URL("JS.6adfab57.png",import.meta.url).href,Ie=""+new URL("Lazarus.c44c4aff.png",import.meta.url).href,Be=""+new URL("Pascal.3a954956.png",import.meta.url).href,Ge=""+new URL("PascalZim.ed88704b.png",import.meta.url).href,Ne=""+new URL("Phaser.4755ab88.png",import.meta.url).href,Ue=""+new URL("React.9950d6d3.png",import.meta.url).href,Ye=""+new URL("SASS.686c8acb.png",import.meta.url).href,Xe=""+new URL("VisualBasic.8d78be69.png",import.meta.url).href,ze=""+new URL("Langs.6877f758.png",import.meta.url).href,Ve=""+new URL("Comando.1a60fb55.png",import.meta.url).href,We=""+new URL("Web.a9af801e.png",import.meta.url).href,we=""+new URL("Duke.491ab32c.png",import.meta.url).href,He=""+new URL("DukeLeft.cf6b882c.png",import.meta.url).href,Ke=""+new URL("Sprite.039e8988.png",import.meta.url).href,Ze=""+new URL("Quadrados.1448b9a2.png",import.meta.url).href,Je=""+new URL("Bush1.61a9ade8.png",import.meta.url).href,Qe=""+new URL("Bush2.b91f0d4a.png",import.meta.url).href,$e=""+new URL("Bush3.769e57fd.png",import.meta.url).href,be=""+new URL("Bush4.6b8c9561.png",import.meta.url).href,je=""+new URL("Cactus.af590a77.png",import.meta.url).href,ke=""+new URL("Castle.0d68cbf5.png",import.meta.url).href,qe=""+new URL("Crate.331b8fbe.png",import.meta.url).href,_e=""+new URL("Mushroom1.756eb050.png",import.meta.url).href,ti=""+new URL("Mushroom2.d03b1fc5.png",import.meta.url).href,ei=""+new URL("SignDirection.adc35fa9.png",import.meta.url).href,ii=""+new URL("Stone.86c3b22a.png",import.meta.url).href,si=""+new URL("Tree1.f3fb6d56.png",import.meta.url).href,ni=""+new URL("Tree2.93299d58.png",import.meta.url).href,ri=""+new URL("Tree3.a3752cc4.png",import.meta.url).href,ai=""+new URL("BG.0d582107.png",import.meta.url).href,oi=""+new URL("Tiles.3118134d.png",import.meta.url).href,hi=""+new URL("SkyTiles.ee0dab4b.png",import.meta.url).href,li=""+new URL("StarsBackground.7746b825.png",import.meta.url).href,fi=""+new URL("Button.adffc2c3.png",import.meta.url).href,ui=""+new URL("Flags.10196374.png",import.meta.url).href,di=""+new URL("FullScreen.6b974e40.png",import.meta.url).href,vi=""+new URL("Sound.faa6c50a.png",import.meta.url).href,ci=""+new URL("Settings.87927cef.png",import.meta.url).href,pi=""+new URL("ArrowKey.d875e655.png",import.meta.url).href,xi=""+new URL("SpaceKey.66573d69.png",import.meta.url).href;class mi extends Phaser.Scene{constructor(){super({key:"Preload"})}preload(){const Y=new Ce(this);this.importSprites(),this.importUI(),this.importSounds(),this.load.on("progress",c=>Y.updateBar(c)),this.load.on("fileprogress",c=>Y.fileLoad(c)),this.load.on("complete",()=>{Y.complete()})}importSprites(){this.load.spritesheet("PlayerIdle",Pe,{frameWidth:38,frameHeight:44}),this.load.spritesheet("PlayerJump",Ae,{frameWidth:38,frameHeight:44}),this.load.spritesheet("PlayerWalk",Me,{frameWidth:38,frameHeight:46}),this.load.image("PlayerShip",Re),this.load.image("CSS3",Le),this.load.image("Godot",Fe),this.load.image("HTML5",Oe),this.load.image("JS",De),this.load.image("Lazarus",Ie),this.load.image("Pascal",Be),this.load.image("PascalZim",Ge),this.load.image("Phaser",Ne),this.load.image("React",Ue),this.load.image("SASS",Ye),this.load.image("VisualBasic",Xe),this.load.image("LangsSheet",ze),this.load.image("Comando",Ve),this.load.image("Web",We),this.load.image("Duke",we),this.load.image("DukeLeft",He),this.load.image("Sprite",Ke),this.load.spritesheet("SquaresParticles",Ze,{frameWidth:32,frameHeight:32}),this.load.image("Bush1",Je),this.load.image("Bush2",Qe),this.load.image("Bush3",$e),this.load.image("Bush4",be),this.load.image("Cactus",je),this.load.image("Castle",ke),this.load.image("Crate",qe),this.load.image("Mushroom1",_e),this.load.image("Mushroom2",ti),this.load.image("SignDirection",ei),this.load.image("Stone",ii),this.load.image("Tree1",si),this.load.image("Tree2",ni),this.load.image("Tree3",ri),this.load.image("BackgroundForest",ai),this.load.spritesheet("Tiles",oi,{frameWidth:128,frameHeight:128}),this.load.spritesheet("SkyTiles",hi,{frameWidth:128,frameHeight:93})}importUI(){this.load.image("StarsBackground",li),this.load.spritesheet("Button",fi,{frameWidth:250,frameHeight:80}),this.load.spritesheet("Flags",ui,{frameWidth:32,frameHeight:32}),this.load.spritesheet("FullScreen",di,{frameWidth:32,frameHeight:32}),this.load.spritesheet("Sound",vi,{frameWidth:32,frameHeight:32}),this.load.spritesheet("Settings",ci,{frameWidth:32,frameHeight:32}),this.load.spritesheet("ArrowKey",pi,{frameWidth:64,frameHeight:64}),this.load.spritesheet("SpaceKey",xi,{frameWidth:128,frameHeight:32})}importSounds(){}create(){st.debug?this.scene.start("Start"):this.scene.start("Index")}}class Ht extends Phaser.GameObjects.TileSprite{constructor(Y,c=-15e3,S=100,t=1e-5){const{middleWidth:e,middleHeight:v,width:a,height:o}=st.screen;super(Y,e,v,a*2,o*2,"StarsBackground"),Y.add.existing(this),this.bgPosition=.1,this.xSpeed=c,this.ySpeed=S,this.rotationSpeed=t,this.setAlpha(.75),this.setDepth(-1),Y.add.particles("SquaresParticles").createEmitter({frame:Ft(0,9),x:Y.scale.width,y:{min:0,max:Y.scale.height},lifespan:1e4,speedX:{min:-600,max:-100},scale:{min:.2,max:.05},alpha:{start:1,end:.5},quantity:1})}preUpdate(){this.tilePositionX=Math.cos(this.bgPosition)*this.xSpeed,this.tilePositionY=Math.sin(this.bgPosition)*this.ySpeed,this.rotation+=this.rotationSpeed,this.bgPosition+=5e-4}}class gi extends Phaser.Scene{constructor(){super({key:"Index"}),this.isMobile=!1}init(){const{android:Y,iOS:c,iPad:S,iPhone:t,windowsPhone:e}=this.sys.game.device.os;this.isMobile=Y||c||S||t||e,this.isMobile&&this.pushNotification("This game is currently not available on mobile devices. Please click on PDF button.")}create(){const{middleWidth:Y,middleHeight:c}=st.screen,S=36;new Ht(this),this.createText({x:Y,y:c-S,text:"Start",action:()=>{this.isMobile?this.pushNotification("Sorry, the current version of the game do not work on mobile :/"):this.scene.start("Start")}}),this.createText({x:Y,y:c+S,text:"PDF",action:()=>this.openPDF()})}openPDF(){const Y="https://github.com/201flaviosilva/201flaviosilva.github.io/releases?q=PDF&expanded=true",c=window.open(Y,"_blank");c&&c.focus?c.focus():c||(window.location.href=Y)}createText(Y){const{x:c,y:S,text:t,action:e}=Y,v=this.add.text(c,S,t,ct.home.menu.normal).setOrigin(.5).setInteractive({useHandCursor:!0});v.on("pointerover",()=>v.setStyle(ct.home.menu.over)),v.on("pointerout",()=>v.setStyle(ct.home.menu.normal)),v.on("pointerup",e)}pushNotification(Y){he({text:Y,animated:!0,animationTime:5,closeButton:!0,endPosition:100,style:{border:"1px solid #00dd00",boxShadow:"0 0 10px #058005, 0 0 50px #058005",background:"#023b02"},textStyle:{color:"#ff0000",boxShadow:"0 0 10px #023b02, 0 0 50px #023b02"}})}}class Kt extends Phaser.GameObjects.Text{constructor(Y,c,S,t){const e=" "+t+" ";super(Y,c,S,e,ct.components.animateTitle),this.setOrigin(.5),Y.add.existing(this),this.animation()}animation(){const{middleHeight:Y}=st.screen;this.scene.tweens.add({targets:this,ease:"Bounce",duration:1500,y:{from:Y,to:100},scale:{from:4,to:.9},alpha:{from:.5,to:1}})}}const yi={options:"Op\xE7\xF5es",start:"Come\xE7ar",moveRotate:"Movimenta\xE7\xE3o/Rota\xE7\xE3o",exit:"Sair",restart:"Recome\xE7ar"},Ti={options:"Options",start:"Start",moveRotate:"Move/Rotate",exit:"Exit",restart:"Restart"};class Bt{constructor(){if(Bt.instance instanceof Bt)return Bt.instance;this.selectedLang=st.language,Bt.instance=this}toggle(){this.selectedLang=this.selectedLang==="en"?"pt":"en"}getText(Y){return this.selectedLang==="en"?Ti[Y]:yi[Y]}}const Et=new Bt;class Si extends Phaser.GameObjects.Container{constructor(Y,c,S,t){super(Y,c,S),Y.add.existing(this),this.switchScene(t);const e=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE);e.removeAllListeners(),e.on("down",()=>{this.destroy()},this),this.scene.tweens.add({targets:[this],alpha:{from:1,to:0},duration:1e4,ease:"Circ.easeIn",onComplete:()=>{this.destroy()}})}switchScene(Y){switch(Y){case"Start":{this.startUI();break}case"Pascal":{this.platformUI();break}}}startUI(){const Y={width:300,height:200},c=this.scene.add.graphics();c.clear(),c.fillStyle(0,.25),c.fillRoundedRect(0,0,Y.width,Y.height,10),this.add(c);const S=Y.width/2,t=Y.height/2,e=40,v=this.scene.add.text(S,t-90,Et.getText("moveRotate"),ct.loading.keys).setOrigin(.5);this.add(v),this.addKeyExample(S,t-e,"ArrowKey","UP"),this.addKeyExample(S,t+e,"ArrowKey","DOWN").setFlipY(!0),this.addKeyExample(S+e*2,t+e,"ArrowKey","RIGHT",90),this.addKeyExample(S-e*2,t+e,"ArrowKey","LEFT",-90)}platformUI(){const Y={width:300,height:250},c=this.scene.add.graphics();c.clear(),c.fillStyle(0,.25),c.fillRoundedRect(0,0,Y.width,Y.height,10),this.add(c);const S=Y.width/2,t=Y.height/2,e=40,v=this.scene.add.text(S,t-95,"Move",ct.loading.keys).setOrigin(.5);this.add(v),this.addKeyExample(S,t-e,"ArrowKey","UP"),this.addKeyExample(S,t+e,"ArrowKey","DOWN").setFlipY(!0),this.addKeyExample(S+e*2,t+e,"ArrowKey","RIGHT",90),this.addKeyExample(S-e*2,t+e,"ArrowKey","LEFT",-90),this.addKeyExample(S,t+e*2.5,"SpaceKey","SPACE",0,"Shoot").setScale(2,1)}addKeyExample(Y=0,c=0,S="ArrowKey",t="UP",e=0,v=""){const a=this.scene.add.image(Y,c,S,0).setAngle(e),o=this.scene.input.keyboard.addKey(t);if(o.on("down",()=>{a.setFrame(1)},this),o.on("up",()=>{a.setFrame(0)},this),this.add(a),v){const r=this.scene.add.text(Y,c,v,ct.loading.keys).setOrigin(.5);this.add(r)}return a}}class Ei extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){super(Y,c,S,"DukeLeft"),this.keys=this.scene.input.keyboard.addKeys(st.controllers.start),this.accelerationSpeed=300,this.rotationSpeed=100}update(){if(!this.keys)return;const Y=this.keys;Y.right1.isDown||Y.right2.isDown?this.setAngularVelocity(this.rotationSpeed):Y.left1.isDown||Y.left2.isDown?this.setAngularVelocity(-this.rotationSpeed):this.setAngularVelocity(0),Y.acceleration1.isDown||Y.acceleration2.isDown?this.scene.physics.velocityFromRotation(this.rotation,this.accelerationSpeed,this.body.velocity):Y.back1.isDown||Y.back2.isDown?this.scene.physics.velocityFromRotation(this.rotation,-this.accelerationSpeed,this.body.velocity):this.setVelocity(0)}}class Ci extends Phaser.Scene{constructor(){super({key:"Start"})}create(){const{width:Y,height:c,middleWidth:S,middleHeight:t}=st.screen;this.input.keyboard.removeAllListeners(),new Ht(this),new Kt(this,S,100,"201flaviosilva");const e=this.physics.add.group({classType:Ei,runChildUpdate:!0,collideWorldBounds:!0});this.player=e.get(S,t);{const v=this.physics.add.image(10,10,"Settings",1).setOrigin(0);this.physics.add.collider(this.player,v,()=>{this.scene.start("Options")})}{const v=this.physics.add.image(S-350,t-100,"PascalZim").setScale(2);this.physics.add.collider(this.player,v,()=>{this.scene.start("Pascal")})}{const v=this.physics.add.image(S-350,t+100,"Web").setScale(4);this.physics.add.collider(this.player,v,()=>{this.scene.start("Web")})}{this.snakeAll=this.add.tileSprite(S+350,t-100,64,32,"LangsSheet").setScale(3);const a=this.add.zone(S+350,t-100,64*3,32*3);this.physics.world.enable(a),this.physics.add.collider(this.player,a,()=>{this.scene.start("SnakeAll")})}{const v=this.physics.add.image(S+350,t+100,"Comando").setScale(6);this.physics.add.collider(this.player,v,()=>{this.scene.start("Gaming")})}new Si(this,S-75,c-120,"Start").setScale(.5)}update(Y,c){this.snakeAll.tilePositionX+=.025*c}}class Pi extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){super(Y,c,S)}generate(Y){const{x:c,y:S,image:t,text:e,style:v,startFrame:a,actionCallback:o}=Y;this.realX=c,this.actionCallback=o,this.setPosition(c,S),this.setTexture(t),this.setFrame(a||0),this.body.setSize(0,0,this.frame.width,this.frame.height),this.label=this.scene.add.text(c,S,e,v).setOrigin(.5),this.setInteractive({useHandCursor:!0}),this.on("pointerup",()=>this.action(o),this)}changeFrame(Y=!1){this.setFrame(this.frame.name===1?0:1),Y&&setTimeout(()=>this.changeFrame(),1e3)}changeVisible(Y=!0){this.setVisible(Y),this.label.setVisible(Y),this.setX(Y?this.realX:-this.width)}action(Y){console.log("Acting..."),Y(),this.changeFrame(),this.changeVisible()}update(){this.body.touching.down&&(this.action(this.actionCallback),this.body.touching.down=!1)}}class Ai extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t){super(Y,c,S,t),this.sprite=t,this.degreeNum=0,this.liveTime=0}generate(Y){this.setBounce(.5),Y?this.setVelocityX(-300):this.setVelocityX(300)}update(Y){this.liveTime||(this.liveTime=Y),this.sprite=="Lazarus"&&(this.degreeNum+=2,this.setAngle(this.degreeNum)),Y>this.liveTime+3e3&&this.destroy()}}class _t extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){super(Y,c,S,"PlayerIdle"),this.keys=this.scene.input.keyboard.addKeys(st.controllers.platform),this.playerStatus={velocity:200,jumpForce:300,shootType:null,lastShot:0},this.shoots=this.scene.physics.add.group({classType:Ai,runChildUpdate:!0})}createAnimations(){this.scene.anims.create({key:"PlayerIdle",frames:this.scene.anims.generateFrameNumbers("PlayerIdle"),defaultTextureKey:"PlayerIdle",frameRate:2,repeat:-1}),this.scene.anims.create({key:"PlayerJump",frames:this.scene.anims.generateFrameNumbers("PlayerJump"),defaultTextureKey:"PlayerJump",frameRate:4,repeat:-1}),this.scene.anims.create({key:"PlayerWalk",frames:this.scene.anims.generateFrameNumbers("PlayerWalk"),defaultTextureKey:"PlayerWalk",frameRate:4,repeat:-1})}generate(){this.createAnimations(),this.scene.anims.play("PlayerJump",this),this.setZ(10)}update(Y){if(!this.keys)return;const c=this.keys,{velocity:S,jumpForce:t,shootType:e,lastShot:v}=this.playerStatus;if(v||(this.playerStatus.lastShot=Y),c.left1.isDown||c.left2.isDown?(this.setVelocityX(-S),this.setFlipX(!0),this.body.onFloor()&&this.anims.currentAnim.key!=="PlayerWalk"&&this.scene.anims.play("PlayerWalk",this)):c.right1.isDown||c.right2.isDown?(this.setVelocityX(S),this.setFlipX(!1),this.body.onFloor()&&this.anims.currentAnim.key!=="PlayerWalk"&&this.scene.anims.play("PlayerWalk",this)):(this.setVelocityX(0),this.body.onFloor()&&this.anims.currentAnim.key!=="PlayerIdle"&&this.scene.anims.play("PlayerIdle",this)),(c.jump1.isDown||c.jump2.isDown)&&this.body.onFloor()?(this.setVelocityY(-t),this.anims.currentAnim.key!=="PlayerJump"&&this.scene.anims.play("PlayerJump",this)):(c.down1.isDown||c.down2.isDown)&&this.setVelocityY(t),c.shoot.isDown&&e&&v{Et.toggle(),this.scene.restart()}})}{const a=S;this.fullScreenButton=this.optionsGroup.get(a,v),this.fullScreenButton.generate({x:a,y:v,image:"FullScreen",startFrame:Number(!this.scale.isFullscreen),actionCallback:()=>{this.scale.isFullscreen?this.scale.stopFullscreen():this.scale.startFullscreen()}})}{const a=Y*.75;this.soundButton=this.optionsGroup.get(a,e),this.soundButton.generate({x:a,y:e,image:"Sound",startFrame:Number(this.sound.mute),actionCallback:()=>{this.sound.stopAll(),this.sound.setMute(!this.sound.mute)}})}new Kt(this,S,100,Et.getText("options"))}createPlayer(){const{width:Y,height:c,middleWidth:S,middleHeight:t}=st.screen;this.playersGroup=this.physics.add.group({classType:_t,collideWorldBounds:!0,runChildUpdate:!0}),this.player=this.playersGroup.get(S,t),this.player.generate()}createCollision(){this.physics.add.collider(this.tilesGroup,this.player),this.physics.add.collider(this.optionsGroup,this.player)}update(){this.player.x>st.screen.width-this.player.width*.75&&(this.scene.start("Start",{sceneName:"Options"}),this.scene.stop())}}class Gt extends Phaser.GameObjects.Sprite{constructor(Y,c){if(!Y){console.error("Missing scene!");return}c.key=c.key||"Button",c.up||(c.up=0),c.down<0&&(c.down=c.up),c.over<0&&(c.over=c.up),super(Y,0,0,c.key,c.up),Y.add.existing(this),c.x&&this.setPosition(c.x,c.y),this.config=c,c.text&&(this.label=Y.add.text(this.x,this.y,c.text,c.textStyle).setOrigin(.5)),this.setInteractive({useHandCursor:!0}),this.on("pointerdown",this._onDown,this),this.on("pointerup",this._onUp,this),this.on("pointerover",this._onOver,this),this.on("pointerout",this._onOut,this)}changeVisibility(Y=!0){return this.setVisible(Y),this.label&&this.label.setVisible(Y),this}_onDown(){this.setFrame(this.config.down),this.config.downCallback&&this.config.downCallback()}_onOver(){this.setFrame(this.config.over),this.config.overCallback&&this.config.overCallback()}_onUp(){this.setFrame(this.config.up),this.config.upCallback&&this.config.upCallback()}_onOut(){this.setFrame(this.config.up)}kill(){this.label&&this.label.destroy(),this.destroy()}}class Yt extends Phaser.GameObjects.Text{constructor(Y,c=10,S=10,t=0,e={}){super(Y,c,S,t,e),Y.add.existing(this),this.setDepth(1e6)}preUpdate(){this.setText(this.scene.game.loop.actualFps.toFixed(2))}}class Li extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){const t=S||st.screen.middleHeight;super(Y,c,t,"Duke")}generate(){this.setScale(.6),this.setVelocityX(-100),this.setBounce(1.0001,.35)}update(){(this.x<0||this.y<0||this.y>st.screen.height)&&this.destroy()}}class Fi extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){const t=S||st.screen.height-110;super(Y,c,t,"Cactus")}}class Oi extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t){super(Y,c,S,"Crate"),this.setScale(.7),this.powerType=t,this.isAlive=!0}generate(){this.setDepth(9)}update(){this.body.touching.down&&this.isAlive&&(this.isAlive=!1,this.animation())}animation(){this.scene.tweens.add({targets:this,ease:"Linear",duration:150,props:{y:{from:this.y,to:this.y-25},alpha:{value:"0.75",delay:200,duration:50,ease:"Linear"}},yoyo:!0,completeDelay:50,onComplete:()=>{this.setAlpha(.75),this.generatePower()}})}generatePower(){const Y=this.scene.powerShootGroup.get(this.x,this.y,this.powerType);!Y||this.scene.tweens.add({targets:Y,ease:"Linear",duration:250,y:{from:this.y,to:this.y-this.height*2},onComplete:()=>{Y.generate()}})}}class Di extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t){super(Y,c,S,t),Y.add.existing(this),this.powerType=t,this.degreeNum=0,this.liveTime=0}generate(){this.setBounceX(1),this.setVelocityX(150)}update(Y){this.liveTime||(this.liveTime=Y),this.powerType=="Lazarus"&&(this.degreeNum++,this.setAngle(this.degreeNum)),Y>this.liveTime+1e4&&this.destroy()}}class Ii extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t=1){super(Y,c,S,"SkyTiles",t)}changeScale(Y){this.setSize(this.width*Y,this.height*Y),this.setScale(Y)}}const yt=7e3;class Bi extends Phaser.Scene{constructor(){const Y={key:"Pascal",physics:{default:"arcade",arcade:{debug:st.debug,gravity:{x:0,y:200}}}};super(Y)}init(){this.isIsland2DukesCreated=!1,this.isIsland3DukesCreated=!1}create(){this.createWorld(),this.createStartEnemies(),this.createPlayer(),this.createCollision(),st.debug&&this.createDebug(),this.scene.launch("PascalUI")}createDebug(){const Y=this.add.graphics().setDepth(0);Y.lineStyle(1,16711680,1);for(let c=0;c{this.player.playerStatus.shootType=S.powerType,S.destroy()},null,this),this.physics.add.overlap(this.player,this.dukes,()=>this.scene.start("Start"),null,this),this.physics.add.overlap(this.powerShootGroup,this.dukes,(c,S)=>{c.destroy(),S.destroy()},null,this),this.physics.add.overlap(this.player.shoots,this.dukes,(c,S)=>{c.destroy(),S.destroy()},null,this),this.physics.add.overlap(this.castle,this.player,(c,S)=>{Y||(Y=!0,this.player.keys=null,this.player.body.destroy(),this.tweens.add({targets:[this.player],ease:"Linear",duration:500,delay:100,x:{from:this.player.x,to:this.castle.x},y:{from:this.player.y,to:640},scale:{from:this.player.scale,to:.75},alpha:{from:1,to:.75},completeDelay:250,onComplete:()=>this.scene.start("Start")}))},null,this)}update(){this.player.x>3e3&&!this.isIsland2DukesCreated&&this.createDukesIsland2(),this.player.x>4500&&!this.isIsland3DukesCreated&&this.createDukesIsland3()}createDukesIsland2(){this.isIsland2DukesCreated=!0;const Y=this.dukes.get(4e3);Y&&Y.generate();const c=this.dukes.get(4100);c&&c.generate()}createDukesIsland3(){this.isIsland3DukesCreated=!0;const Y=this.dukes.get(5300);Y&&Y.generate();const c=this.dukes.get(5800);c&&c.generate();const S=this.dukes.get(6e3);S&&S.generate();const t=100,e=this.dukes.get(yt-t*6);e&&e.generate();const v=this.dukes.get(yt-t*5);v&&v.generate();const a=this.dukes.get(yt-t*4);a&&a.generate();const o=this.dukes.get(yt-t*3);o&&o.generate();const r=this.dukes.get(yt-t*2);r&&r.generate();const i=this.dukes.get(yt-t*1);i&&i.generate();const s=this.dukes.get(yt);s&&s.generate()}}class Gi extends Phaser.Scene{constructor(){super({key:"PascalUI"})}create(){st.debug&&new Yt(this),this.exitButton=new Gt(this,{x:this.scale.width-50,y:50,up:1,down:0,over:1,text:Et.getText("exit"),upCallback:()=>{this.scene.stop("Pascal"),this.scene.start("Start"),this.scene.stop("PascalUI")}}).setScale(.25)}}const ht={gameOver:"gameOver",restartGame:"restartGame",increaseScore:"increaseScore",updateScore:"updateScore"},lt=new Phaser.Events.EventEmitter;class ee extends Phaser.GameObjects.Text{constructor(Y,c=10,S=10,t=0,e="JS",v=ct.snake.updateScoreLabel){super(Y,c,S,t,v),Y.add.existing(this),this.score=t,this.setDepth(1e3),this.setOrigin(.5),this.setColor("#ff0"),this.particles=Y.add.particles(e),this.particlesEmitter=this.particles.createEmitter({x:c,y:S,quantity:64,frequency:-1,scale:{start:1,end:0},alpha:{start:1,end:0},angle:{start:0,end:360,steps:64},rotate:{start:Tt(-360,360),end:Tt(-360,360)},speed:{min:500,max:750},lifespan:{min:750,max:1e3}}),this.particlesEmitter.explode()}animate({x:Y,y:c}){this.scene.tweens.add({targets:[this],x:Y,y:c,ease:"Linear",duration:1e3,scale:2,onComplete:()=>this.kill()})}kill(){lt.emit(ht.updateScore,this.score),this.particlesEmitter.stop(),this.particles.destroy(),this.destroy()}}const vt={UP:"up",DOWN:"down",LEFT:"left",RIGHT:"right"},Nt=st.snakeTileSize,Vt=150;class Ni{constructor(Y,c,S){this.scene=Y,this.headPosition=new Phaser.Geom.Point(c,S),this.body=new Ui(Y,{classType:ie}),this.head=this.body.create(c,S,"Duke",vt.RIGHT).setScale(.5).setDepth(100),this.tail=new Phaser.Geom.Point(c,S),this.isAlive=!0,this.speed=Vt,this.moveTime=0,this.heading=vt.RIGHT,this.direction=vt.RIGHT,this.keys=Y.input.keyboard.addKeys(st.controllers.snake)}goUp(){this.direction!==vt.DOWN&&(this.heading=vt.UP)}goDown(){this.direction!==vt.UP&&(this.heading=vt.DOWN)}goLeft(){this.direction!==vt.RIGHT&&(this.heading=vt.LEFT)}goRight(){this.direction!==vt.LEFT&&(this.heading=vt.RIGHT)}update(Y){const{isAlive:c,keys:S}=this;if(!c||!S)return;const{left1:t,left2:e,right1:v,right2:a,up1:o,up2:r,down1:i,down2:s,boost1:l,boost2:n}=S;t.isDown||e.isDown?this.goLeft():v.isDown||a.isDown?this.goRight():o.isDown||r.isDown?this.goUp():(i.isDown||s.isDown)&&this.goDown(),l.isDown||n.isDown?this.speed=Vt/2:this.speed=Vt,this.move(Y)}move(Y){if(Y{this.setTint(16711680),this.isWall=!0}})}kill(){this.animation.stop(),this.animation.remove(),this.isAlive=!1,this.destroy()}}const kt=st.snakeSprites;class Xi extends Phaser.Scene{constructor(){const Y={key:"SnakeAll",cameras:{x:0,y:8,width:1280,height:704}};super(Y)}init(){const{width:Y,height:c}=this.cameras.main;this.MAX_WIDTH=Math.floor(Y/st.snakeTileSize)-1,this.MAX_HEIGHT=Math.floor(c/st.snakeTileSize)-1,this.isAlive=!0}create(){this.scene.launch("SnakeAllUI");{const{width:Y,height:c}=this.cameras.main,S=8,t=this.add.graphics();t.fillStyle(65280),t.fillRect(S,S,Y-S*2,c-S*2)}this.player=new Ni(this,8,8),this.apples=[],this.newAppleTimer=this.time.addEvent({delay:500,callback:this.newApple,callbackScope:this,loop:!0}),lt.removeListener(ht.gameOver),lt.on(ht.gameOver,Y=>{this.isAlive=!1,this.player.isAlive=!1,this.newAppleTimer.paused=!0,this.tweens.pauseAll()}),lt.removeListener(ht.restartGame),lt.on(ht.restartGame,Y=>{this.scene.restart()})}newApple(){const{snakeTileSize:Y}=st,c=Phaser.Math.Between(1,this.MAX_WIDTH),S=Phaser.Math.Between(1,this.MAX_HEIGHT);if(this.apples.find(e=>e.x===c*Y&&e.y===S*Y)||this.player.body.getChildren().find(e=>e.x===c*Y&&e.y===S*Y))return;const t=new Yi(this,c,S,kt[Phaser.Math.Between(0,kt.length-1)]);this.apples.push(t)}update(Y){!this.isAlive||(this.player.update(Y),this.apples.forEach(c=>{if(this.player.head.x===c.x&&this.player.head.y===c.y&&c.isAlive){if(c.isWall){lt.emit(ht.gameOver),c.setDepth(1e5);return}this.player.grow(c.spriteName),c.kill(),lt.emit(ht.increaseScore,1,c,c.spriteName)}}))}}class zi extends Phaser.Scene{constructor(){super({key:"SnakeAllUI"})}init(){this.score=0}create(){st.debug&&new Yt(this),this.scoreLabel=this.add.text(this.scale.width/2,50,this.score,ct.snake.scoreLabel).setOrigin(.5),this.exitButton=new Gt(this,{x:this.scale.width-50,y:50,up:1,down:0,over:1,text:Et.getText("exit"),upCallback:()=>{this.scene.stop("SnakeAll"),this.scene.start("Start"),this.scene.stop("SnakeAllUI")}}).setScale(.25),this.restartButton=new Gt(this,{x:this.scale.width/2,y:this.scale.height/2,up:1,down:0,over:1,text:Et.getText("restart"),textStyle:ct.base,upCallback:()=>{lt.emit(ht.restartGame)}}).changeVisibility(!1);const Y=this.add.particles("SquaresParticles");this.scoreParticles=Y.createEmitter({frame:Ft(0,9),x:this.scoreLabel.x,y:this.scoreLabel.y,quantity:64,frequency:-1,scale:{start:.75,end:0},alpha:{start:.75,end:0},angle:{start:0,end:360,steps:64},rotate:{start:Tt(-360,360),end:Tt(-360,360)},speed:{min:500,max:750},lifespan:1e3}),lt.on(ht.gameOver,c=>this.restartButton.changeVisibility(!0)),lt.removeListener(ht.increaseScore),lt.on(ht.increaseScore,this.createNewScoreLabel.bind(this)),lt.removeListener(ht.updateScore),lt.on(ht.updateScore,c=>{this.scoreParticles.explode(),this.score+=c,this.scoreLabel.setText(this.score)})}createNewScoreLabel(Y,{x:c,y:S},t){new ee(this,c,S,Y,t).animate(this.scoreLabel)}}function Vi(k,Y,c=0,S=0){const t=k.add.particles("PlayerShip"),e=k.add.particles("SquaresParticles"),v=e.createEmitter({x:0,y:0,frame:Ft(0,9),quantity:1,frequency:-1,scale:{start:.5,end:0},alpha:{start:.5,end:0},speed:{min:50,max:150},rotate:{start:0,end:360},lifespan:{min:250,max:500}}),a=t.createEmitter({follow:Y,quantity:64,frequency:-1,scale:{start:.75,end:0},alpha:{start:.75,end:0},angle:{start:0,end:360,steps:64},rotate:{start:Tt(-360,360),end:Tt(-360,360)},speed:{min:500,max:750},lifespan:500}),o=t.createEmitter({follow:Y,quantity:1,speedX:{min:-500,max:-250},speedY:{min:-250,max:250},scale:{start:.75,end:0},alpha:{start:.5,end:0},rotate:{start:0,end:360},lifespan:{min:100,max:500}}),r={follow:Y,moveToX:0,alpha:{start:.5,end:.25},deathCallback:({x:l,y:n})=>{v.setPosition(l,n),v.explode()}},i=e.createEmitter({...r,frame:Ft(0,9),moveToY:{min:k.scale.height/2-150,max:k.scale.height/2+150},scale:{start:.4,end:.25},quantity:4}),s=e.createEmitter({...r,frame:[3],moveToY:k.scale.height/2,scale:.4,quantity:1});return{explosionEmitter1:v,hittedEmitter:a,moveEmitter1:o,moveEmitter2A:i,moveEmitter2B:s}}function Wi(k,Y,c,S=0,t=0){const e=k.add.particles(c),v=e.createEmitter({x:S,y:t,follow:Y,quantity:1,speedX:{min:-500,max:-250},speedY:{min:-250,max:250},scale:{start:.33,end:0},alpha:{start:.5,end:0},rotate:{start:0,end:360},lifespan:{min:100,max:500}}),a=k.add.particles(c),o=a.createEmitter({x:S,y:t,follow:Y,quantity:100,frequency:-1,scale:{start:.75,end:0},alpha:{start:.75,end:0},speed:{min:50,max:150},rotate:{start:0,end:360},lifespan:{min:250,max:750}});return{moveParticles:e,moveParticlesEmitter:v,explosionParticles:a,explosionParticlesEmitter:o}}function wi(k,Y,c=0,S=0){const t=k.add.particles("Duke"),e=t.createEmitter({x:c,y:S,follow:Y,quantity:1,frequency:100,speedX:{min:500,max:250},speedY:{min:250,max:-250},scale:{start:.5,end:0},alpha:{start:.5,end:0},rotate:{start:-90,end:Tt(-360,360)},lifespan:{min:100,max:500}}),v=t.createEmitter({x:c,y:S,follow:Y,quantity:32,frequency:-1,scale:{start:.75,end:0},alpha:{start:.75,end:0},angle:{start:0,end:360,steps:32},rotate:{start:-90,end:270},tint:16711680,speed:200,lifespan:500});return{particles:t,particlesEmitter:e,deadParticlesEmitter:v}}class Hi extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t){super(Y,c,S,t),Y.physics.add.existing(this),this.speed=400,this.setPosition(c,S),this.setDepth(1),this.initialAnimation=Y.tweens.add({targets:this,ease:"Power4",duration:500,scale:{from:1,to:.5},onUpdate:()=>this.refreshBody()});const{moveParticles:e,moveParticlesEmitter:v,explosionParticles:a,explosionParticlesEmitter:o}=Wi(Y,this,t,c,S);this.moveParticles=e,this.moveParticlesEmitter=v,this.explosionParticles=a,this.explosionParticlesEmitter=o,this.explosionParticlesEmitter.explode(),this.killTimer=Y.time.addEvent({delay:500,callback:()=>{this.explosionParticlesEmitter.stop(),this.explosionParticles.destroy(),this.killTimer.remove(),this.destroy()},callbackScope:this,loop:!1,repeat:0,paused:!0})}particlesExplode(){this.explosionParticlesEmitter.explode()}preUpdate(){this.scene.scale.widththis.refreshBody(),onComplete:()=>{this.setTint(16777215),this.moveEmitter1.setTint(16777215),this.moveEmitter2A.start(),this.moveEmitter2B.start()}}),this.keys=Y.input.keyboard.addKeys(st.controllers.shootUp),Y.input.on("pointermove",({x:o,y:r})=>this.setPosition(o,r)),Y.input.on("pointerdown",this.fire,this)}hitted(){this.setTint(16711680),this.moveEmitter1.setTint(16711680),this.particlesExplode(),this.moveEmitter2A.stop(),this.moveEmitter2B.stop(),this.hittedTween.isPlaying()?this.hittedTween.restart():this.hittedTween.play()}particlesExplode(){for(let Y=0;Y<5;Y++)this.hittedEmitter.explode()}update(Y){if(this.time=Y,!this.keys)return;this.keys.shoot.isDown&&Y>this.timeNextFire&&this.fire()}fire(){const Y=wt(Zi);this.shootGroup.getNewShoot(this.x,this.y,Y)&&(this.timeNextFire=this.time+this.marginShoots)}}class Qi extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){super(Y,c,S,"Duke"),this.shootDelay=Phaser.Math.Between(1e3,1e4),this.setDepth(1),this.setAngle(-90),this.setScale(.75),this.shootTimer=Y.time.addEvent({delay:this.shootDelay,callback:this.fire,callbackScope:this,loop:!0});const{particles:t,particlesEmitter:e,deadParticlesEmitter:v}=wi(Y,this);this.particles=t,this.particlesEmitter=e,this.deadParticlesEmitter=v}fire(){const Y=this.scene.enemiesShootsGroup.getNewShoot(this.x,this.y);Y&&Y.setVelocityX(-400)}kill(){this.setTint(16711680),this.setVisible(!1),this.disableBody(),this.shootTimer.paused=!0,this.shootTimer.remove(),this.particlesEmitter.stop(),this.deadParticlesEmitter.explode();const Y=this.scene.time.addEvent({delay:500,callback:()=>{this.deadParticlesEmitter.stop(),this.particles.destroy(),Y.remove(),this.destroy()},callbackScope:this,loop:!1,repeat:0})}preUpdate(){-this.width>this.x&&this.kill()}}class $i extends Phaser.Physics.Arcade.Group{constructor(Y,c){const S={classType:Qi,runChildUpdate:!0};super(Y,c,S)}getNewEnemy(Y=0,c=0){const S=this.get(Y,c);if(S)return S.setVelocityX(-Phaser.Math.Between(50,250)),S}}class bi extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){super(Y,c,S,"Duke"),Y.physics.add.existing(this),this.speed=400,this.setDepth(1),this.setAngle(-90),this.setScale(.25)}preUpdate(){-this.width>this.x&&this.kill()}kill(){this.destroy()}}class ji extends Phaser.Physics.Arcade.Group{constructor(Y,c){const S={classType:bi,runChildUpdate:!0};super(Y,c,S)}getNewShoot(Y=0,c=0){const S=this.get(Y,c);if(S)return S.setVelocityX(-400),S}}const Dt={updateScore:"updateScore",scoreCollision:"scoreCollision"},It=new Phaser.Events.EventEmitter;class ki extends Phaser.Scene{constructor(){const Y={key:"Web"};super(Y)}create(){new Ht(this),this.scene.launch("WebUI"),this.createPlayer(),this.enemiesGroup=new $i(this.physics.world,this),this.enemiesShootsGroup=new ji(this.physics.world,this),this.enemiesTimer=this.time.addEvent({delay:500,callback:this.createEnemies,callbackScope:this,loop:!0}),this.physics.add.overlap(this.player,this.enemiesGroup,(Y,c)=>{Y.hitted(),c.kill(),It.emit(Dt.scoreCollision,-1,{x:c.x,y:c.y})}),this.physics.add.overlap(this.player,this.enemiesShootsGroup,(Y,c)=>{Y.hitted(),c.kill(),It.emit(Dt.scoreCollision,-1,{x:c.x,y:c.y})}),this.physics.add.overlap(this.player.shootGroup,this.enemiesGroup,(Y,c)=>{Y.kill(),c.kill(),It.emit(Dt.scoreCollision,10,{x:Y.x,y:Y.y})}),this.physics.add.overlap(this.player.shootGroup,this.enemiesShootsGroup,(Y,c)=>{Y.particlesExplode(),c.kill(),It.emit(Dt.scoreCollision,100,{x:Y.x,y:Y.y})})}createPlayer(){const{width:Y,height:c,middleWidth:S,middleHeight:t}=st.screen;this.playersGroup=this.physics.add.group({classType:Ji,runChildUpdate:!0,collideWorldBounds:!0}),this.player=this.playersGroup.get(S,t)}createEnemies(){const Y=this.scale.width+50,c=Phaser.Math.Between(50,this.scale.height-50);this.enemiesGroup.getNewEnemy(Y,c)}}class qi extends Phaser.Scene{constructor(){super({key:"WebUI"})}init(){this.score=0}create(){st.debug&&new Yt(this),this.scoreLabel=this.add.text(this.scale.width/2,50,this.score,ct.web.scoreLabel).setOrigin(.5),this.exitButton=new Gt(this,{x:this.scale.width-50,y:50,up:1,down:0,over:1,text:Et.getText("exit"),upCallback:()=>{this.scene.stop("Web"),this.scene.start("Start"),this.scene.stop("WebUI")}}).setScale(.25);const Y=this.add.particles("SquaresParticles");this.scoreParticles=Y.createEmitter({frame:Ft(0,9),x:this.scoreLabel.x,y:this.scoreLabel.y,quantity:64,frequency:-1,scale:{start:.75,end:0},alpha:{start:.75,end:0},angle:{start:0,end:360,steps:64},rotate:{start:Tt(-360,360),end:Tt(-360,360)},speed:{min:500,max:750},lifespan:1e3}),It.on(Dt.scoreCollision,(c,{x:S,y:t})=>{new _i(this,S,t,c).animate(this.scoreLabel)}),It.on(Dt.updateScore,(c,S)=>{this.scoreParticles.explode(),this.score+=c,this.scoreLabel.setText(this.score),this.scoreLabel.setColor(S)})}}class _i extends Phaser.GameObjects.Text{constructor(Y,c=10,S=10,t=0,e=ct.web.updateScoreLabel){super(Y,c,S,t,e),Y.add.existing(this),this.score=t,this.setDepth(1e3),this.setOrigin(.5),this.setColor(t>0?"#0f0":"#f00")}animate({x:Y,y:c}){this.scene.tweens.add({targets:[this],duration:1e3,ease:"Linear",x:Y,y:c,scale:2,onComplete:()=>this.kill()})}kill(){It.emit(Dt.updateScore,this.score,this.style.color),this.destroy()}}function ts(k,Y){const c=k.add.particles("SquaresParticles"),S=c.createEmitter({x:0,y:0,frame:Ft(0,9),quantity:50,frequency:-1,scale:{start:1,end:0},alpha:{start:1,end:0},speed:{min:50,max:150},rotate:{start:0,end:360},lifespan:1e3}),t=c.createEmitter({follow:Y,frame:Ft(0,9),quantity:1,speedX:{min:-100,max:100},speedY:{min:-20,max:20},scale:{start:.5,end:0},alpha:{start:.5,end:0},rotate:{min:-360,max:360},lifespan:{min:100,max:500}});return{SQUARES_PARTICLES:c,explosionEmitter:S,moveEmitter:t}}function es(k,Y,c,S=0,t=0){const e=k.add.particles(c),v=e.createEmitter({x:S,y:t,follow:Y,quantity:1,speedX:{min:-100,max:100},speedY:{min:100,max:250},scale:{start:.5,end:0},alpha:{start:.5,end:0},lifespan:{min:100,max:500}});return{moveParticles:e,moveParticlesEmitter:v}}class is extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t){super(Y,c,S,t),Y.physics.add.existing(this),t==="Phaser"&&this.setAngle(-90),this.type=t,this.speed=-400,this.setDepth(1);const{moveParticles:e,moveParticlesEmitter:v}=es(Y,this,t,c,S);this.moveParticles=e,this.moveParticlesEmitter=v}preUpdate(){0>this.y&&this.kill()}kill(){this.moveParticlesEmitter.stop(),this.moveParticles.destroy(),this.destroy()}}class ss extends Phaser.Physics.Arcade.Group{constructor(Y,c){const S={classType:is,runChildUpdate:!0};super(Y,c,S),this.lastIndex=0}getNewShoot(Y=0,c=0){const S=ns(st.gamingSprites,this.lastIndex);this.lastIndex=S.index;const t=this.get(Y,c,S.element);return t.setVelocityY(t.speed),t}}function ns(k,Y=0){return k.length===Y+1?{element:k[0],index:0}:{element:k[Y+1],index:Y+1}}class rs extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){super(Y,c,S,"Duke"),this.timeNextFire=0,this.marginShoots=100,this.speed=300,this.setDepth(10),this.setScale(.75),this.isAlive=!0,this.shootGroup=new ss(Y.physics.world,Y);const{SQUARES_PARTICLES:t,explosionEmitter:e,moveEmitter:v}=ts(Y,this);this.particles=t,this.explosionEmitter=e,this.moveEmitter=v,this.keys=Y.input.keyboard.addKeys(st.controllers.gaming)}update(Y){if(!this.keys||!this.isAlive)return;const{left1:c,left2:S,right1:t,right2:e,shoot1:v,shoot2:a,shoot3:o}=this.keys;c.isDown||S.isDown?this.setVelocityX(-this.speed):t.isDown||e.isDown?this.setVelocityX(this.speed):this.setVelocityX(0),(v.isDown||a.isDown||o.isDown)&&Y>this.timeNextFire&&this.fire(Y)}fire(Y){const c=wt(st.gamingSprites);this.shootGroup.getNewShoot(this.x,this.y,c)&&(this.timeNextFire=Y+this.marginShoots)}hitted(){this.isAlive=!1,this.setTint(16711680),this.explosionEmitter.setPosition(this.x,this.y),this.explosionEmitter.explode(),this.moveEmitter.stop()}}class as extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t){super(Y,c,S,t),this.type=t}kill(){this.destroy()}}class os extends Phaser.Physics.Arcade.Group{constructor(Y,c){const S={classType:as,runChildUpdate:!0};super(Y,c,S),this.generateAllEnemies()}generateAllEnemies(){for(let Y=0;Y<5;Y++)for(let c=0;c<20;c++){const S=wt(st.gamingSprites);this.getNewEnemy(c*50+100+Y*2,Y*50+20,S)}this.setVelocityX(100)}getNewEnemy(Y=0,c=0,S="Sprite"){return this.get(Y,c,S)}}class hs extends Phaser.Scene{constructor(){super({key:"Gaming"})}init(){lt.removeListener(ht.restartGame)}create(){const{width:Y,height:c,middleWidth:S,middleHeight:t}=st.screen;this.scene.launch("GamingUI"),this.playersGroup=this.physics.add.group({classType:rs,runChildUpdate:!0,collideWorldBounds:!0}),this.player=this.playersGroup.get(S,c-50);const e=[this.add.zone(0,t),this.add.zone(Y,t)];for(let v=0;v{this.enemiesGroup.setVelocityX(a.body.velocity.x*-1),this.enemiesGroup.getChildren().forEach(o=>{const r=Number(o.body.velocity.x>0)?1:-1;o.setPosition(o.x+r,o.y+10)})},null,this),this.physics.add.overlap(this.enemiesGroup,this.player.shootGroup,(v,a)=>{v.type===a.type&&(lt.emit(ht.increaseScore,1,{...v},v.type),v.kill(),a.kill(),this.player.marginShoots+=10,this.enemiesGroup.countActive()===0&&this.enemiesGroup.generateAllEnemies())},null,this),this.physics.add.overlap(this.enemiesGroup,this.player,()=>{lt.emit(ht.gameOver),this.player.hitted(),this.physics.pause(),this.tweens.pauseAll()}),lt.on(ht.restartGame,()=>{this.scene.restart()})}}class ls extends Phaser.Scene{constructor(){super({key:"GamingUI"})}init(){this.score=0}create(){st.debug&&new Yt(this),this.scoreLabel=this.add.text(this.scale.width/2,50,this.score,ct.snake.scoreLabel).setOrigin(.5),this.exitButton=new Gt(this,{x:this.scale.width-50,y:50,up:1,down:0,over:1,text:Et.getText("exit"),upCallback:()=>{this.scene.stop("Gaming"),this.scene.start("Start"),this.scene.stop("GamingUI")}}).setScale(.25),this.restartButton=new Gt(this,{x:this.scale.width/2,y:this.scale.height/2,up:1,down:0,over:1,text:Et.getText("restart"),textStyle:ct.base,upCallback:()=>{lt.emit(ht.restartGame)}}).changeVisibility(!1);const Y=this.add.particles("SquaresParticles");this.scoreParticles=Y.createEmitter({frame:Ft(0,9),x:this.scoreLabel.x,y:this.scoreLabel.y,quantity:64,frequency:-1,scale:{start:.75,end:0},alpha:{start:.75,end:0},angle:{start:0,end:360,steps:64},rotate:{start:Tt(-360,360),end:Tt(-360,360)},speed:{min:500,max:750},lifespan:1e3}),lt.removeListener(ht.gameOver),lt.on(ht.gameOver,c=>this.restartButton.changeVisibility(!0)),lt.removeListener(ht.increaseScore),lt.on(ht.increaseScore,this.createNewScoreLabel.bind(this)),lt.removeListener(ht.updateScore),lt.on(ht.updateScore,c=>{this.scoreParticles.explode(),this.score+=c,this.scoreLabel.setText(this.score)})}createNewScoreLabel(Y,{x:c,y:S},t){new ee(this,c,S,Y,t).animate(this.scoreLabel)}}console.clear();const fs={title:zt.name,url:zt.homepage,version:zt.version,banner:{text:bt.text,background:bt.background,hidePhaser:!1},parent:"GameContainer",type:Ut.AUTO,width:st.screen.width,height:st.screen.height,backgroundColor:"#757575",scale:{mode:Ut.Scale.FIT,autoCenter:Ut.Scale.CENTER_BOTH},transparent:!1,roundPixels:!0,render:{antialias:!0,antialiasGL:!0,pixelArt:!1},physics:{default:"arcade",arcade:{debug:st.debug,gravity:{x:0,y:0}}},scene:[mi,gi,Ci,Ri,Bi,Gi,Xi,zi,ki,qi,hs,ls]};new Ut.Game(fs);
+*/var v=t(33),a=t(17),o={Actions:t(275),Animations:t(723),BlendModes:t(35),Cache:t(735),Cameras:t(738),Core:t(806),Class:t(0),Create:t(888),Curves:t(894),Data:t(896),Display:t(898),DOM:t(917),Events:t(918),Game:t(920),GameObjects:t(1011),Geom:t(483),Input:t(1308),Loader:t(1338),Math:t(193),Physics:t(1493),Plugins:t(1403),Renderer:t(1405),Scale:t(1412),ScaleModes:t(168),Scene:t(418),Scenes:t(1413),Structs:t(1415),Textures:t(1416),Tilemaps:t(1418),Time:t(1461),Tweens:t(1463),Utils:t(1481)};o.Sound=t(1492),o=a(!1,o,v),c.exports=o,e.Phaser=o}).call(this,t(600))}])})})(qt);const Ut=re(qt.exports);class Wt{constructor(){this.events={}}on(Y,c){this.has(Y)||(this.events[Y]=[]),this.events[Y].push(c)}emit(Y,...c){this.has(Y)&&this.events[Y].forEach(S=>{S(...c)})}off(Y){delete this.events[Y]}once(Y,c){let S=(...t)=>{c(...t),this.off(Y)};this.on(Y,S)}clear(){this.events={}}has(Y){return this.events[Y]!==void 0}}new Wt;const Xt={enter:13,escape:27,space:32,left:37,up:38,right:39,down:40,num0:48,num1:49,num2:50,num3:51,num4:52,num5:53,num6:54,num7:55,num8:56,num9:57,q:81,w:87,e:69,r:82,t:84,y:89,u:85,i:73,o:79,p:80,a:65,s:83,d:68,f:70,g:71,h:72,j:74,k:75,l:76,z:90,x:88,c:67,v:86,b:66,n:78,m:77};class ae{constructor(){this.isPressed={},this.events=new Wt,window.addEventListener("keydown",this._keyDown.bind(this)),window.addEventListener("keypress",this._keyPress.bind(this)),window.addEventListener("keyup",this._keyUp.bind(this))}getNameByKeyCode(Y){return Object.keys(Xt).find(c=>Xt[c]===Y)}getKeyCodeByName(Y){return Xt[Y]}isKeyPressed(Y){if(typeof Y=="string")return this.isKeyPressedName(Y);if(typeof Y=="number")return this.isKeyPressedKeyCode(Y)}isKeyPressedName(Y){return!!this.isPressed[Y]}isKeyPressedKeyCode(Y){return!!this.isPressed[this.getNameByKeyCode(Y)]}_keyDown({keyCode:Y}){this.isPressed[this.getNameByKeyCode(Y)]=!0;const c=this.getNameByKeyCode(Y);this.events.emit(`keyDown-${c}`,{code:Y,name:c})}_keyPress(Y){}_keyUp({keyCode:Y}){this.isPressed[this.getNameByKeyCode(Y)]=!1;const c=this.getNameByKeyCode(Y);this.events.emit(`keyUp-${this.getNameByKeyCode(Y)}`,{code:Y,name:c})}}new ae;const Ot={left:0,middle:1,right:2};class oe{constructor(Y=!1){this.x=0,this.y=0,this.MouseButton=Ot,this.isDown={},this.events=new Wt,window.addEventListener("mousemove",this._mousemove.bind(this)),window.addEventListener("mousedown",this._mousedown.bind(this)),window.addEventListener("mouseup",this._mouseup.bind(this)),Y&&window.addEventListener("contextmenu",c=>c.preventDefault())}getPosition(Y){if(!Y)return{x:this.x,y:this.y};const{x:c,y:S}=Y.getBoundingClientRect();return{x:this.x-c,y:this.y-S}}getNameByButtonCode(Y){switch(Y){case Ot.left:return"left";case Ot.middle:return"middle";case Ot.right:return"right";default:return""}}getButtonKeyByName(Y){switch(Y){case"left":return Ot.left;case"middle":return Ot.middle;case"right":return Ot.right;default:return-1}}isButtonDown(Y){if(typeof Y=="string")return this.isButtonDownByName(Y);if(typeof Y=="number")return this.isButtonDownByButtonCode(Y)}isButtonDownByName(Y){return!!this.isDown[Y]}isButtonDownByButtonCode(Y){return!!this.isDown[this.getNameByButtonCode(Y)]}_updateMousePosition(Y){const{clientX:c,clientY:S}=Y;this.x=c,this.y=S}_mousemove(Y){this._updateMousePosition(Y)}_mousedown(Y){this._updateMousePosition(Y);const c=this.getNameByButtonCode(Y.button);this.isDown[c]=!0,this.events.emit(`buttonDown-${c}`,{code:Y.button,name:c})}_mouseup(Y){this._updateMousePosition(Y);const c=this.getNameByButtonCode(Y.button);this.isDown[c]=!1,this.events.emit(`buttonUp-${c}`,{code:Y.button,name:c})}}new oe;const Zt={minWidth:"80%",position:"fixed",top:"-50px",left:"50%",zIndex:1e3,transform:"translate(-50%, 0)",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 10px",border:"2px solid #000000",borderRadius:"4px",backgroundColor:"#f0f0f0",boxShadow:"0px 0px 5px 1px rgba(0, 0, 0, 0.75)"},Jt={},Qt={padding:"2px 6px",borderRadius:"4px",background:"none"};function he({text:k="",animated:Y=!0,animationTime:c=2,closeButton:S=!0,endPosition:t=100,style:e=Zt,textStyle:v=Jt,buttonStyle:a=Qt,parent:o=document.body}){e={...Zt,...e},v={...Jt,...v},a={...Qt,...a};let r=0;const i=t+"px",s=document.createElement("div");Object.assign(s.style,{...e}),Y?s.style.transition=c+"s":s.style.top=i;const l=document.createElement("span");if(Object.assign(l.style,{...v}),l.innerHTML=k,s.appendChild(l),S){const n=document.createElement("button");Object.assign(n.style,{...a}),n.innerHTML="X",n.addEventListener("click",()=>o.removeChild(s)),s.appendChild(n)}Y?(s.addEventListener("transitionend",()=>{r++,r>=2&&o.removeChild(s)}),setTimeout(()=>{s.style.top=i},10),setTimeout(()=>{s.style.top="-100px"},(c+1)*1e3)):setTimeout(()=>{o.removeChild(s)},(c+1)*1e3),o.appendChild(s)}function Tt(k,Y){return Y||(Y=k,k=0),Math.floor(k+Math.random()*(Y-k))}function wt(k){return k[Tt(k.length)]}function le(k){const Y=new URLSearchParams(window.location.search);return Object.fromEntries(Y.entries())[k]}function Ft(k,Y,c=1,S=[]){const t=[];for(let e=k;e{e>=a&&e<=o&&(v=!0)}),v||t.push(e)}return t}const $t=le("debug"),st={screen:{width:1280,height:720,middleWidth:0,middleHeight:0},debug:!($t=="false"||$t==null),language:"en",snakeTileSize:32,snakeSprites:["CSS3","Godot","HTML5","JS","Lazarus","Pascal","Phaser","React","SASS","VisualBasic"],gamingSprites:["Godot","Phaser"],controllers:{start:{left1:"LEFT",left2:"A",right1:"RIGHT",right2:"D",acceleration1:"UP",acceleration2:"W",back1:"DOWN",back2:"S"},platform:{left1:"LEFT",left2:"A",right1:"RIGHT",right2:"D",jump1:"UP",jump2:"W",down1:"DOWN",down2:"S",shoot:"SPACE"},shootUp:{shoot:"SPACE"},snake:{left1:"LEFT",left2:"A",right1:"RIGHT",right2:"D",up1:"UP",up2:"W",down1:"DOWN",down2:"S",boost1:"SHIFT",boost2:"SPACE"},gaming:{left1:"LEFT",left2:"A",right1:"RIGHT",right2:"D",shoot1:"SPACE",shoot2:"UP",shoot3:"W"}}};st.screen.middleWidth=st.screen.width/2;st.screen.middleHeight=st.screen.height/2;const fe="201flaviosilva",ue="2.3.0",de="My Site",ve="https://201flaviosilva.github.io/",ce="MIT",pe={name:"Fl\xE1vio Silva",email:"flavioandre_ls2001@hotmail.com",url:"https://201flaviosilva.github.io/"},xe="src/index.js",me={clear:"rm -rf build && rm -rf out && rm -rf dist",start:"vite --config vite.config.js",build:"npm run clear && vite build",preview:"vite preview",bump:"npm run build && np --any-branch --no-tests --no-publish --no-yarn"},ge={"201flaviosilva-utils":"^1.2.9",phaser:"^3.55.2"},ye={np:"^7.6.2",vite:"^3.1.3"},Te=[],Se={type:"git",url:"git+https://github.com/201flaviosilva/201flaviosilva.github.io"},Ee={url:"https://github.com/201flaviosilva/201flaviosilva.github.io/issues"},zt={name:fe,version:ue,description:de,homepage:ve,private:!1,license:ce,author:pe,main:xe,scripts:me,dependencies:ge,devDependencies:ye,keywords:Te,repository:Se,bugs:Ee},St="'Press Start 2P'",bt={text:"#ffffff",background:["#ffffff","#0000ff","#00ff00","#ff0000","#000000"]},gt={white:"#ffffff",black:"#000000",green:"#00dd00",platformBackground:"#E2F7FE"},ct={base:{fontFamily:St,fontSize:20,fill:gt.white,stroke:gt.black,strokeThickness:1,boundsAlignH:"center",boundsAlignV:"middle",align:"center",shadow:{offsetX:2,offsetY:2,color:gt.green,blur:2,fill:!0}},home:{menu:{normal:{fontFamily:St,fontSize:40,fill:gt.green,stroke:gt.white,strokeThickness:2,shadow:{fill:!1}},over:{fontFamily:St,fontSize:60,fill:gt.white,stroke:gt.black,strokeThickness:2,shadow:{offsetX:0,offsetY:0,color:gt.green,blur:20,fill:!0}}}},web:{scoreLabel:{fontFamily:St,fontSize:"32px",align:"center",color:"#ffff00"},updateScoreLabel:{fontFamily:St,fontSize:"16px",align:"center"}},loading:{keys:{fontFamily:St,fontSize:20,fill:gt.platformBackground}},snake:{scoreLabel:{fontFamily:St,fontSize:"32px",align:"center",color:"#ffff00"},updateScoreLabel:{fontFamily:St,fontSize:"16px",align:"center"}},start:{},objects:{signals:{fontFamily:St,fontSize:16,fill:"#633E25",stroke:gt.black,strokeThickness:1}},components:{animateTitle:{fontFamily:St,fontSize:80,fill:gt.platformBackground,stroke:"#B5F1DB",strokeThickness:2,shadow:{offsetX:0,offsetY:0,color:gt.black,blur:20,fill:!0}},progressBar:{fontFamily:St,fontSize:60,fill:gt.white,stroke:gt.black,strokeThickness:2}}};class Ce extends Phaser.GameObjects.Graphics{constructor(Y,c){super(Y,c),Y.add.existing(this),this.drawProgress()}drawProgress(){const{width:Y,height:c,middleWidth:S,middleHeight:t}=st.screen;this.percentText=this.scene.add.text(S,t,"0%",ct.components.progressBar).setOrigin(.5)}updateBar(Y){var c;this.percentText.setText("Load: "+Math.round(Y*100)+"% - "+((c=this==null?void 0:this.lastFileLoad)==null?void 0:c.key))}fileLoad(Y){this.lastFileLoad=Y}complete(){this.percentText.destroy()}}const Pe=""+new URL("Idle.4557b68b.png",import.meta.url).href,Ae=""+new URL("Jump.60498867.png",import.meta.url).href,Me=""+new URL("Walk.5aefb0de.png",import.meta.url).href,Re=""+new URL("PlayerShip.c26aa63e.png",import.meta.url).href,Le=""+new URL("CSS3.e5e24a5a.png",import.meta.url).href,Fe=""+new URL("Godot.fd814eaa.png",import.meta.url).href,Oe=""+new URL("HTML5.5d068b98.png",import.meta.url).href,De=""+new URL("JS.6adfab57.png",import.meta.url).href,Ie=""+new URL("Lazarus.c44c4aff.png",import.meta.url).href,Be=""+new URL("Pascal.3a954956.png",import.meta.url).href,Ge=""+new URL("PascalZim.ed88704b.png",import.meta.url).href,Ne=""+new URL("Phaser.4755ab88.png",import.meta.url).href,Ue=""+new URL("React.9950d6d3.png",import.meta.url).href,Ye=""+new URL("SASS.686c8acb.png",import.meta.url).href,Xe=""+new URL("VisualBasic.8d78be69.png",import.meta.url).href,ze=""+new URL("Langs.6877f758.png",import.meta.url).href,Ve=""+new URL("Comando.1a60fb55.png",import.meta.url).href,We=""+new URL("Web.a9af801e.png",import.meta.url).href,we=""+new URL("Duke.491ab32c.png",import.meta.url).href,He=""+new URL("DukeLeft.cf6b882c.png",import.meta.url).href,Ke=""+new URL("Sprite.039e8988.png",import.meta.url).href,Ze=""+new URL("Quadrados.1448b9a2.png",import.meta.url).href,Je=""+new URL("Bush1.61a9ade8.png",import.meta.url).href,Qe=""+new URL("Bush2.b91f0d4a.png",import.meta.url).href,$e=""+new URL("Bush3.769e57fd.png",import.meta.url).href,be=""+new URL("Bush4.6b8c9561.png",import.meta.url).href,je=""+new URL("Cactus.af590a77.png",import.meta.url).href,ke=""+new URL("Castle.0d68cbf5.png",import.meta.url).href,qe=""+new URL("Crate.331b8fbe.png",import.meta.url).href,_e=""+new URL("Mushroom1.756eb050.png",import.meta.url).href,ti=""+new URL("Mushroom2.d03b1fc5.png",import.meta.url).href,ei=""+new URL("SignDirection.adc35fa9.png",import.meta.url).href,ii=""+new URL("Stone.86c3b22a.png",import.meta.url).href,si=""+new URL("Tree1.f3fb6d56.png",import.meta.url).href,ni=""+new URL("Tree2.93299d58.png",import.meta.url).href,ri=""+new URL("Tree3.a3752cc4.png",import.meta.url).href,ai=""+new URL("BG.0d582107.png",import.meta.url).href,oi=""+new URL("Tiles.3118134d.png",import.meta.url).href,hi=""+new URL("SkyTiles.ee0dab4b.png",import.meta.url).href,li=""+new URL("StarsBackground.7746b825.png",import.meta.url).href,fi=""+new URL("Button.adffc2c3.png",import.meta.url).href,ui=""+new URL("Flags.10196374.png",import.meta.url).href,di=""+new URL("FullScreen.6b974e40.png",import.meta.url).href,vi=""+new URL("Sound.faa6c50a.png",import.meta.url).href,ci=""+new URL("Settings.87927cef.png",import.meta.url).href,pi=""+new URL("ArrowKey.d875e655.png",import.meta.url).href,xi=""+new URL("SpaceKey.66573d69.png",import.meta.url).href;class mi extends Phaser.Scene{constructor(){super({key:"Preload"})}preload(){const Y=new Ce(this);this.importSprites(),this.importUI(),this.importSounds(),this.load.on("progress",c=>Y.updateBar(c)),this.load.on("fileprogress",c=>Y.fileLoad(c)),this.load.on("complete",()=>{Y.complete()})}importSprites(){this.load.spritesheet("PlayerIdle",Pe,{frameWidth:38,frameHeight:44}),this.load.spritesheet("PlayerJump",Ae,{frameWidth:38,frameHeight:44}),this.load.spritesheet("PlayerWalk",Me,{frameWidth:38,frameHeight:46}),this.load.image("PlayerShip",Re),this.load.image("CSS3",Le),this.load.image("Godot",Fe),this.load.image("HTML5",Oe),this.load.image("JS",De),this.load.image("Lazarus",Ie),this.load.image("Pascal",Be),this.load.image("PascalZim",Ge),this.load.image("Phaser",Ne),this.load.image("React",Ue),this.load.image("SASS",Ye),this.load.image("VisualBasic",Xe),this.load.image("LangsSheet",ze),this.load.image("Comando",Ve),this.load.image("Web",We),this.load.image("Duke",we),this.load.image("DukeLeft",He),this.load.image("Sprite",Ke),this.load.spritesheet("SquaresParticles",Ze,{frameWidth:32,frameHeight:32}),this.load.image("Bush1",Je),this.load.image("Bush2",Qe),this.load.image("Bush3",$e),this.load.image("Bush4",be),this.load.image("Cactus",je),this.load.image("Castle",ke),this.load.image("Crate",qe),this.load.image("Mushroom1",_e),this.load.image("Mushroom2",ti),this.load.image("SignDirection",ei),this.load.image("Stone",ii),this.load.image("Tree1",si),this.load.image("Tree2",ni),this.load.image("Tree3",ri),this.load.image("BackgroundForest",ai),this.load.spritesheet("Tiles",oi,{frameWidth:128,frameHeight:128}),this.load.spritesheet("SkyTiles",hi,{frameWidth:128,frameHeight:93})}importUI(){this.load.image("StarsBackground",li),this.load.spritesheet("Button",fi,{frameWidth:250,frameHeight:80}),this.load.spritesheet("Flags",ui,{frameWidth:32,frameHeight:32}),this.load.spritesheet("FullScreen",di,{frameWidth:32,frameHeight:32}),this.load.spritesheet("Sound",vi,{frameWidth:32,frameHeight:32}),this.load.spritesheet("Settings",ci,{frameWidth:32,frameHeight:32}),this.load.spritesheet("ArrowKey",pi,{frameWidth:64,frameHeight:64}),this.load.spritesheet("SpaceKey",xi,{frameWidth:128,frameHeight:32})}importSounds(){}create(){st.debug?this.scene.start("Start"):this.scene.start("Index")}}class Ht extends Phaser.GameObjects.TileSprite{constructor(Y,c=-15e3,S=100,t=1e-5){const{middleWidth:e,middleHeight:v,width:a,height:o}=st.screen;super(Y,e,v,a*2,o*2,"StarsBackground"),Y.add.existing(this),this.bgPosition=.1,this.xSpeed=c,this.ySpeed=S,this.rotationSpeed=t,this.setAlpha(.75),this.setDepth(-1),Y.add.particles("SquaresParticles").createEmitter({frame:Ft(0,9),x:Y.scale.width,y:{min:0,max:Y.scale.height},lifespan:1e4,speedX:{min:-600,max:-100},scale:{min:.2,max:.05},alpha:{start:1,end:.5},quantity:1})}preUpdate(){this.tilePositionX=Math.cos(this.bgPosition)*this.xSpeed,this.tilePositionY=Math.sin(this.bgPosition)*this.ySpeed,this.rotation+=this.rotationSpeed,this.bgPosition+=5e-4}}class gi extends Phaser.Scene{constructor(){super({key:"Index"}),this.isMobile=!1}init(){const{android:Y,iOS:c,iPad:S,iPhone:t,windowsPhone:e}=this.sys.game.device.os;this.isMobile=Y||c||S||t||e,this.isMobile&&this.pushNotification("This game is currently not available on mobile devices. Please click on PDF button.")}create(){const{middleWidth:Y,middleHeight:c}=st.screen,S=36;new Ht(this),this.createText({x:Y,y:c-S,text:"Start",action:()=>{this.isMobile?this.pushNotification("Sorry, the current version of the game do not work on mobile :/"):this.scene.start("Start")}}),this.createText({x:Y,y:c+S,text:"PDF",action:()=>this.openPDF()})}openPDF(){const Y="./PDF/index.html",c=window.open(Y,"_blank");c&&c.focus?c.focus():c||(window.location.href=Y)}createText(Y){const{x:c,y:S,text:t,action:e}=Y,v=this.add.text(c,S,t,ct.home.menu.normal).setOrigin(.5).setInteractive({useHandCursor:!0});v.on("pointerover",()=>v.setStyle(ct.home.menu.over)),v.on("pointerout",()=>v.setStyle(ct.home.menu.normal)),v.on("pointerup",e)}pushNotification(Y){he({text:Y,animated:!0,animationTime:5,closeButton:!0,endPosition:100,style:{border:"1px solid #00dd00",boxShadow:"0 0 10px #058005, 0 0 50px #058005",background:"#023b02"},textStyle:{color:"#ff0000",boxShadow:"0 0 10px #023b02, 0 0 50px #023b02"}})}}class Kt extends Phaser.GameObjects.Text{constructor(Y,c,S,t){const e=" "+t+" ";super(Y,c,S,e,ct.components.animateTitle),this.setOrigin(.5),Y.add.existing(this),this.animation()}animation(){const{middleHeight:Y}=st.screen;this.scene.tweens.add({targets:this,ease:"Bounce",duration:1500,y:{from:Y,to:100},scale:{from:4,to:.9},alpha:{from:.5,to:1}})}}const yi={options:"Op\xE7\xF5es",start:"Come\xE7ar",moveRotate:"Movimenta\xE7\xE3o/Rota\xE7\xE3o",exit:"Sair",restart:"Recome\xE7ar"},Ti={options:"Options",start:"Start",moveRotate:"Move/Rotate",exit:"Exit",restart:"Restart"};class Bt{constructor(){if(Bt.instance instanceof Bt)return Bt.instance;this.selectedLang=st.language,Bt.instance=this}toggle(){this.selectedLang=this.selectedLang==="en"?"pt":"en"}getText(Y){return this.selectedLang==="en"?Ti[Y]:yi[Y]}}const Et=new Bt;class Si extends Phaser.GameObjects.Container{constructor(Y,c,S,t){super(Y,c,S),Y.add.existing(this),this.switchScene(t);const e=this.scene.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE);e.removeAllListeners(),e.on("down",()=>{this.destroy()},this),this.scene.tweens.add({targets:[this],alpha:{from:1,to:0},duration:1e4,ease:"Circ.easeIn",onComplete:()=>{this.destroy()}})}switchScene(Y){switch(Y){case"Start":{this.startUI();break}case"Pascal":{this.platformUI();break}}}startUI(){const Y={width:300,height:200},c=this.scene.add.graphics();c.clear(),c.fillStyle(0,.25),c.fillRoundedRect(0,0,Y.width,Y.height,10),this.add(c);const S=Y.width/2,t=Y.height/2,e=40,v=this.scene.add.text(S,t-90,Et.getText("moveRotate"),ct.loading.keys).setOrigin(.5);this.add(v),this.addKeyExample(S,t-e,"ArrowKey","UP"),this.addKeyExample(S,t+e,"ArrowKey","DOWN").setFlipY(!0),this.addKeyExample(S+e*2,t+e,"ArrowKey","RIGHT",90),this.addKeyExample(S-e*2,t+e,"ArrowKey","LEFT",-90)}platformUI(){const Y={width:300,height:250},c=this.scene.add.graphics();c.clear(),c.fillStyle(0,.25),c.fillRoundedRect(0,0,Y.width,Y.height,10),this.add(c);const S=Y.width/2,t=Y.height/2,e=40,v=this.scene.add.text(S,t-95,"Move",ct.loading.keys).setOrigin(.5);this.add(v),this.addKeyExample(S,t-e,"ArrowKey","UP"),this.addKeyExample(S,t+e,"ArrowKey","DOWN").setFlipY(!0),this.addKeyExample(S+e*2,t+e,"ArrowKey","RIGHT",90),this.addKeyExample(S-e*2,t+e,"ArrowKey","LEFT",-90),this.addKeyExample(S,t+e*2.5,"SpaceKey","SPACE",0,"Shoot").setScale(2,1)}addKeyExample(Y=0,c=0,S="ArrowKey",t="UP",e=0,v=""){const a=this.scene.add.image(Y,c,S,0).setAngle(e),o=this.scene.input.keyboard.addKey(t);if(o.on("down",()=>{a.setFrame(1)},this),o.on("up",()=>{a.setFrame(0)},this),this.add(a),v){const r=this.scene.add.text(Y,c,v,ct.loading.keys).setOrigin(.5);this.add(r)}return a}}class Ei extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){super(Y,c,S,"DukeLeft"),this.keys=this.scene.input.keyboard.addKeys(st.controllers.start),this.accelerationSpeed=300,this.rotationSpeed=100}update(){if(!this.keys)return;const Y=this.keys;Y.right1.isDown||Y.right2.isDown?this.setAngularVelocity(this.rotationSpeed):Y.left1.isDown||Y.left2.isDown?this.setAngularVelocity(-this.rotationSpeed):this.setAngularVelocity(0),Y.acceleration1.isDown||Y.acceleration2.isDown?this.scene.physics.velocityFromRotation(this.rotation,this.accelerationSpeed,this.body.velocity):Y.back1.isDown||Y.back2.isDown?this.scene.physics.velocityFromRotation(this.rotation,-this.accelerationSpeed,this.body.velocity):this.setVelocity(0)}}class Ci extends Phaser.Scene{constructor(){super({key:"Start"})}create(){const{width:Y,height:c,middleWidth:S,middleHeight:t}=st.screen;this.input.keyboard.removeAllListeners(),new Ht(this),new Kt(this,S,100,"201flaviosilva");const e=this.physics.add.group({classType:Ei,runChildUpdate:!0,collideWorldBounds:!0});this.player=e.get(S,t);{const v=this.physics.add.image(10,10,"Settings",1).setOrigin(0);this.physics.add.collider(this.player,v,()=>{this.scene.start("Options")})}{const v=this.physics.add.image(S-350,t-100,"PascalZim").setScale(2);this.physics.add.collider(this.player,v,()=>{this.scene.start("Pascal")})}{const v=this.physics.add.image(S-350,t+100,"Web").setScale(4);this.physics.add.collider(this.player,v,()=>{this.scene.start("Web")})}{this.snakeAll=this.add.tileSprite(S+350,t-100,64,32,"LangsSheet").setScale(3);const a=this.add.zone(S+350,t-100,64*3,32*3);this.physics.world.enable(a),this.physics.add.collider(this.player,a,()=>{this.scene.start("SnakeAll")})}{const v=this.physics.add.image(S+350,t+100,"Comando").setScale(6);this.physics.add.collider(this.player,v,()=>{this.scene.start("Gaming")})}new Si(this,S-75,c-120,"Start").setScale(.5)}update(Y,c){this.snakeAll.tilePositionX+=.025*c}}class Pi extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){super(Y,c,S)}generate(Y){const{x:c,y:S,image:t,text:e,style:v,startFrame:a,actionCallback:o}=Y;this.realX=c,this.actionCallback=o,this.setPosition(c,S),this.setTexture(t),this.setFrame(a||0),this.body.setSize(0,0,this.frame.width,this.frame.height),this.label=this.scene.add.text(c,S,e,v).setOrigin(.5),this.setInteractive({useHandCursor:!0}),this.on("pointerup",()=>this.action(o),this)}changeFrame(Y=!1){this.setFrame(this.frame.name===1?0:1),Y&&setTimeout(()=>this.changeFrame(),1e3)}changeVisible(Y=!0){this.setVisible(Y),this.label.setVisible(Y),this.setX(Y?this.realX:-this.width)}action(Y){console.log("Acting..."),Y(),this.changeFrame(),this.changeVisible()}update(){this.body.touching.down&&(this.action(this.actionCallback),this.body.touching.down=!1)}}class Ai extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t){super(Y,c,S,t),this.sprite=t,this.degreeNum=0,this.liveTime=0}generate(Y){this.setBounce(.5),Y?this.setVelocityX(-300):this.setVelocityX(300)}update(Y){this.liveTime||(this.liveTime=Y),this.sprite=="Lazarus"&&(this.degreeNum+=2,this.setAngle(this.degreeNum)),Y>this.liveTime+3e3&&this.destroy()}}class _t extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){super(Y,c,S,"PlayerIdle"),this.keys=this.scene.input.keyboard.addKeys(st.controllers.platform),this.playerStatus={velocity:200,jumpForce:300,shootType:null,lastShot:0},this.shoots=this.scene.physics.add.group({classType:Ai,runChildUpdate:!0})}createAnimations(){this.scene.anims.create({key:"PlayerIdle",frames:this.scene.anims.generateFrameNumbers("PlayerIdle"),defaultTextureKey:"PlayerIdle",frameRate:2,repeat:-1}),this.scene.anims.create({key:"PlayerJump",frames:this.scene.anims.generateFrameNumbers("PlayerJump"),defaultTextureKey:"PlayerJump",frameRate:4,repeat:-1}),this.scene.anims.create({key:"PlayerWalk",frames:this.scene.anims.generateFrameNumbers("PlayerWalk"),defaultTextureKey:"PlayerWalk",frameRate:4,repeat:-1})}generate(){this.createAnimations(),this.scene.anims.play("PlayerJump",this),this.setZ(10)}update(Y){if(!this.keys)return;const c=this.keys,{velocity:S,jumpForce:t,shootType:e,lastShot:v}=this.playerStatus;if(v||(this.playerStatus.lastShot=Y),c.left1.isDown||c.left2.isDown?(this.setVelocityX(-S),this.setFlipX(!0),this.body.onFloor()&&this.anims.currentAnim.key!=="PlayerWalk"&&this.scene.anims.play("PlayerWalk",this)):c.right1.isDown||c.right2.isDown?(this.setVelocityX(S),this.setFlipX(!1),this.body.onFloor()&&this.anims.currentAnim.key!=="PlayerWalk"&&this.scene.anims.play("PlayerWalk",this)):(this.setVelocityX(0),this.body.onFloor()&&this.anims.currentAnim.key!=="PlayerIdle"&&this.scene.anims.play("PlayerIdle",this)),(c.jump1.isDown||c.jump2.isDown)&&this.body.onFloor()?(this.setVelocityY(-t),this.anims.currentAnim.key!=="PlayerJump"&&this.scene.anims.play("PlayerJump",this)):(c.down1.isDown||c.down2.isDown)&&this.setVelocityY(t),c.shoot.isDown&&e&&v{Et.toggle(),this.scene.restart()}})}{const a=S;this.fullScreenButton=this.optionsGroup.get(a,v),this.fullScreenButton.generate({x:a,y:v,image:"FullScreen",startFrame:Number(!this.scale.isFullscreen),actionCallback:()=>{this.scale.isFullscreen?this.scale.stopFullscreen():this.scale.startFullscreen()}})}{const a=Y*.75;this.soundButton=this.optionsGroup.get(a,e),this.soundButton.generate({x:a,y:e,image:"Sound",startFrame:Number(this.sound.mute),actionCallback:()=>{this.sound.stopAll(),this.sound.setMute(!this.sound.mute)}})}new Kt(this,S,100,Et.getText("options"))}createPlayer(){const{width:Y,height:c,middleWidth:S,middleHeight:t}=st.screen;this.playersGroup=this.physics.add.group({classType:_t,collideWorldBounds:!0,runChildUpdate:!0}),this.player=this.playersGroup.get(S,t),this.player.generate()}createCollision(){this.physics.add.collider(this.tilesGroup,this.player),this.physics.add.collider(this.optionsGroup,this.player)}update(){this.player.x>st.screen.width-this.player.width*.75&&(this.scene.start("Start",{sceneName:"Options"}),this.scene.stop())}}class Gt extends Phaser.GameObjects.Sprite{constructor(Y,c){if(!Y){console.error("Missing scene!");return}c.key=c.key||"Button",c.up||(c.up=0),c.down<0&&(c.down=c.up),c.over<0&&(c.over=c.up),super(Y,0,0,c.key,c.up),Y.add.existing(this),c.x&&this.setPosition(c.x,c.y),this.config=c,c.text&&(this.label=Y.add.text(this.x,this.y,c.text,c.textStyle).setOrigin(.5)),this.setInteractive({useHandCursor:!0}),this.on("pointerdown",this._onDown,this),this.on("pointerup",this._onUp,this),this.on("pointerover",this._onOver,this),this.on("pointerout",this._onOut,this)}changeVisibility(Y=!0){return this.setVisible(Y),this.label&&this.label.setVisible(Y),this}_onDown(){this.setFrame(this.config.down),this.config.downCallback&&this.config.downCallback()}_onOver(){this.setFrame(this.config.over),this.config.overCallback&&this.config.overCallback()}_onUp(){this.setFrame(this.config.up),this.config.upCallback&&this.config.upCallback()}_onOut(){this.setFrame(this.config.up)}kill(){this.label&&this.label.destroy(),this.destroy()}}class Yt extends Phaser.GameObjects.Text{constructor(Y,c=10,S=10,t=0,e={}){super(Y,c,S,t,e),Y.add.existing(this),this.setDepth(1e6)}preUpdate(){this.setText(this.scene.game.loop.actualFps.toFixed(2))}}class Li extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){const t=S||st.screen.middleHeight;super(Y,c,t,"Duke")}generate(){this.setScale(.6),this.setVelocityX(-100),this.setBounce(1.0001,.35)}update(){(this.x<0||this.y<0||this.y>st.screen.height)&&this.destroy()}}class Fi extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){const t=S||st.screen.height-110;super(Y,c,t,"Cactus")}}class Oi extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t){super(Y,c,S,"Crate"),this.setScale(.7),this.powerType=t,this.isAlive=!0}generate(){this.setDepth(9)}update(){this.body.touching.down&&this.isAlive&&(this.isAlive=!1,this.animation())}animation(){this.scene.tweens.add({targets:this,ease:"Linear",duration:150,props:{y:{from:this.y,to:this.y-25},alpha:{value:"0.75",delay:200,duration:50,ease:"Linear"}},yoyo:!0,completeDelay:50,onComplete:()=>{this.setAlpha(.75),this.generatePower()}})}generatePower(){const Y=this.scene.powerShootGroup.get(this.x,this.y,this.powerType);!Y||this.scene.tweens.add({targets:Y,ease:"Linear",duration:250,y:{from:this.y,to:this.y-this.height*2},onComplete:()=>{Y.generate()}})}}class Di extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t){super(Y,c,S,t),Y.add.existing(this),this.powerType=t,this.degreeNum=0,this.liveTime=0}generate(){this.setBounceX(1),this.setVelocityX(150)}update(Y){this.liveTime||(this.liveTime=Y),this.powerType=="Lazarus"&&(this.degreeNum++,this.setAngle(this.degreeNum)),Y>this.liveTime+1e4&&this.destroy()}}class Ii extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t=1){super(Y,c,S,"SkyTiles",t)}changeScale(Y){this.setSize(this.width*Y,this.height*Y),this.setScale(Y)}}const yt=7e3;class Bi extends Phaser.Scene{constructor(){const Y={key:"Pascal",physics:{default:"arcade",arcade:{debug:st.debug,gravity:{x:0,y:200}}}};super(Y)}init(){this.isIsland2DukesCreated=!1,this.isIsland3DukesCreated=!1}create(){this.createWorld(),this.createStartEnemies(),this.createPlayer(),this.createCollision(),st.debug&&this.createDebug(),this.scene.launch("PascalUI")}createDebug(){const Y=this.add.graphics().setDepth(0);Y.lineStyle(1,16711680,1);for(let c=0;c{this.player.playerStatus.shootType=S.powerType,S.destroy()},null,this),this.physics.add.overlap(this.player,this.dukes,()=>this.scene.start("Start"),null,this),this.physics.add.overlap(this.powerShootGroup,this.dukes,(c,S)=>{c.destroy(),S.destroy()},null,this),this.physics.add.overlap(this.player.shoots,this.dukes,(c,S)=>{c.destroy(),S.destroy()},null,this),this.physics.add.overlap(this.castle,this.player,(c,S)=>{Y||(Y=!0,this.player.keys=null,this.player.body.destroy(),this.tweens.add({targets:[this.player],ease:"Linear",duration:500,delay:100,x:{from:this.player.x,to:this.castle.x},y:{from:this.player.y,to:640},scale:{from:this.player.scale,to:.75},alpha:{from:1,to:.75},completeDelay:250,onComplete:()=>this.scene.start("Start")}))},null,this)}update(){this.player.x>3e3&&!this.isIsland2DukesCreated&&this.createDukesIsland2(),this.player.x>4500&&!this.isIsland3DukesCreated&&this.createDukesIsland3()}createDukesIsland2(){this.isIsland2DukesCreated=!0;const Y=this.dukes.get(4e3);Y&&Y.generate();const c=this.dukes.get(4100);c&&c.generate()}createDukesIsland3(){this.isIsland3DukesCreated=!0;const Y=this.dukes.get(5300);Y&&Y.generate();const c=this.dukes.get(5800);c&&c.generate();const S=this.dukes.get(6e3);S&&S.generate();const t=100,e=this.dukes.get(yt-t*6);e&&e.generate();const v=this.dukes.get(yt-t*5);v&&v.generate();const a=this.dukes.get(yt-t*4);a&&a.generate();const o=this.dukes.get(yt-t*3);o&&o.generate();const r=this.dukes.get(yt-t*2);r&&r.generate();const i=this.dukes.get(yt-t*1);i&&i.generate();const s=this.dukes.get(yt);s&&s.generate()}}class Gi extends Phaser.Scene{constructor(){super({key:"PascalUI"})}create(){st.debug&&new Yt(this),this.exitButton=new Gt(this,{x:this.scale.width-50,y:50,up:1,down:0,over:1,text:Et.getText("exit"),upCallback:()=>{this.scene.stop("Pascal"),this.scene.start("Start"),this.scene.stop("PascalUI")}}).setScale(.25)}}const ht={gameOver:"gameOver",restartGame:"restartGame",increaseScore:"increaseScore",updateScore:"updateScore"},lt=new Phaser.Events.EventEmitter;class ee extends Phaser.GameObjects.Text{constructor(Y,c=10,S=10,t=0,e="JS",v=ct.snake.updateScoreLabel){super(Y,c,S,t,v),Y.add.existing(this),this.score=t,this.setDepth(1e3),this.setOrigin(.5),this.setColor("#ff0"),this.particles=Y.add.particles(e),this.particlesEmitter=this.particles.createEmitter({x:c,y:S,quantity:64,frequency:-1,scale:{start:1,end:0},alpha:{start:1,end:0},angle:{start:0,end:360,steps:64},rotate:{start:Tt(-360,360),end:Tt(-360,360)},speed:{min:500,max:750},lifespan:{min:750,max:1e3}}),this.particlesEmitter.explode()}animate({x:Y,y:c}){this.scene.tweens.add({targets:[this],x:Y,y:c,ease:"Linear",duration:1e3,scale:2,onComplete:()=>this.kill()})}kill(){lt.emit(ht.updateScore,this.score),this.particlesEmitter.stop(),this.particles.destroy(),this.destroy()}}const vt={UP:"up",DOWN:"down",LEFT:"left",RIGHT:"right"},Nt=st.snakeTileSize,Vt=150;class Ni{constructor(Y,c,S){this.scene=Y,this.headPosition=new Phaser.Geom.Point(c,S),this.body=new Ui(Y,{classType:ie}),this.head=this.body.create(c,S,"Duke",vt.RIGHT).setScale(.5).setDepth(100),this.tail=new Phaser.Geom.Point(c,S),this.isAlive=!0,this.speed=Vt,this.moveTime=0,this.heading=vt.RIGHT,this.direction=vt.RIGHT,this.keys=Y.input.keyboard.addKeys(st.controllers.snake)}goUp(){this.direction!==vt.DOWN&&(this.heading=vt.UP)}goDown(){this.direction!==vt.UP&&(this.heading=vt.DOWN)}goLeft(){this.direction!==vt.RIGHT&&(this.heading=vt.LEFT)}goRight(){this.direction!==vt.LEFT&&(this.heading=vt.RIGHT)}update(Y){const{isAlive:c,keys:S}=this;if(!c||!S)return;const{left1:t,left2:e,right1:v,right2:a,up1:o,up2:r,down1:i,down2:s,boost1:l,boost2:n}=S;t.isDown||e.isDown?this.goLeft():v.isDown||a.isDown?this.goRight():o.isDown||r.isDown?this.goUp():(i.isDown||s.isDown)&&this.goDown(),l.isDown||n.isDown?this.speed=Vt/2:this.speed=Vt,this.move(Y)}move(Y){if(Y{this.setTint(16711680),this.isWall=!0}})}kill(){this.animation.stop(),this.animation.remove(),this.isAlive=!1,this.destroy()}}const kt=st.snakeSprites;class Xi extends Phaser.Scene{constructor(){const Y={key:"SnakeAll",cameras:{x:0,y:8,width:1280,height:704}};super(Y)}init(){const{width:Y,height:c}=this.cameras.main;this.MAX_WIDTH=Math.floor(Y/st.snakeTileSize)-1,this.MAX_HEIGHT=Math.floor(c/st.snakeTileSize)-1,this.isAlive=!0}create(){this.scene.launch("SnakeAllUI");{const{width:Y,height:c}=this.cameras.main,S=8,t=this.add.graphics();t.fillStyle(65280),t.fillRect(S,S,Y-S*2,c-S*2)}this.player=new Ni(this,8,8),this.apples=[],this.newAppleTimer=this.time.addEvent({delay:500,callback:this.newApple,callbackScope:this,loop:!0}),lt.removeListener(ht.gameOver),lt.on(ht.gameOver,Y=>{this.isAlive=!1,this.player.isAlive=!1,this.newAppleTimer.paused=!0,this.tweens.pauseAll()}),lt.removeListener(ht.restartGame),lt.on(ht.restartGame,Y=>{this.scene.restart()})}newApple(){const{snakeTileSize:Y}=st,c=Phaser.Math.Between(1,this.MAX_WIDTH),S=Phaser.Math.Between(1,this.MAX_HEIGHT);if(this.apples.find(e=>e.x===c*Y&&e.y===S*Y)||this.player.body.getChildren().find(e=>e.x===c*Y&&e.y===S*Y))return;const t=new Yi(this,c,S,kt[Phaser.Math.Between(0,kt.length-1)]);this.apples.push(t)}update(Y){!this.isAlive||(this.player.update(Y),this.apples.forEach(c=>{if(this.player.head.x===c.x&&this.player.head.y===c.y&&c.isAlive){if(c.isWall){lt.emit(ht.gameOver),c.setDepth(1e5);return}this.player.grow(c.spriteName),c.kill(),lt.emit(ht.increaseScore,1,c,c.spriteName)}}))}}class zi extends Phaser.Scene{constructor(){super({key:"SnakeAllUI"})}init(){this.score=0}create(){st.debug&&new Yt(this),this.scoreLabel=this.add.text(this.scale.width/2,50,this.score,ct.snake.scoreLabel).setOrigin(.5),this.exitButton=new Gt(this,{x:this.scale.width-50,y:50,up:1,down:0,over:1,text:Et.getText("exit"),upCallback:()=>{this.scene.stop("SnakeAll"),this.scene.start("Start"),this.scene.stop("SnakeAllUI")}}).setScale(.25),this.restartButton=new Gt(this,{x:this.scale.width/2,y:this.scale.height/2,up:1,down:0,over:1,text:Et.getText("restart"),textStyle:ct.base,upCallback:()=>{lt.emit(ht.restartGame)}}).changeVisibility(!1);const Y=this.add.particles("SquaresParticles");this.scoreParticles=Y.createEmitter({frame:Ft(0,9),x:this.scoreLabel.x,y:this.scoreLabel.y,quantity:64,frequency:-1,scale:{start:.75,end:0},alpha:{start:.75,end:0},angle:{start:0,end:360,steps:64},rotate:{start:Tt(-360,360),end:Tt(-360,360)},speed:{min:500,max:750},lifespan:1e3}),lt.on(ht.gameOver,c=>this.restartButton.changeVisibility(!0)),lt.removeListener(ht.increaseScore),lt.on(ht.increaseScore,this.createNewScoreLabel.bind(this)),lt.removeListener(ht.updateScore),lt.on(ht.updateScore,c=>{this.scoreParticles.explode(),this.score+=c,this.scoreLabel.setText(this.score)})}createNewScoreLabel(Y,{x:c,y:S},t){new ee(this,c,S,Y,t).animate(this.scoreLabel)}}function Vi(k,Y,c=0,S=0){const t=k.add.particles("PlayerShip"),e=k.add.particles("SquaresParticles"),v=e.createEmitter({x:0,y:0,frame:Ft(0,9),quantity:1,frequency:-1,scale:{start:.5,end:0},alpha:{start:.5,end:0},speed:{min:50,max:150},rotate:{start:0,end:360},lifespan:{min:250,max:500}}),a=t.createEmitter({follow:Y,quantity:64,frequency:-1,scale:{start:.75,end:0},alpha:{start:.75,end:0},angle:{start:0,end:360,steps:64},rotate:{start:Tt(-360,360),end:Tt(-360,360)},speed:{min:500,max:750},lifespan:500}),o=t.createEmitter({follow:Y,quantity:1,speedX:{min:-500,max:-250},speedY:{min:-250,max:250},scale:{start:.75,end:0},alpha:{start:.5,end:0},rotate:{start:0,end:360},lifespan:{min:100,max:500}}),r={follow:Y,moveToX:0,alpha:{start:.5,end:.25},deathCallback:({x:l,y:n})=>{v.setPosition(l,n),v.explode()}},i=e.createEmitter({...r,frame:Ft(0,9),moveToY:{min:k.scale.height/2-150,max:k.scale.height/2+150},scale:{start:.4,end:.25},quantity:4}),s=e.createEmitter({...r,frame:[3],moveToY:k.scale.height/2,scale:.4,quantity:1});return{explosionEmitter1:v,hittedEmitter:a,moveEmitter1:o,moveEmitter2A:i,moveEmitter2B:s}}function Wi(k,Y,c,S=0,t=0){const e=k.add.particles(c),v=e.createEmitter({x:S,y:t,follow:Y,quantity:1,speedX:{min:-500,max:-250},speedY:{min:-250,max:250},scale:{start:.33,end:0},alpha:{start:.5,end:0},rotate:{start:0,end:360},lifespan:{min:100,max:500}}),a=k.add.particles(c),o=a.createEmitter({x:S,y:t,follow:Y,quantity:100,frequency:-1,scale:{start:.75,end:0},alpha:{start:.75,end:0},speed:{min:50,max:150},rotate:{start:0,end:360},lifespan:{min:250,max:750}});return{moveParticles:e,moveParticlesEmitter:v,explosionParticles:a,explosionParticlesEmitter:o}}function wi(k,Y,c=0,S=0){const t=k.add.particles("Duke"),e=t.createEmitter({x:c,y:S,follow:Y,quantity:1,frequency:100,speedX:{min:500,max:250},speedY:{min:250,max:-250},scale:{start:.5,end:0},alpha:{start:.5,end:0},rotate:{start:-90,end:Tt(-360,360)},lifespan:{min:100,max:500}}),v=t.createEmitter({x:c,y:S,follow:Y,quantity:32,frequency:-1,scale:{start:.75,end:0},alpha:{start:.75,end:0},angle:{start:0,end:360,steps:32},rotate:{start:-90,end:270},tint:16711680,speed:200,lifespan:500});return{particles:t,particlesEmitter:e,deadParticlesEmitter:v}}class Hi extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t){super(Y,c,S,t),Y.physics.add.existing(this),this.speed=400,this.setPosition(c,S),this.setDepth(1),this.initialAnimation=Y.tweens.add({targets:this,ease:"Power4",duration:500,scale:{from:1,to:.5},onUpdate:()=>this.refreshBody()});const{moveParticles:e,moveParticlesEmitter:v,explosionParticles:a,explosionParticlesEmitter:o}=Wi(Y,this,t,c,S);this.moveParticles=e,this.moveParticlesEmitter=v,this.explosionParticles=a,this.explosionParticlesEmitter=o,this.explosionParticlesEmitter.explode(),this.killTimer=Y.time.addEvent({delay:500,callback:()=>{this.explosionParticlesEmitter.stop(),this.explosionParticles.destroy(),this.killTimer.remove(),this.destroy()},callbackScope:this,loop:!1,repeat:0,paused:!0})}particlesExplode(){this.explosionParticlesEmitter.explode()}preUpdate(){this.scene.scale.widththis.refreshBody(),onComplete:()=>{this.setTint(16777215),this.moveEmitter1.setTint(16777215),this.moveEmitter2A.start(),this.moveEmitter2B.start()}}),this.keys=Y.input.keyboard.addKeys(st.controllers.shootUp),Y.input.on("pointermove",({x:o,y:r})=>this.setPosition(o,r)),Y.input.on("pointerdown",this.fire,this)}hitted(){this.setTint(16711680),this.moveEmitter1.setTint(16711680),this.particlesExplode(),this.moveEmitter2A.stop(),this.moveEmitter2B.stop(),this.hittedTween.isPlaying()?this.hittedTween.restart():this.hittedTween.play()}particlesExplode(){for(let Y=0;Y<5;Y++)this.hittedEmitter.explode()}update(Y){if(this.time=Y,!this.keys)return;this.keys.shoot.isDown&&Y>this.timeNextFire&&this.fire()}fire(){const Y=wt(Zi);this.shootGroup.getNewShoot(this.x,this.y,Y)&&(this.timeNextFire=this.time+this.marginShoots)}}class Qi extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){super(Y,c,S,"Duke"),this.shootDelay=Phaser.Math.Between(1e3,1e4),this.setDepth(1),this.setAngle(-90),this.setScale(.75),this.shootTimer=Y.time.addEvent({delay:this.shootDelay,callback:this.fire,callbackScope:this,loop:!0});const{particles:t,particlesEmitter:e,deadParticlesEmitter:v}=wi(Y,this);this.particles=t,this.particlesEmitter=e,this.deadParticlesEmitter=v}fire(){const Y=this.scene.enemiesShootsGroup.getNewShoot(this.x,this.y);Y&&Y.setVelocityX(-400)}kill(){this.setTint(16711680),this.setVisible(!1),this.disableBody(),this.shootTimer.paused=!0,this.shootTimer.remove(),this.particlesEmitter.stop(),this.deadParticlesEmitter.explode();const Y=this.scene.time.addEvent({delay:500,callback:()=>{this.deadParticlesEmitter.stop(),this.particles.destroy(),Y.remove(),this.destroy()},callbackScope:this,loop:!1,repeat:0})}preUpdate(){-this.width>this.x&&this.kill()}}class $i extends Phaser.Physics.Arcade.Group{constructor(Y,c){const S={classType:Qi,runChildUpdate:!0};super(Y,c,S)}getNewEnemy(Y=0,c=0){const S=this.get(Y,c);if(S)return S.setVelocityX(-Phaser.Math.Between(50,250)),S}}class bi extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){super(Y,c,S,"Duke"),Y.physics.add.existing(this),this.speed=400,this.setDepth(1),this.setAngle(-90),this.setScale(.25)}preUpdate(){-this.width>this.x&&this.kill()}kill(){this.destroy()}}class ji extends Phaser.Physics.Arcade.Group{constructor(Y,c){const S={classType:bi,runChildUpdate:!0};super(Y,c,S)}getNewShoot(Y=0,c=0){const S=this.get(Y,c);if(S)return S.setVelocityX(-400),S}}const Dt={updateScore:"updateScore",scoreCollision:"scoreCollision"},It=new Phaser.Events.EventEmitter;class ki extends Phaser.Scene{constructor(){const Y={key:"Web"};super(Y)}create(){new Ht(this),this.scene.launch("WebUI"),this.createPlayer(),this.enemiesGroup=new $i(this.physics.world,this),this.enemiesShootsGroup=new ji(this.physics.world,this),this.enemiesTimer=this.time.addEvent({delay:500,callback:this.createEnemies,callbackScope:this,loop:!0}),this.physics.add.overlap(this.player,this.enemiesGroup,(Y,c)=>{Y.hitted(),c.kill(),It.emit(Dt.scoreCollision,-1,{x:c.x,y:c.y})}),this.physics.add.overlap(this.player,this.enemiesShootsGroup,(Y,c)=>{Y.hitted(),c.kill(),It.emit(Dt.scoreCollision,-1,{x:c.x,y:c.y})}),this.physics.add.overlap(this.player.shootGroup,this.enemiesGroup,(Y,c)=>{Y.kill(),c.kill(),It.emit(Dt.scoreCollision,10,{x:Y.x,y:Y.y})}),this.physics.add.overlap(this.player.shootGroup,this.enemiesShootsGroup,(Y,c)=>{Y.particlesExplode(),c.kill(),It.emit(Dt.scoreCollision,100,{x:Y.x,y:Y.y})})}createPlayer(){const{width:Y,height:c,middleWidth:S,middleHeight:t}=st.screen;this.playersGroup=this.physics.add.group({classType:Ji,runChildUpdate:!0,collideWorldBounds:!0}),this.player=this.playersGroup.get(S,t)}createEnemies(){const Y=this.scale.width+50,c=Phaser.Math.Between(50,this.scale.height-50);this.enemiesGroup.getNewEnemy(Y,c)}}class qi extends Phaser.Scene{constructor(){super({key:"WebUI"})}init(){this.score=0}create(){st.debug&&new Yt(this),this.scoreLabel=this.add.text(this.scale.width/2,50,this.score,ct.web.scoreLabel).setOrigin(.5),this.exitButton=new Gt(this,{x:this.scale.width-50,y:50,up:1,down:0,over:1,text:Et.getText("exit"),upCallback:()=>{this.scene.stop("Web"),this.scene.start("Start"),this.scene.stop("WebUI")}}).setScale(.25);const Y=this.add.particles("SquaresParticles");this.scoreParticles=Y.createEmitter({frame:Ft(0,9),x:this.scoreLabel.x,y:this.scoreLabel.y,quantity:64,frequency:-1,scale:{start:.75,end:0},alpha:{start:.75,end:0},angle:{start:0,end:360,steps:64},rotate:{start:Tt(-360,360),end:Tt(-360,360)},speed:{min:500,max:750},lifespan:1e3}),It.on(Dt.scoreCollision,(c,{x:S,y:t})=>{new _i(this,S,t,c).animate(this.scoreLabel)}),It.on(Dt.updateScore,(c,S)=>{this.scoreParticles.explode(),this.score+=c,this.scoreLabel.setText(this.score),this.scoreLabel.setColor(S)})}}class _i extends Phaser.GameObjects.Text{constructor(Y,c=10,S=10,t=0,e=ct.web.updateScoreLabel){super(Y,c,S,t,e),Y.add.existing(this),this.score=t,this.setDepth(1e3),this.setOrigin(.5),this.setColor(t>0?"#0f0":"#f00")}animate({x:Y,y:c}){this.scene.tweens.add({targets:[this],duration:1e3,ease:"Linear",x:Y,y:c,scale:2,onComplete:()=>this.kill()})}kill(){It.emit(Dt.updateScore,this.score,this.style.color),this.destroy()}}function ts(k,Y){const c=k.add.particles("SquaresParticles"),S=c.createEmitter({x:0,y:0,frame:Ft(0,9),quantity:50,frequency:-1,scale:{start:1,end:0},alpha:{start:1,end:0},speed:{min:50,max:150},rotate:{start:0,end:360},lifespan:1e3}),t=c.createEmitter({follow:Y,frame:Ft(0,9),quantity:1,speedX:{min:-100,max:100},speedY:{min:-20,max:20},scale:{start:.5,end:0},alpha:{start:.5,end:0},rotate:{min:-360,max:360},lifespan:{min:100,max:500}});return{SQUARES_PARTICLES:c,explosionEmitter:S,moveEmitter:t}}function es(k,Y,c,S=0,t=0){const e=k.add.particles(c),v=e.createEmitter({x:S,y:t,follow:Y,quantity:1,speedX:{min:-100,max:100},speedY:{min:100,max:250},scale:{start:.5,end:0},alpha:{start:.5,end:0},lifespan:{min:100,max:500}});return{moveParticles:e,moveParticlesEmitter:v}}class is extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t){super(Y,c,S,t),Y.physics.add.existing(this),t==="Phaser"&&this.setAngle(-90),this.type=t,this.speed=-400,this.setDepth(1);const{moveParticles:e,moveParticlesEmitter:v}=es(Y,this,t,c,S);this.moveParticles=e,this.moveParticlesEmitter=v}preUpdate(){0>this.y&&this.kill()}kill(){this.moveParticlesEmitter.stop(),this.moveParticles.destroy(),this.destroy()}}class ss extends Phaser.Physics.Arcade.Group{constructor(Y,c){const S={classType:is,runChildUpdate:!0};super(Y,c,S),this.lastIndex=0}getNewShoot(Y=0,c=0){const S=ns(st.gamingSprites,this.lastIndex);this.lastIndex=S.index;const t=this.get(Y,c,S.element);return t.setVelocityY(t.speed),t}}function ns(k,Y=0){return k.length===Y+1?{element:k[0],index:0}:{element:k[Y+1],index:Y+1}}class rs extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S){super(Y,c,S,"Duke"),this.timeNextFire=0,this.marginShoots=100,this.speed=300,this.setDepth(10),this.setScale(.75),this.isAlive=!0,this.shootGroup=new ss(Y.physics.world,Y);const{SQUARES_PARTICLES:t,explosionEmitter:e,moveEmitter:v}=ts(Y,this);this.particles=t,this.explosionEmitter=e,this.moveEmitter=v,this.keys=Y.input.keyboard.addKeys(st.controllers.gaming)}update(Y){if(!this.keys||!this.isAlive)return;const{left1:c,left2:S,right1:t,right2:e,shoot1:v,shoot2:a,shoot3:o}=this.keys;c.isDown||S.isDown?this.setVelocityX(-this.speed):t.isDown||e.isDown?this.setVelocityX(this.speed):this.setVelocityX(0),(v.isDown||a.isDown||o.isDown)&&Y>this.timeNextFire&&this.fire(Y)}fire(Y){const c=wt(st.gamingSprites);this.shootGroup.getNewShoot(this.x,this.y,c)&&(this.timeNextFire=Y+this.marginShoots)}hitted(){this.isAlive=!1,this.setTint(16711680),this.explosionEmitter.setPosition(this.x,this.y),this.explosionEmitter.explode(),this.moveEmitter.stop()}}class as extends Phaser.Physics.Arcade.Sprite{constructor(Y,c,S,t){super(Y,c,S,t),this.type=t}kill(){this.destroy()}}class os extends Phaser.Physics.Arcade.Group{constructor(Y,c){const S={classType:as,runChildUpdate:!0};super(Y,c,S),this.generateAllEnemies()}generateAllEnemies(){for(let Y=0;Y<5;Y++)for(let c=0;c<20;c++){const S=wt(st.gamingSprites);this.getNewEnemy(c*50+100+Y*2,Y*50+20,S)}this.setVelocityX(100)}getNewEnemy(Y=0,c=0,S="Sprite"){return this.get(Y,c,S)}}class hs extends Phaser.Scene{constructor(){super({key:"Gaming"})}init(){lt.removeListener(ht.restartGame)}create(){const{width:Y,height:c,middleWidth:S,middleHeight:t}=st.screen;this.scene.launch("GamingUI"),this.playersGroup=this.physics.add.group({classType:rs,runChildUpdate:!0,collideWorldBounds:!0}),this.player=this.playersGroup.get(S,c-50);const e=[this.add.zone(0,t),this.add.zone(Y,t)];for(let v=0;v{this.enemiesGroup.setVelocityX(a.body.velocity.x*-1),this.enemiesGroup.getChildren().forEach(o=>{const r=Number(o.body.velocity.x>0)?1:-1;o.setPosition(o.x+r,o.y+10)})},null,this),this.physics.add.overlap(this.enemiesGroup,this.player.shootGroup,(v,a)=>{v.type===a.type&&(lt.emit(ht.increaseScore,1,{...v},v.type),v.kill(),a.kill(),this.player.marginShoots+=10,this.enemiesGroup.countActive()===0&&this.enemiesGroup.generateAllEnemies())},null,this),this.physics.add.overlap(this.enemiesGroup,this.player,()=>{lt.emit(ht.gameOver),this.player.hitted(),this.physics.pause(),this.tweens.pauseAll()}),lt.on(ht.restartGame,()=>{this.scene.restart()})}}class ls extends Phaser.Scene{constructor(){super({key:"GamingUI"})}init(){this.score=0}create(){st.debug&&new Yt(this),this.scoreLabel=this.add.text(this.scale.width/2,50,this.score,ct.snake.scoreLabel).setOrigin(.5),this.exitButton=new Gt(this,{x:this.scale.width-50,y:50,up:1,down:0,over:1,text:Et.getText("exit"),upCallback:()=>{this.scene.stop("Gaming"),this.scene.start("Start"),this.scene.stop("GamingUI")}}).setScale(.25),this.restartButton=new Gt(this,{x:this.scale.width/2,y:this.scale.height/2,up:1,down:0,over:1,text:Et.getText("restart"),textStyle:ct.base,upCallback:()=>{lt.emit(ht.restartGame)}}).changeVisibility(!1);const Y=this.add.particles("SquaresParticles");this.scoreParticles=Y.createEmitter({frame:Ft(0,9),x:this.scoreLabel.x,y:this.scoreLabel.y,quantity:64,frequency:-1,scale:{start:.75,end:0},alpha:{start:.75,end:0},angle:{start:0,end:360,steps:64},rotate:{start:Tt(-360,360),end:Tt(-360,360)},speed:{min:500,max:750},lifespan:1e3}),lt.removeListener(ht.gameOver),lt.on(ht.gameOver,c=>this.restartButton.changeVisibility(!0)),lt.removeListener(ht.increaseScore),lt.on(ht.increaseScore,this.createNewScoreLabel.bind(this)),lt.removeListener(ht.updateScore),lt.on(ht.updateScore,c=>{this.scoreParticles.explode(),this.score+=c,this.scoreLabel.setText(this.score)})}createNewScoreLabel(Y,{x:c,y:S},t){new ee(this,c,S,Y,t).animate(this.scoreLabel)}}console.clear();const fs={title:zt.name,url:zt.homepage,version:zt.version,banner:{text:bt.text,background:bt.background,hidePhaser:!1},parent:"GameContainer",type:Ut.AUTO,width:st.screen.width,height:st.screen.height,backgroundColor:"#757575",scale:{mode:Ut.Scale.FIT,autoCenter:Ut.Scale.CENTER_BOTH},transparent:!1,roundPixels:!0,render:{antialias:!0,antialiasGL:!0,pixelArt:!1},physics:{default:"arcade",arcade:{debug:st.debug,gravity:{x:0,y:0}}},scene:[mi,gi,Ci,Ri,Bi,Gi,Xi,zi,ki,qi,hs,ls]};new Ut.Game(fs);
diff --git a/index.html b/index.html
index 59e315b..5e830bb 100644
--- a/index.html
+++ b/index.html
@@ -7,7 +7,7 @@
201flaviosilva
-
+