From 026af8bdd2c5b451b40f3892234726e1dadfa9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Tue, 10 Jan 2017 01:22:59 +0100 Subject: [PATCH] Added ship frame in arena to know which side they are on --- graphics/ui/actions.svg | 91 ++++---- graphics/ui/battle.svg | 204 ++++++++++-------- out/assets/images/battle/arena/ship-hover.png | Bin 0 -> 1651 bytes .../images/battle/arena/ship-normal-enemy.png | Bin 0 -> 261 bytes .../images/battle/arena/ship-normal-own.png | Bin 0 -> 266 bytes .../battle/arena/ship-playing-enemy.png | Bin 0 -> 469 bytes .../images/battle/arena/ship-playing-own.png | Bin 0 -> 464 bytes .../images/battle/arena/shipspritehover.png | Bin 1443 -> 0 bytes .../images/battle/arena/shipspriteplaying.png | Bin 409 -> 0 bytes src/view/Boot.ts | 2 +- src/view/Preload.ts | 9 +- src/view/battle/ArenaShip.ts | 23 +- src/view/battle/ShipListItem.ts | 2 +- 13 files changed, 187 insertions(+), 144 deletions(-) create mode 100644 out/assets/images/battle/arena/ship-hover.png create mode 100644 out/assets/images/battle/arena/ship-normal-enemy.png create mode 100644 out/assets/images/battle/arena/ship-normal-own.png create mode 100644 out/assets/images/battle/arena/ship-playing-enemy.png create mode 100644 out/assets/images/battle/arena/ship-playing-own.png delete mode 100644 out/assets/images/battle/arena/shipspritehover.png delete mode 100644 out/assets/images/battle/arena/shipspriteplaying.png diff --git a/graphics/ui/actions.svg b/graphics/ui/actions.svg index a867fb1..da34616 100644 --- a/graphics/ui/actions.svg +++ b/graphics/ui/actions.svg @@ -9,11 +9,11 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="210mm" - height="297mm" + width="256" + height="256" id="svg2" version="1.1" - inkscape:version="0.48.4 r9939" + inkscape:version="0.91 r13725" sodipodi:docname="actions.svg" inkscape:export-filename="/home/michael/workspace/spacetac/graphics/ui/temp.png" inkscape:export-xdpi="90" @@ -24,7 +24,7 @@ clipPathUnits="userSpaceOnUse" id="clipPath3925"> @@ -37,12 +37,12 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="1.4" - inkscape:cx="444.96825" - inkscape:cy="400.52375" + inkscape:zoom="1.979899" + inkscape:cx="122.81513" + inkscape:cy="168.49069" inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="true" + inkscape:current-layer="layer2" + showgrid="false" inkscape:window-width="1920" inkscape:window-height="1030" inkscape:window-x="0" @@ -51,7 +51,8 @@ inkscape:snap-global="true" inkscape:snap-bbox="false" inkscape:snap-nodes="true" - inkscape:snap-bbox-midpoints="false"> + inkscape:snap-bbox-midpoints="false" + units="px"> @@ -69,52 +70,60 @@ - - - + id="layer1" + transform="translate(0,-796.36216)"> + inkscape:export-ydpi="90" + transform="matrix(0.61036973,0,0,0.61036973,-76.47386,495.66155)"> + style="fill:#43903f;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + style="fill:#4a6c48;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + + + + + + + diff --git a/graphics/ui/battle.svg b/graphics/ui/battle.svg index 1986bcf..6d5c571 100644 --- a/graphics/ui/battle.svg +++ b/graphics/ui/battle.svg @@ -77,6 +77,24 @@ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.5999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + + + + - - - - + inkscape:connector-curvature="0" + mask="url(#mask5923)" + inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/ship-playing-enemy.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + - - - - - + inkscape:export-ydpi="90"> + + + + + + + y="139" + inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/ship-tooltip.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + y="192" + inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/ship-tooltip.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> + y="370" + inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/battle/ship-tooltip.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" /> ~HP8~>Ow7MG^Z%#Y5ngj0%>Bcz$pNE?SpYivV)Bxa7LF|z4 zl{l%3v>Bx<$8DEa#Ok!T$<=V(?*91x_x(Pv*YkSb@AvEZ<9VLf^LidmSZJUz6afVQ zz&Hqt#%trhZlJG4kDOVx+5pb<4+=NX+8Kicww4>7!bWFm^C$mt9e;<~9Ia@c6%dt0 zNT+1cPn;$LbUNK7DeYut{E1U!m-N%rT9r2f0Q8oE&fT+AN!c0!fAsk!uAycs zm0kn6*??XoO9MjCTUb5Oe!*QNur9qy1wq-%ir9TKYSnbj|vG6F}e?l{EO| zS-H}2*K0W0sOj$a0aQn`o#^Qv8pJj_&x2VjP1%@iZ}Zxx%aveChnj^P4Ey`cUdF@z zUM-{`3B6bw7(jaWbc1N=;!sgQWD)_m)Z&C?c~9V<<3|T!SX&t2rvzr^EMpw|QYDw4 zfr$I4&4+Luvh02m)_zZYSsig+CDOyl?P(SwNj9KHNgu8!rEs#n*<}QqAySppa$9;? z-!H&d`oQSACHwUC%dMpzx`vTpVLKLJi!r-EIZoFb<380U{Cdd~Z*x^ElDic~%3_-S zN)%>o9~;+HiMLY(#RI8-z^B|?QQPsQU?v*xMCvX}U4r9pmWT*8?QxzV?*?TrJ0 z-@zKN2a1q-TS~X09q=aqo75vAYh58pih+~jpGL}gw_e04drg)R>aD_Z^%=AEzNggp zRtR{sTi5d34h28WRkQfx;;TnjTCX5FJcoXp2G4(RQ>~{ed1Hj@zo@|;dlo`(Qk1;V z$s?aZY7HrKLvHKN6c4+^>@TTjM1^65Cn!UUJ$zw%Cj^*=3hssbyeULptA2NTc_^NOzY#w zV@uhnqjcFfFpMS6ONLo1()O(}-laQ=JD5v}PaRh2B{~_<^a$m>rMIq_AJ=&D-`^I4 z2GE0ds1AO#W34Tsi)?r)$(HU*`3>waS1ziLxBdtdGR3=Rselw3Hwt6~uHO*H&cCxG za1);oSa6c1fC^+=>oF2_AS~bhK~?_P>qBF#M2_0V^E8l=rP@)rN9|ZQoP#w&v%}q1TQF!(=_5?JsgKK&vCbK1b8e znj=4L_xs+izD&+ftXPj$ZHj;zKfddWm_~{?Z=yfOcIuo(rZW3Rd%5K01jX%V6;Ylh zT#J*FKKI;O-F4-9Gk9S=32BaAyAym2aTw!ewyXI_#t|o$-t8(YE#3A!`imbJL-V=$ z2^p=*GnZI>7SrAFdrdoUB_<{*AxkaV5theUf9Mx@2aKH*dKu5G;7UYjQX7}wjM#L~ z#_a#E;eQvjXaxx&Ock?)iw^{u)&3fOSi~bn&9>dl9ff0fBVotL{qR+5l(+uy>_N>E z4lgN<0hiW6Ii4;jbbWkGFdteorj7K(&od4168nK@t17@$@ z|Cz`DxWULKY=lq&nn6`Gd}@u^(4;IZv$Bw~>M2}VWc!!!DLKQ_s6V-RlrlaKa6|3- z-kuv#B;!`B*)PX=cv-vV{tbvzK{zr*kqZbQJ1PwKEims|weVl3XE&Wg%}ZEr+Oo(q z*ZL7R{fhH2#d*!A0xfm>5~g=LU%*})&(#@hBX>KyBia_Ij)%2JYmcHT)TBiu_W{wG z@+LUEk#HA$zk8kIQK&!t4Uez_D)?-gyAzGN_#yDCg0kNW{@`1~d`N@7pDN&jC0A!s hC8@J_i$MVN)!E!wxqC1cZm4|_Ku|y^y4{~x_&2=+=SBbk literal 0 HcmV?d00001 diff --git a/out/assets/images/battle/arena/ship-normal-enemy.png b/out/assets/images/battle/arena/ship-normal-enemy.png new file mode 100644 index 0000000000000000000000000000000000000000..66af1ba8346af620aae2937eb800b64a9900c201 GIT binary patch literal 261 zcmeAS@N?(olHy`uVBq!ia0vp^ZXnFT1|$ph9<=}|&H|6fVxatW5N34Jm|X!BWH0gb zb!C6Z$i;8MCvx9t9#CkBr;B4q#jUq@Z2g!LMOq(zHoW7}y5_*Gvp1xo!`#dj+ve47 z5L(*WDOSd3-`UA)<6phYeEUAm1OH!4o^`_DTY%{bpdl#W&%x?TW}&{FmkZNo|N2?J z@Pfs;njq6TyqmqmKEM2u>miqK=rFzJUH|c~Mn8Y-{dzLkI{59*)wk+YyQBB@O?%UR r_~BF2n{#ixGd{J|;_bY}F|G~R#Bv6n#Iel*}Z>+1>^H?JqVbm*Zs9-cfG*!$y%#QgC|ZGyjb_S vS?2$_>F=+;Pb;@x!r%AF#P8P!jj4s}yu)=Oa^qM`LH2mM`njxgN@xNA4{u&$ literal 0 HcmV?d00001 diff --git a/out/assets/images/battle/arena/ship-playing-enemy.png b/out/assets/images/battle/arena/ship-playing-enemy.png new file mode 100644 index 0000000000000000000000000000000000000000..208b7671bc46ce318b196f86c5eeafc8e8019a88 GIT binary patch literal 469 zcmeAS@N?(olHy`uVBq!ia0vp^ZXnFT1|$ph9<=}|&H|6fVxatW5N34Jm|X!BWH0gb zb!C6Z$i;7A{D8@@nSp_^#M8wwq~g}wI~%>GX0@bm0f4H;>}1 z{$H4FwRx9yhxmhluI{@m?D`H#-Odx|y}ID0qIUOf<$Ybt$WIg2#4n5QJ=-_;`}awG zQ^Jla9lICFasFxVnqMwW7WDyHi9&~0x=vh@lX7jH^^6%$=ilR>cIlv5mqq3-;m21! zIX1t#d1B36TfX-7rzP}vE829Ln7y`m|9;MrJC*g;X4b5!tx7AOUii5{^RC8qZ`QQJ{&M!HWyvLIN;od4Uqil2D*CloQ4mpLJmvzq2Nu1Ja5&1}?*W&(@ XdlSPSL~Pp&j1mS1WY}{rO_>&Z?suN;^2?K#Jx*UWWy!~lrEelHO+2La zy;a`l*yZb=4!p`|>Db(Oi9=YzPq|Aaa?-KA%epJgx>b5rWZ!6<3c7Uo>CdmL9v*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YmG3ajC_k;V26eEj(0|U8) z7n?*D+l}+RT-@i>A3K>D7^~~r#`dHioB3h?OPxP&U)?%XRbOIQ=U=t%*|x*cb?&XN v4>80w+$~X)QG05BAiMD?Ep>u6{1-oD!M<-!6>K diff --git a/src/view/Boot.ts b/src/view/Boot.ts index 2b689c3..3df6de8 100644 --- a/src/view/Boot.ts +++ b/src/view/Boot.ts @@ -2,7 +2,7 @@ module SpaceTac.View { export class Boot extends Phaser.State { preload() { this.game.stage.backgroundColor = 0x202020; - this.add.text(640, 340, "... Loading ...", {align: "center", font: "bold 20px Arial", fill: "#c0c0c0"}) + this.add.text(this.world.width / 2, this.world.height / 2 - 40, "... Loading ...", { align: "center", font: "bold 20px Arial", fill: "#c0c0c0" }) .anchor.set(0.5, 0.5); this.load.image("preload-bar", "assets/images/preloader.gif"); diff --git a/src/view/Preload.ts b/src/view/Preload.ts index 6dc79bc..0bcfe25 100644 --- a/src/view/Preload.ts +++ b/src/view/Preload.ts @@ -6,7 +6,7 @@ module SpaceTac.View { preload() { // Add preload sprite - this.add.text(640, 340, "... Loading ...", { align: "center", font: "bold 20px Arial", fill: "#c0c0c0" }) + this.add.text(this.getMidWidth(), this.getMidHeight() - 40, "... Loading ...", { align: "center", font: "bold 20px Arial", fill: "#c0c0c0" }) .anchor.set(0.5, 0.5); this.preloadBar = this.add.sprite(0, 0, "preload-bar"); this.preloadBar.anchor.set(0.5, 0.5); @@ -38,8 +38,11 @@ module SpaceTac.View { this.loadImage("battle/actionpointsfull.png"); this.loadImage("battle/actionpointspart.png"); this.loadImage("battle/ship-tooltip.png"); - this.loadImage("battle/arena/shipspritehover.png"); - this.loadImage("battle/arena/shipspriteplaying.png"); + this.loadImage("battle/arena/ship-hover.png"); + this.loadImage("battle/arena/ship-normal-enemy.png"); + this.loadImage("battle/arena/ship-normal-own.png"); + this.loadImage("battle/arena/ship-playing-enemy.png"); + this.loadImage("battle/arena/ship-playing-own.png"); this.loadImage("battle/actions/move.png"); this.loadImage("battle/actions/endturn.png"); this.loadImage("battle/actions/fire-gatlinggun.png"); diff --git a/src/view/battle/ArenaShip.ts b/src/view/battle/ArenaShip.ts index ceb4929..cca4885 100644 --- a/src/view/battle/ArenaShip.ts +++ b/src/view/battle/ArenaShip.ts @@ -4,20 +4,24 @@ module SpaceTac.View { // Link to displayed ship ship: Game.Ship; + // Boolean to indicate if it is an enemy ship + enemy: boolean; + // Ship sprite sprite: Phaser.Button; // Hover effect hover: Phaser.Image; - // Playing effect - playing: Phaser.Image; + // Frame to indicate the owner of the ship, and if it is playing + frame: Phaser.Image; // Create a ship sprite usable in the Arena constructor(battleview: BattleView, ship: Game.Ship) { super(battleview.game); this.ship = ship; + this.enemy = this.ship.getPlayer() != battleview.player; // Add ship sprite this.sprite = new Phaser.Button(battleview.game, 0, 0, "ship-" + ship.model + "-sprite"); @@ -25,18 +29,17 @@ module SpaceTac.View { this.sprite.anchor.set(0.5, 0.5); this.addChild(this.sprite); + // Add playing effect + this.frame = new Phaser.Image(battleview.game, 0, 0, `battle-arena-ship-normal-${this.enemy ? "enemy" : "own"}`, 0); + this.frame.anchor.set(0.5, 0.5); + this.addChild(this.frame); + // Add hover effect - this.hover = new Phaser.Image(battleview.game, 0, 0, "battle-arena-shipspritehover", 0); + this.hover = new Phaser.Image(battleview.game, 0, 0, "battle-arena-ship-hover", 0); this.hover.anchor.set(0.5, 0.5); this.hover.visible = false; this.addChild(this.hover); - // Add playing effect - this.playing = new Phaser.Image(battleview.game, 0, 0, "battle-arena-shipspriteplaying", 0); - this.playing.anchor.set(0.5, 0.5); - this.playing.visible = false; - this.addChild(this.playing); - // Handle input on ship sprite this.sprite.input.useHandCursor = true; this.sprite.onInputOver.add(() => { @@ -62,7 +65,7 @@ module SpaceTac.View { // Set the playing state on this ship // This will toggle the "playing" indicator setPlaying(playing: boolean) { - Animation.setVisibility(this.game, this.playing, playing, 500); + this.frame.loadTexture(`battle-arena-ship-${playing ? "playing" : "normal"}-${this.enemy ? "enemy" : "own"}`); } // Move the sprite to a location diff --git a/src/view/battle/ShipListItem.ts b/src/view/battle/ShipListItem.ts index 72fcc9b..798d731 100644 --- a/src/view/battle/ShipListItem.ts +++ b/src/view/battle/ShipListItem.ts @@ -41,7 +41,7 @@ module SpaceTac.View { this.layer_portrait.scale.set(0.3, 0.3); this.addChild(this.layer_portrait); - this.layer_hover = new Phaser.Image(this.game, 30, 30, "battle-arena-shipspritehover", 0); + this.layer_hover = new Phaser.Image(this.game, 30, 30, "battle-arena-ship-hover", 0); this.layer_hover.position.set(5, 5); this.layer_hover.visible = false; this.addChild(this.layer_hover);