From d2fc0871f9d292b93511011d15934ac779cd88b7 Mon Sep 17 00:00:00 2001 From: Job Vonk Date: Mon, 11 May 2020 16:26:40 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=B1=20Added=20logoScreen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- res/asdf-logo.png | Bin 0 -> 2896 bytes src/index.js | 16 ++++++++++------ src/screens/game.js | 2 +- src/screens/logo.js | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 res/asdf-logo.png create mode 100644 src/screens/logo.js diff --git a/res/asdf-logo.png b/res/asdf-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..be7b72be498b2e407733f3bc7f25c5a5fa310a36 GIT binary patch literal 2896 zcma)8XH=8v68;dBV!=icq#RZOMV6&E7c3|Q5fy|;goMsg0!WDn#sG?l2-xVFNC}Wo zvVaL7C9VkU(u))mLLeGQi1Y*`n6O#zJ!g;S?B45-x6J&QnfG~To|%-3jH9X1 zn;%j&waYy9&)j>fP}m}EH*U8j|AdK&bZ5&z;={H?#ifG%$4c}Hk=5D$8-=bn2QEt= z$;r!7oSXJ)3^j@CFu&e+C!e|z-rF20TnQ(unT?w_*3R^HHyDz0EiJXAS}(3I&VOpZ zW|+G@e~ng=^T(T*I7AWug;T?9aCjr1__cy93-S8?X;ntXg zKNOuc+(r(&)9POnR=smMNqCer*~#7+glw<~oK0DuAKX>8Ia&DQQ*MM2qcqrF7Tj=Sl7L6apK@MsCs>8zk!<04EEzdnFbOW9WMv5X z1L$bFpm*PGYvW;3)kGPd?2gZa#9@&2#q%2vY3qdqL6;<72PRM2NmzyWarKZJJ zPg|>e&IJhzJv!bi(V$KNva-1l3+}~Tpp1cO18%$WCLXG2`I1|PTg9#nomM~`zfwcl zX2tJf0wuCWasFB7E1L~BM%^$M*T={=3&_jEupc>C@#MH~;P?lGzN(%=n_pUZmpuAO zjXHwuNorgCL4;C6i1=y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N;e2vlwj209prmwz;MzVr^`s2T`Fw z^dml7+Gr2hSVDzG=h36hR|c(P1xC#RZ}%y{yhv6)Rx8w%yTI@+uWp7OrlIxHy58f9 zbqRu@{+3-Mth^MRgX&M*`?P(gyBkbsT?c}Gpc+o_*G9Q?;~~z0C>;`b*YnSmbbTt* zAvg{}g??C8BJw`UNNVRix4b@k+s1wHagrYkbe80E>|7V4kkoyxY_Hjg-yWo;u?>eH zpwnMq=dS5n&*!zwyy(mGN#ljG5xvhX6w?Vn#1b?w5kNOlorT?4#)=?$#~f%xlxZ9!~ciy z_-BDP(+gWz^oE*dEvHT1{jCC*OO-jX8Vr*n?^_HE#|1L3;FcMMqLNBQqfijn4K82h zyKIkPj)qx}&fym1qH6`p^wBKNat&btBnx1SM^)&ZIZAO3mx3s=~P2M&{~~G z9RD_`;9?DU*Fm!v+ax7h+xN~j62(u}k^{jZlp(#I=>b2ueBG)=k3!#2U<-fMeJ0Ep z19uDViapMI*_Qq;R)a%-GGWzCa(th%45NG { diff --git a/src/screens/game.js b/src/screens/game.js index c37322e..5c2e586 100644 --- a/src/screens/game.js +++ b/src/screens/game.js @@ -26,7 +26,7 @@ class GameScreen extends Container { this.players = {}; // Connect to TanksJS-Server instance - this.socket = io("http://arnweb.nl:3000"); + this.socket = io("http://127.0.0.1:3000"); this.socket.on("identify", () => { this.socket.emit("identification", { name: "Arn", diff --git a/src/screens/logo.js b/src/screens/logo.js new file mode 100644 index 0000000..72c56a3 --- /dev/null +++ b/src/screens/logo.js @@ -0,0 +1,36 @@ +const { Container, Texture, Sprite, Rect } = require("asdf-games"); + +class LogoScreen extends Container { + constructor(onDone) { + super(); + this.onDone = onDone; + // Timer variable + this.period = 0; + // Alpha control variable + this.alpha = 1; + + // Asdf logo in the center of the screen. + const logo = new Sprite(new Texture(__dirname + "/../../res/asdf-logo.png")); + logo.pos = { x: (740 - 412) / 2, y: (480 - 140) / 2 }; + this.add(logo); + + // Overlay to control the fade + const overlay = new Rect(740, 480, { fill: "rgba(0,0,0,1)" }); + this.add(overlay); + } + + update(dt) { + // Update the overlay's alpha. + this.children[1].style.fill = `rgba(0,0,0,${this.alpha})`; + + // If the period is below 2, fade in (alpha <= 0 is fully visible) + // else fade out. + this.alpha += this.period >= 2 ? 2 * dt : -dt; + + // Timer for when the next screen needs to start. + this.period += dt; + if (this.period >= 3) this.onDone(); + } +} + +module.exports = LogoScreen; \ No newline at end of file