diff --git a/src/Marble.hx b/src/Marble.hx index e67a3c93..991ad294 100644 --- a/src/Marble.hx +++ b/src/Marble.hx @@ -1865,7 +1865,7 @@ class Marble extends GameObject { } public function useBlast() { - if (this.level.blastAmount < 0.2 || this.level.game != "ultra") + if (this.level.blastAmount < 0.25 || this.level.game != "ultra") return; var impulse = this.level.currentUp.multiply(Math.max(Math.sqrt(this.level.blastAmount), this.level.blastAmount) * 10); this.applyImpulse(impulse); diff --git a/src/MarbleWorld.hx b/src/MarbleWorld.hx index 18bc8887..c9a61770 100644 --- a/src/MarbleWorld.hx +++ b/src/MarbleWorld.hx @@ -139,6 +139,8 @@ class MarbleWorld extends Scheduler { public var gemCount:Int = 0; public var blastAmount:Float = 0; + var renderBlastAmount:Float = 0; + public var cursorLock:Bool = true; var timeTravelSound:Channel; @@ -446,6 +448,7 @@ class MarbleWorld extends Scheduler { this.bonusTime = 0; this.outOfBounds = false; this.blastAmount = 0; + this.renderBlastAmount = 0; this.outOfBoundsTime = null; this.finishTime = null; @@ -1173,9 +1176,12 @@ class MarbleWorld extends Scheduler { function updateBlast(timestate:TimeState) { if (this.game == "ultra") { if (this.blastAmount < 1) { - this.blastAmount = Util.clamp(this.blastAmount + (timeState.dt / 25), 0, 1); + this.blastAmount = Util.clamp(this.blastAmount + (timeState.dt / 30), 0, 1); + this.renderBlastAmount = this.blastAmount; + } else { + this.renderBlastAmount = Math.min(this.blastAmount, timestate.dt * 0.75 + this.renderBlastAmount); } - this.playGui.setBlastValue(this.blastAmount); + this.playGui.setBlastValue(this.renderBlastAmount); } } @@ -1245,7 +1251,7 @@ class MarbleWorld extends Scheduler { // Show a notification (and play a sound) based on the gems remaining if (this.gemCount == this.totalGems) { - string = "You have all the diamonds, head for the finish!"; + string = "You have all the gems, head for the finish!"; // if (!this.rewinding) AudioManager.playSound(ResourceLoader.getResource('data/sound/gem_all.wav', ResourceLoader.getAudio, this.soundResources)); @@ -1256,13 +1262,13 @@ class MarbleWorld extends Scheduler { // this.touchFinish(completionOfImpact); // } } else { - string = "You picked up a diamond. "; + string = "You picked up a gem. "; var remaining = this.totalGems - this.gemCount; if (remaining == 1) { - string += "Only one diamond to go!"; + string += "Only one gem to go!"; } else { - string += '${remaining} diamonds to go!'; + string += '${remaining} gems to go!'; } // if (!this.rewinding) @@ -1402,7 +1408,7 @@ class MarbleWorld extends Scheduler { if (this.gemCount < this.totalGems) { AudioManager.playSound(ResourceLoader.getResource('data/sound/missinggems.wav', ResourceLoader.getAudio, this.soundResources)); - displayAlert("You can't finish without all the diamonds!!"); + displayAlert("You can't finish without all the gems!"); } else { this.endPad.spawnFirework(this.timeState); this.finishTime = this.timeState.clone(); diff --git a/src/gui/GuiControl.hx b/src/gui/GuiControl.hx index 36c98e19..84b05461 100644 --- a/src/gui/GuiControl.hx +++ b/src/gui/GuiControl.hx @@ -18,6 +18,7 @@ enum HorizSizing { Left; Center; Relative; + Height; } enum VertSizing { @@ -26,6 +27,7 @@ enum VertSizing { Top; Center; Relative; + Width; } typedef MouseState = { @@ -40,6 +42,8 @@ class GuiControl { var position:Vector; var extent:Vector; + var xScale:Float = 1; + var yScale:Float = 1; var children:Array = []; @@ -130,7 +134,7 @@ class GuiControl { if (this.parent != null) { parentRect = this.parent.getRenderRectangle(); - rect.position = parentRect.position.add(this.position.multiply(uiScaleFactor)); + rect.position = parentRect.position.add(new Vector(this.position.x * uiScaleFactor * xScale, this.position.y * uiScaleFactor * yScale)); } var scaleFactor = 1.0 / Window.getInstance().windowToPixelRatio; @@ -144,6 +148,14 @@ class GuiControl { else rect.extent.x = Window.getInstance().width * scaleFactor; } + + if (this.horizSizing == HorizSizing.Height) { + if (this.parent != null) + rect.extent.x = parentRect.extent.y * (this.extent.y / parent.extent.y); + else + rect.extent.x = Window.getInstance().height * scaleFactor; + } + if (this.vertSizing == VertSizing.Height) { if (this.parent != null) rect.extent.y = parentRect.extent.y * (this.extent.y / parent.extent.y); @@ -151,40 +163,47 @@ class GuiControl { rect.extent.y = Window.getInstance().height * scaleFactor; } + if (this.vertSizing == VertSizing.Width) { + if (this.parent != null) + rect.extent.y = parentRect.extent.x * (this.extent.x / parent.extent.x); + else + rect.extent.y = Window.getInstance().width * scaleFactor; + } + if (this.horizSizing == HorizSizing.Center) { if (this.parent != null) { - rect.position.x = parentRect.position.x + parentRect.extent.x / 2 - (rect.extent.x * uiScaleFactor) / 2; - rect.extent.x *= uiScaleFactor; + rect.position.x = parentRect.position.x + parentRect.extent.x / 2 - (rect.extent.x * uiScaleFactor * xScale) / 2; + rect.extent.x *= uiScaleFactor * xScale; } } if (this.vertSizing == VertSizing.Center) { if (this.parent != null) { - rect.position.y = parentRect.position.y + parentRect.extent.y / 2 - (rect.extent.y * uiScaleFactor) / 2; - rect.extent.y *= uiScaleFactor; + rect.position.y = parentRect.position.y + parentRect.extent.y / 2 - (rect.extent.y * uiScaleFactor * yScale) / 2; + rect.extent.y *= uiScaleFactor * yScale; } } if (this.horizSizing == HorizSizing.Right) { if (this.parent != null) { - rect.position.x = parentRect.position.x + this.position.x * uiScaleFactor; - rect.extent.x *= uiScaleFactor; + rect.position.x = parentRect.position.x + this.position.x * uiScaleFactor * xScale; + rect.extent.x *= uiScaleFactor * xScale; } } if (this.vertSizing == VertSizing.Bottom) { if (this.parent != null) { - rect.position.y = parentRect.position.y + this.position.y * uiScaleFactor; - rect.extent.y *= uiScaleFactor; + rect.position.y = parentRect.position.y + this.position.y * uiScaleFactor * yScale; + rect.extent.y *= uiScaleFactor * yScale; } } if (this.horizSizing == HorizSizing.Left) { if (this.parent != null) { - rect.position.x = parentRect.position.x + parentRect.extent.x - (parent.extent.x - this.position.x) * uiScaleFactor; - rect.extent.x *= uiScaleFactor; + rect.position.x = parentRect.position.x + parentRect.extent.x - (parent.extent.x - this.position.x) * uiScaleFactor * xScale; + rect.extent.x *= uiScaleFactor * xScale; } } if (this.vertSizing == VertSizing.Top) { if (this.parent != null) { - rect.position.y = parentRect.position.y + parentRect.extent.y - (parent.extent.y - this.position.y) * uiScaleFactor; - rect.extent.y *= uiScaleFactor; + rect.position.y = parentRect.position.y + parentRect.extent.y - (parent.extent.y - this.position.y) * uiScaleFactor * yScale; + rect.extent.y *= uiScaleFactor * yScale; } } if (this.parent != null) { diff --git a/src/gui/PlayGui.hx b/src/gui/PlayGui.hx index 528ecf87..a36329ad 100644 --- a/src/gui/PlayGui.hx +++ b/src/gui/PlayGui.hx @@ -1,5 +1,6 @@ package gui; +import h3d.Matrix; import src.ProfilerUI; import hxd.App; import hxd.res.Image; @@ -47,6 +48,7 @@ class PlayGui { var gemCountNumbers:Array = []; var gemCountSlash:GuiImage; + var gemHUD:GuiImage; var powerupBox:GuiAnim; var RSGOCenterText:Anim; @@ -57,12 +59,14 @@ class PlayGui { var blastBar:GuiControl; var blastFill:GuiImage; + var blastFillUltra:GuiImage; var blastFrame:GuiImage; var imageResources:Array> = []; var textureResources:Array> = []; var soundResources:Array> = []; + var playGuiCtrlOuter:GuiControl; var playGuiCtrl:GuiControl; var resizeEv:Void->Void; @@ -73,9 +77,11 @@ class PlayGui { var middleMessages:Array = []; + var totalGems:Int = 0; + public function dispose() { if (_init) { - playGuiCtrl.dispose(); + playGuiCtrlOuter.dispose(); RSGOCenterText.remove(); for (textureResource in textureResources) { @@ -95,12 +101,24 @@ class PlayGui { public function init(scene2d:h2d.Scene, game:String) { this.scene2d = scene2d; this._init = true; + // Settings.uiScale = 2.25; + + playGuiCtrlOuter = new GuiControl(); + playGuiCtrlOuter.position = new Vector(); + playGuiCtrlOuter.extent = new Vector(640, 480); + playGuiCtrlOuter.horizSizing = Width; + playGuiCtrlOuter.vertSizing = Height; playGuiCtrl = new GuiControl(); - playGuiCtrl.position = new Vector(); - playGuiCtrl.extent = new Vector(640, 480); + playGuiCtrl.position = new Vector(145, 82); + + var subX = 640 - (scene2d.width - 145 * 2) * 640 / scene2d.width; + var subY = 480 - (scene2d.height - 82 * 2) * 480 / scene2d.height; + + playGuiCtrl.extent = new Vector(640 - subX, 480 - subY); playGuiCtrl.horizSizing = Width; playGuiCtrl.vertSizing = Height; + playGuiCtrlOuter.addChild(playGuiCtrl); var numberTiles = []; for (i in 0...10) { @@ -137,11 +155,12 @@ class PlayGui { MarbleGame.instance.touchInput.showControls(this.playGuiCtrl, game == 'ultra'); } - playGuiCtrl.render(scene2d); + playGuiCtrlOuter.render(scene2d); resizeEv = () -> { var wnd = Window.getInstance(); - playGuiCtrl.render(MarbleGame.canvas.scene2d); + powerupBox.position.x = wnd.width * 469.0 / 640.0; + playGuiCtrlOuter.render(MarbleGame.canvas.scene2d); }; Window.getInstance().addResizeEvent(resizeEv); @@ -151,44 +170,64 @@ class PlayGui { public function initTimer() { var timerCtrl = new GuiImage(ResourceLoader.getResource('data/ui/game/timebackdrop0.png', ResourceLoader.getImage, this.imageResources).toTile()); - timerCtrl.horizSizing = HorizSizing.Center; timerCtrl.position = new Vector(215, 0); timerCtrl.extent = new Vector(256, 64); + timerCtrl.horizSizing = Center; + timerCtrl.xScale = (scene2d.height - 82 * 2) / 480; + timerCtrl.yScale = (scene2d.height - 82 * 2) / 480; var innerCtrl = new GuiControl(); innerCtrl.position = new Vector(26, 0); innerCtrl.extent = new Vector(256, 64); + innerCtrl.xScale = (scene2d.height - 82 * 2) / 480; + innerCtrl.yScale = (scene2d.height - 82 * 2) / 480; timerCtrl.addChild(innerCtrl); timerNumbers[0].position = new Vector(20, 4); timerNumbers[0].extent = new Vector(43, 55); + timerNumbers[0].xScale = (scene2d.height - 82 * 2) / 480; + timerNumbers[0].yScale = (scene2d.height - 82 * 2) / 480; timerNumbers[1].position = new Vector(40, 4); timerNumbers[1].extent = new Vector(43, 55); + timerNumbers[1].xScale = (scene2d.height - 82 * 2) / 480; + timerNumbers[1].yScale = (scene2d.height - 82 * 2) / 480; var colonCols = ResourceLoader.getResource('data/ui/game/numbers/colon.png', ResourceLoader.getImage, this.imageResources).toTile(); timerColon = new GuiImage(colonCols); timerColon.position = new Vector(55, 4); timerColon.extent = new Vector(43, 55); + timerColon.xScale = (scene2d.height - 82 * 2) / 480; + timerColon.yScale = (scene2d.height - 82 * 2) / 480; timerNumbers[2].position = new Vector(70, 4); timerNumbers[2].extent = new Vector(43, 55); + timerNumbers[2].xScale = (scene2d.height - 82 * 2) / 480; + timerNumbers[2].yScale = (scene2d.height - 82 * 2) / 480; timerNumbers[3].position = new Vector(90, 4); timerNumbers[3].extent = new Vector(43, 55); + timerNumbers[3].xScale = (scene2d.height - 82 * 2) / 480; + timerNumbers[3].yScale = (scene2d.height - 82 * 2) / 480; var pointCols = ResourceLoader.getResource('data/ui/game/numbers/point.png', ResourceLoader.getImage, this.imageResources).toTile(); timerPoint = new GuiImage(pointCols); timerPoint.position = new Vector(105, 4); timerPoint.extent = new Vector(43, 55); + timerPoint.xScale = (scene2d.height - 82 * 2) / 480; + timerPoint.yScale = (scene2d.height - 82 * 2) / 480; timerNumbers[4].position = new Vector(120, 4); timerNumbers[4].extent = new Vector(43, 55); + timerNumbers[4].xScale = (scene2d.height - 82 * 2) / 480; + timerNumbers[4].yScale = (scene2d.height - 82 * 2) / 480; timerNumbers[5].position = new Vector(140, 4); timerNumbers[5].extent = new Vector(43, 55); + timerNumbers[5].xScale = (scene2d.height - 82 * 2) / 480; + timerNumbers[5].yScale = (scene2d.height - 82 * 2) / 480; timerNumbers[6].position = new Vector(191, 0); timerNumbers[6].extent = new Vector(43, 55); @@ -238,37 +277,57 @@ class PlayGui { var gemBox = new GuiControl(); gemBox.position = new Vector(0, 0); gemBox.extent = new Vector(300, 200); + gemBox.xScale = (scene2d.height - 82 * 2) / 480; + gemBox.yScale = (scene2d.height - 82 * 2) / 480; var innerCtrl = new GuiControl(); innerCtrl.position = new Vector(26, 0); innerCtrl.extent = new Vector(256, 64); + innerCtrl.xScale = (scene2d.height - 82 * 2) / 480; + innerCtrl.yScale = (scene2d.height - 82 * 2) / 480; gemBox.addChild(innerCtrl); gemCountNumbers[0].position = new Vector(20, 4); gemCountNumbers[0].extent = new Vector(43, 55); + gemCountNumbers[0].xScale = (scene2d.height - 82 * 2) / 480; + gemCountNumbers[0].yScale = (scene2d.height - 82 * 2) / 480; gemCountNumbers[1].position = new Vector(38, 4); gemCountNumbers[1].extent = new Vector(43, 55); + gemCountNumbers[1].xScale = (scene2d.height - 82 * 2) / 480; + gemCountNumbers[1].yScale = (scene2d.height - 82 * 2) / 480; gemCountNumbers[2].position = new Vector(56, 4); gemCountNumbers[2].extent = new Vector(43, 55); + gemCountNumbers[2].xScale = (scene2d.height - 82 * 2) / 480; + gemCountNumbers[2].yScale = (scene2d.height - 82 * 2) / 480; gemCountSlash = new GuiImage(ResourceLoader.getResource('data/ui/game/numbers/slash.png', ResourceLoader.getImage, this.imageResources).toTile()); gemCountSlash.position = new Vector(73, 4); gemCountSlash.extent = new Vector(43, 55); + gemCountSlash.xScale = (scene2d.height - 82 * 2) / 480; + gemCountSlash.yScale = (scene2d.height - 82 * 2) / 480; gemCountNumbers[3].position = new Vector(89, 4); gemCountNumbers[3].extent = new Vector(43, 55); + gemCountNumbers[3].xScale = (scene2d.height - 82 * 2) / 480; + gemCountNumbers[3].yScale = (scene2d.height - 82 * 2) / 480; gemCountNumbers[4].position = new Vector(107, 4); gemCountNumbers[4].extent = new Vector(43, 55); + gemCountNumbers[4].xScale = (scene2d.height - 82 * 2) / 480; + gemCountNumbers[4].yScale = (scene2d.height - 82 * 2) / 480; gemCountNumbers[5].position = new Vector(125, 4); gemCountNumbers[5].extent = new Vector(43, 55); + gemCountNumbers[5].xScale = (scene2d.height - 82 * 2) / 480; + gemCountNumbers[5].yScale = (scene2d.height - 82 * 2) / 480; - var gemHUD = new GuiImage(ResourceLoader.getResource('data/ui/game/gem.png', ResourceLoader.getImage, this.imageResources).toTile()); + gemHUD = new GuiImage(ResourceLoader.getResource('data/ui/game/gem.png', ResourceLoader.getImage, this.imageResources).toTile()); gemHUD.position = new Vector(144, 2); gemHUD.extent = new Vector(64, 64); + gemHUD.xScale = (scene2d.height - 82 * 2) / 480; + gemHUD.yScale = (scene2d.height - 82 * 2) / 480; innerCtrl.addChild(gemCountNumbers[0]); innerCtrl.addChild(gemCountNumbers[1]); @@ -294,36 +353,39 @@ class PlayGui { ]; powerupBox = new GuiAnim(powerupImgs); - powerupBox.position = new Vector(469, 0); + // powerupBox.position = new Vector(469, 0); + powerupBox.position = new Vector(playGuiCtrl.extent.x - 171, 0); powerupBox.extent = new Vector(170, 170); powerupBox.horizSizing = Left; powerupBox.vertSizing = Bottom; + powerupBox.xScale = (scene2d.height - 82 * 2) / 480; + powerupBox.yScale = (scene2d.height - 82 * 2) / 480; playGuiCtrl.addChild(powerupBox); } function initTexts() { - var domcasual32fontdata = ResourceLoader.getFileEntry("data/font/DomCasualD.fnt"); - var domcasual32b = new BitmapFont(domcasual32fontdata.entry); - @:privateAccess domcasual32b.loader = ResourceLoader.loader; - var bfont = domcasual32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel); + var arial14fontdata = ResourceLoader.getFileEntry("data/font/Arial Bold.fnt"); + var arial14b = new BitmapFont(arial14fontdata.entry); + @:privateAccess arial14b.loader = ResourceLoader.loader; + var arial14 = arial14b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel); var helpTextCtrl = new GuiControl(); - helpTextCtrl.position = new Vector(0, 210); + helpTextCtrl.position = new Vector(0, playGuiCtrl.extent.y * 190 / 480); helpTextCtrl.extent = new Vector(640, 60); helpTextCtrl.vertSizing = Center; helpTextCtrl.horizSizing = Width; - helpTextBackground = new GuiText(bfont); - helpTextBackground.text.textColor = 0x777777; - helpTextBackground.position = new Vector(1, 1); + helpTextBackground = new GuiText(arial14); + helpTextBackground.text.textColor = 0x000000; + helpTextBackground.position = new Vector(2, 2); helpTextBackground.extent = new Vector(640, 14); helpTextBackground.vertSizing = Height; helpTextBackground.horizSizing = Width; helpTextBackground.justify = Center; - helpTextForeground = new GuiText(bfont); - helpTextForeground.text.textColor = 0xFFFFFF; + helpTextForeground = new GuiText(arial14); + helpTextForeground.text.textColor = 0xEBEBEB; helpTextForeground.position = new Vector(0, 0); helpTextForeground.extent = new Vector(640, 16); helpTextForeground.vertSizing = Height; @@ -334,21 +396,21 @@ class PlayGui { helpTextCtrl.addChild(helpTextForeground); var alertTextCtrl = new GuiControl(); - alertTextCtrl.position = new Vector(0, 371); + alertTextCtrl.position = new Vector(0, playGuiCtrl.extent.y * 375 / 480); alertTextCtrl.extent = new Vector(640, 105); alertTextCtrl.vertSizing = Top; alertTextCtrl.horizSizing = Width; - alertTextBackground = new GuiText(bfont); - alertTextBackground.text.textColor = 0x776622; - alertTextBackground.position = new Vector(1, 1); + alertTextBackground = new GuiText(arial14); + alertTextBackground.text.textColor = 0x000000; + alertTextBackground.position = new Vector(2, 2); alertTextBackground.extent = new Vector(640, 32); alertTextBackground.vertSizing = Height; alertTextBackground.horizSizing = Width; alertTextBackground.justify = Center; - alertTextForeground = new GuiText(bfont); - alertTextForeground.text.textColor = 0xffEE99; + alertTextForeground = new GuiText(arial14); + alertTextForeground.text.textColor = 0xEBEBEB; alertTextForeground.position = new Vector(0, 0); alertTextForeground.extent = new Vector(640, 32); alertTextForeground.vertSizing = Height; @@ -358,8 +420,8 @@ class PlayGui { alertTextCtrl.addChild(alertTextBackground); alertTextCtrl.addChild(alertTextForeground); - playGuiCtrl.addChild(helpTextCtrl); - playGuiCtrl.addChild(alertTextCtrl); + playGuiCtrlOuter.addChild(helpTextCtrl); + playGuiCtrlOuter.addChild(alertTextCtrl); } function initFPSMeter() { @@ -388,44 +450,72 @@ class PlayGui { function initBlastBar() { blastBar = new GuiControl(); - blastBar.position = new Vector(6, 445); - blastBar.extent = new Vector(120, 28); - blastBar.vertSizing = Top; + blastBar.position = new Vector(0, 400); + blastBar.extent = new Vector(170, 83); + blastBar.vertSizing = Bottom; + blastBar.xScale = (scene2d.height - 82 * 2) / 480; + blastBar.yScale = (scene2d.height - 82 * 2) / 480; this.playGuiCtrl.addChild(blastBar); - blastFill = new GuiImage(ResourceLoader.getResource("data/ui/game/blastbar_bargreen.png", ResourceLoader.getImage, this.imageResources).toTile()); - blastFill.position = new Vector(5, 5); - blastFill.extent = new Vector(58, 17); - blastFill.doClipping = false; + blastFill = new GuiImage(ResourceLoader.getResource("data/ui/game/powerbarMask.png", ResourceLoader.getImage, this.imageResources).toTile()); + blastFill.position = new Vector(36, 38); + blastFill.extent = new Vector(100, 27); + blastFill.xScale = (scene2d.height - 82 * 2) / 480; + blastFill.yScale = (scene2d.height - 82 * 2) / 480; + var colorMat = Matrix.I(); + colorMat.colorSet(0x0080FF); + blastFill.bmp.filter = new h2d.filter.ColorMatrix(colorMat); + blastBar.addChild(blastFill); - blastFrame = new GuiImage(ResourceLoader.getResource("data/ui/game/blastbar.png", ResourceLoader.getImage, this.imageResources).toTile()); + blastFillUltra = new GuiImage(ResourceLoader.getResource("data/ui/game/powerbarMask.png", ResourceLoader.getImage, this.imageResources).toTile()); + blastFillUltra.position = new Vector(36, 38); + blastFillUltra.extent = new Vector(100, 27); + blastFillUltra.xScale = (scene2d.height - 82 * 2) / 480; + blastFillUltra.yScale = (scene2d.height - 82 * 2) / 480; + var colorMat = Matrix.I(); + colorMat.colorSet(0xC4FF00); + blastFillUltra.bmp.filter = new h2d.filter.ColorMatrix(colorMat); + + blastBar.addChild(blastFillUltra); + + blastFrame = new GuiImage(ResourceLoader.getResource("data/ui/game/powerbar.png", ResourceLoader.getImage, this.imageResources).toTile()); blastFrame.position = new Vector(0, 0); - blastFrame.extent = new Vector(120, 28); + blastFrame.extent = new Vector(170, 83); + blastFrame.xScale = (scene2d.height - 82 * 2) / 480; + blastFrame.yScale = (scene2d.height - 82 * 2) / 480; blastBar.addChild(blastFrame); } + var blastValue:Float = 0; + public function setBlastValue(value:Float) { if (value <= 1) { - if (blastFill.extent.y == 16) { // Was previously charged - blastFrame.bmp.tile = ResourceLoader.getResource("data/ui/game/blastbar.png", ResourceLoader.getImage, this.imageResources).toTile(); - } - var oldVal = blastFill.extent.x; - blastFill.extent = new Vector(Util.lerp(0, 110, value), 17); - if (oldVal < 22 && blastFill.extent.x >= 22) { - blastFill.bmp.tile = ResourceLoader.getResource("data/ui/game/blastbar_bargreen.png", ResourceLoader.getImage, this.imageResources).toTile(); + var oldVal = blastValue; + blastValue = value; + blastFill.bmp.tile.setSize(Util.lerp(0, 75, value), 20); + blastFill.bmp.scaleX = value; + // blastFill.extent = new Vector(Util.lerp(0, 100, value), 27); + if (oldVal < 0.25 && value >= 0.25) { + var colorMat = cast(blastFill.bmp.filter, h2d.filter.ColorMatrix); + colorMat.matrix.colorSet(0x0080FF); MarbleGame.instance.touchInput.blastbutton.setEnabled(true); } - if (oldVal >= 22 && blastFill.extent.x < 22) { - blastFill.bmp.tile = ResourceLoader.getResource("data/ui/game/blastbar_bargray.png", ResourceLoader.getImage, this.imageResources).toTile(); + if (oldVal >= 0.25 && value < 0.25) { + var colorMat = cast(blastFill.bmp.filter, h2d.filter.ColorMatrix); + colorMat.matrix.colorSet(0xCDD2D7); MarbleGame.instance.touchInput.blastbutton.setEnabled(false); } + blastFillUltra.bmp.visible = false; } else { - blastFill.extent = new Vector(0, 16); // WE will just use this extra number to store whether it was previously charged or not - blastFrame.bmp.tile = ResourceLoader.getResource("data/ui/game/blastbar_charged.png", ResourceLoader.getImage, this.imageResources).toTile(); + blastFillUltra.bmp.visible = true; + + var fillPercent = (value - 1) * 6; + blastFillUltra.bmp.tile.setSize(Util.lerp(0, 75, fillPercent), 20); + blastFillUltra.bmp.scaleX = fillPercent; + MarbleGame.instance.touchInput.blastbutton.setEnabled(true); } - this.blastBar.render(scene2d); } public function setHelpTextOpacity(value:Float) { @@ -472,17 +562,70 @@ class PlayGui { } } + public function resizeGemCounter(total:Int) { + if (total >= 100) { + // 3 digits + gemCountNumbers[0].anim.visible = true; + gemCountNumbers[1].anim.visible = true; + gemCountNumbers[2].anim.visible = true; + gemCountNumbers[3].anim.visible = true; + gemCountNumbers[4].anim.visible = true; + gemCountNumbers[5].anim.visible = true; + + gemCountNumbers[0].position.x = 20; + gemCountNumbers[1].position.x = 38; + gemCountNumbers[2].position.x = 56; + gemCountNumbers[3].position.x = 89; + gemCountNumbers[4].position.x = 107; + gemCountNumbers[5].position.x = 125; + gemCountSlash.position.x = 73; + gemHUD.position.x = 144; + } else if (total >= 10) { + // 2 digits + gemCountNumbers[0].anim.visible = false; + gemCountNumbers[1].anim.visible = true; + gemCountNumbers[2].anim.visible = true; + gemCountNumbers[3].anim.visible = false; + gemCountNumbers[4].anim.visible = true; + gemCountNumbers[5].anim.visible = true; + + gemCountNumbers[2].position.x = 32; + gemCountNumbers[5].position.x = 83; + gemCountNumbers[1].position.x = 14; + gemCountNumbers[4].position.x = 65; + gemCountSlash.position.x = 49; + gemHUD.position.x = 101; + } else { + // 1 digit + gemCountNumbers[0].anim.visible = false; + gemCountNumbers[1].anim.visible = false; + gemCountNumbers[2].anim.visible = true; + gemCountNumbers[3].anim.visible = false; + gemCountNumbers[4].anim.visible = false; + gemCountNumbers[5].anim.visible = true; + + gemCountNumbers[2].position.x = 8; + gemCountNumbers[5].position.x = 41; + gemCountSlash.position.x = 25; + gemHUD.position.x = 59; + } + gemHUD.parent.render(scene2d, @:privateAccess gemHUD.parent.parent._flow); + } + public function formatGemCounter(collected:Int, total:Int) { if (total == 0) { for (number in gemCountNumbers) { number.anim.visible = false; } gemCountSlash.bmp.visible = false; + gemHUD.bmp.visible = false; } else { - for (number in gemCountNumbers) { - number.anim.visible = true; + if (totalGems != total) { + resizeGemCounter(total); + totalGems = total; } gemCountSlash.bmp.visible = true; + gemHUD.bmp.visible = true; } var totalHundredths = Math.floor(total / 100); diff --git a/src/shapes/AntiGravity.hx b/src/shapes/AntiGravity.hx index 5b6dff31..50906da0 100644 --- a/src/shapes/AntiGravity.hx +++ b/src/shapes/AntiGravity.hx @@ -14,7 +14,7 @@ class AntiGravity extends PowerUp { this.isCollideable = false; this.isTSStatic = false; this.identifier = "AntiGravity"; - this.pickUpName = "Gravity Defier"; + this.pickUpName = "a Gravity Modifier"; this.autoUse = true; this.useInstancing = true; this.animateSubObjectOpacities = true; diff --git a/src/shapes/Blast.hx b/src/shapes/Blast.hx index d396a6d8..98b3ffbb 100644 --- a/src/shapes/Blast.hx +++ b/src/shapes/Blast.hx @@ -13,7 +13,7 @@ class Blast extends PowerUp { this.isTSStatic = false; this.showSequences = true; this.identifier = "Blast"; - this.pickUpName = "Blast PowerUp"; + this.pickUpName = "a Blast powerup"; this.ambientRotate = false; this.autoUse = true; } @@ -32,7 +32,7 @@ class Blast extends PowerUp { } public function use(timeState:TimeState) { - this.level.blastAmount = 1.03; + this.level.blastAmount = 1.2; } override function postProcessMaterial(matName:String, material:h3d.mat.Material) { diff --git a/src/shapes/EasterEgg.hx b/src/shapes/EasterEgg.hx index d3d5be53..9ff73c5b 100644 --- a/src/shapes/EasterEgg.hx +++ b/src/shapes/EasterEgg.hx @@ -23,10 +23,10 @@ class EasterEgg extends PowerUp { if (!found) { Settings.easterEggs.set(this.level.mission.path, this.level.timeState.currentAttemptTime); this.pickupSound = ResourceLoader.getResource("data/sound/easter_egg.wav", ResourceLoader.getAudio, this.soundResources); - this.customPickupMessage = "You found an Easter Egg!"; + this.customPickupMessage = "You picked up an Easter Egg!"; } else { this.pickupSound = ResourceLoader.getResource("data/sound/easterfound.wav", ResourceLoader.getAudio, this.soundResources); - this.customPickupMessage = "You already found this Easter Egg."; + this.customPickupMessage = "You picked up an Easter Egg!."; } return true; diff --git a/src/shapes/Helicopter.hx b/src/shapes/Helicopter.hx index bd8a1374..a6bd5297 100644 --- a/src/shapes/Helicopter.hx +++ b/src/shapes/Helicopter.hx @@ -16,7 +16,7 @@ class Helicopter extends PowerUp { this.isTSStatic = false; this.showSequences = false; this.identifier = "Helicopter"; - this.pickUpName = "Helicopter PowerUp"; + this.pickUpName = "a Gyrocopter powerup"; } public override function init(level:MarbleWorld, onFinish:Void->Void) { diff --git a/src/shapes/MegaMarble.hx b/src/shapes/MegaMarble.hx index b3665a19..b986f596 100644 --- a/src/shapes/MegaMarble.hx +++ b/src/shapes/MegaMarble.hx @@ -15,7 +15,7 @@ class MegaMarble extends PowerUp { this.isTSStatic = false; this.showSequences = true; this.identifier = "MegaMarble"; - this.pickUpName = "Mega Marble PowerUp"; + this.pickUpName = "a Mega-Marble powerup"; } public override function init(level:MarbleWorld, onFinish:Void->Void) { diff --git a/src/shapes/PowerUp.hx b/src/shapes/PowerUp.hx index f3ddf45b..d61b48a9 100644 --- a/src/shapes/PowerUp.hx +++ b/src/shapes/PowerUp.hx @@ -41,7 +41,7 @@ abstract class PowerUp extends DtsObject { if (customPickupMessage != null) this.level.displayAlert(customPickupMessage); else - this.level.displayAlert('You picked up a ${this.pickUpName}!'); + this.level.displayAlert('You picked up ${this.pickUpName}!'); if (this.element.showhelponpickup == "1" && !this.autoUse) this.level.displayHelp('Press to use the ${this.pickUpName}!'); diff --git a/src/shapes/SuperJump.hx b/src/shapes/SuperJump.hx index 70dc7403..7b0c785b 100644 --- a/src/shapes/SuperJump.hx +++ b/src/shapes/SuperJump.hx @@ -42,7 +42,7 @@ class SuperJump extends PowerUp { this.isCollideable = false; this.isTSStatic = false; this.identifier = "SuperJump"; - this.pickUpName = "Jump Boost PowerUp"; + this.pickUpName = "a Super Jump powerup"; this.showSequences = false; sjEmitterParticleData = new ParticleData(); sjEmitterParticleData.identifier = "superJumpParticle"; diff --git a/src/shapes/SuperSpeed.hx b/src/shapes/SuperSpeed.hx index ce5d6cbd..37842d5a 100644 --- a/src/shapes/SuperSpeed.hx +++ b/src/shapes/SuperSpeed.hx @@ -47,7 +47,7 @@ class SuperSpeed extends PowerUp { this.isCollideable = false; this.isTSStatic = false; this.identifier = "SuperSpeed"; - this.pickUpName = "Speed Booster PowerUp"; + this.pickUpName = "a Super Speed powerup"; this.useInstancing = true; ssEmitterParticleData = new ParticleData(); ssEmitterParticleData.identifier = "superSpeedParticle"; diff --git a/src/shapes/TimeTravel.hx b/src/shapes/TimeTravel.hx index 2ddfb853..9aa2a816 100644 --- a/src/shapes/TimeTravel.hx +++ b/src/shapes/TimeTravel.hx @@ -24,7 +24,7 @@ class TimeTravel extends PowerUp { this.timeBonus = -MisParser.parseNumber(element.timepenalty) / 1000; } - this.pickUpName = '${this.timeBonus} second Time ${this.timeBonus >= 0 ? 'Modifier' : 'Penalty'}'; + this.pickUpName = '${this.timeBonus} seconds of Time Travel ${this.timeBonus >= 0 ? 'bonus' : 'Penalty'}'; this.cooldownDuration = 1e8; this.useInstancing = true; this.autoUse = true;