diff --git a/Arcade/FlxInvaders/Project.xml b/Arcade/FlxInvaders/Project.xml index 04b8a0689..358a6e651 100644 --- a/Arcade/FlxInvaders/Project.xml +++ b/Arcade/FlxInvaders/Project.xml @@ -31,7 +31,9 @@ - + + + diff --git a/Arcade/FlxInvaders/assets/theme.mp3 b/Arcade/FlxInvaders/assets/theme.mp3 new file mode 100644 index 000000000..fba1b0531 Binary files /dev/null and b/Arcade/FlxInvaders/assets/theme.mp3 differ diff --git a/Arcade/FlxInvaders/source/PlayState.hx b/Arcade/FlxInvaders/source/PlayState.hx index 06ac0963b..fbcfd83b6 100644 --- a/Arcade/FlxInvaders/source/PlayState.hx +++ b/Arcade/FlxInvaders/source/PlayState.hx @@ -1,11 +1,11 @@ package; -import flixel.sound.FlxSound; import flixel.FlxG; import flixel.FlxObject; import flixel.FlxSprite; import flixel.FlxState; import flixel.group.FlxGroup; +import flixel.sound.FlxSound; import flixel.text.FlxText; import flixel.util.FlxColor; @@ -63,7 +63,7 @@ class PlayState extends FlxState override public function create():Void { if (FlxG.sound.music == null) - FlxG.sound.playMusic("assets/theme.ogg"); + FlxG.sound.playMusic("assets/theme");// Extension ommitted via FLX_DEFAULT_SOUND_EXT FlxG.mouse.visible = false; diff --git a/Arcade/FlxSnake/Project.xml b/Arcade/FlxSnake/Project.xml index 7deb9ea0b..758f537bb 100644 --- a/Arcade/FlxSnake/Project.xml +++ b/Arcade/FlxSnake/Project.xml @@ -64,6 +64,7 @@ + diff --git a/Arcade/FlxSnake/source/PlayState.hx b/Arcade/FlxSnake/source/PlayState.hx index 318aca938..a1e947774 100644 --- a/Arcade/FlxSnake/source/PlayState.hx +++ b/Arcade/FlxSnake/source/PlayState.hx @@ -1,15 +1,15 @@ package; -import flixel.util.FlxDirection; import flixel.FlxG; import flixel.FlxObject; import flixel.FlxSprite; import flixel.FlxState; import flixel.group.FlxSpriteGroup; +import flixel.math.FlxPoint; import flixel.system.FlxAssets; import flixel.text.FlxText; import flixel.util.FlxColor; -import flixel.math.FlxPoint; +import flixel.util.FlxDirection; import flixel.util.FlxSpriteUtil; import flixel.util.FlxTimer; @@ -158,11 +158,8 @@ class PlayState extends FlxState // Our reward - a new segment! :) addSegment(); - #if flash - FlxG.sound.load("flixel/sounds/beep.mp3").play(); - #else - FlxG.sound.load("flixel/sounds/beep.ogg").play(); - #end + // mp3 on flash, ogg otherwise. Enabled via compile flag FLX_DEFAULT_SOUND_EXT + FlxG.sound.play("flixel/sounds/beep"); // Become faster each pickup - set a max speed though! if (_movementInterval >= MIN_INTERVAL) diff --git a/Features/FlxFSM/source/Slime.hx b/Features/FlxFSM/source/Slime.hx index 1d86bbd1e..ec583c3c8 100644 --- a/Features/FlxFSM/source/Slime.hx +++ b/Features/FlxFSM/source/Slime.hx @@ -1,9 +1,9 @@ package; -import flixel.sound.FlxSound; import flixel.FlxG; import flixel.FlxSprite; import flixel.addons.util.FlxFSM; +import flixel.sound.FlxSound; class Slime extends FlxSprite { @@ -100,7 +100,7 @@ class Idle extends FlxFSMState override function enter(owner:Slime, fsm:FlxFSM):Void { - walkSnd = FlxG.sound.load("assets/sounds/walk", 0.4); + walkSnd = FlxG.sound.create("assets/sounds/walk").setup(0.4); owner.animation.play("standing"); } diff --git a/Features/Pathfinding/source/PlayState.hx b/Features/Pathfinding/source/PlayState.hx index e6b5a1616..1212e898b 100644 --- a/Features/Pathfinding/source/PlayState.hx +++ b/Features/Pathfinding/source/PlayState.hx @@ -401,7 +401,6 @@ private abstract Tilemap(FlxTilemap) from FlxTilemap to FlxTilemap mapData, false, // invert 1, // scale - null, // colorMap FlxGraphic.fromClass(GraphicAutoFull), TILE_SIZE, // tile_width TILE_SIZE, // tile_height diff --git a/Other/Calculator/source/State.hx b/Other/Calculator/source/State.hx index a0e35d75e..06384a27e 100644 --- a/Other/Calculator/source/State.hx +++ b/Other/Calculator/source/State.hx @@ -6,7 +6,6 @@ import flixel.FlxG; import flixel.FlxSprite; import flixel.FlxState; import flixel.addons.ui.FlxUIButton; -import flixel.addons.ui.FlxUIInputText; import flixel.addons.ui.FlxUIText; import flixel.math.FlxAngle; import flixel.math.FlxMath; @@ -15,6 +14,7 @@ import flixel.math.FlxRandom; import flixel.math.FlxRect; import flixel.math.FlxVelocity; import flixel.system.scaleModes.PixelPerfectScaleMode; +import flixel.text.FlxInputText; import flixel.text.FlxText; import flixel.util.FlxSpriteUtil; import hscript.Expr; @@ -25,7 +25,7 @@ import hscript.Parser; class State extends FlxState { // Input and output texts, and the interpretor - var input:FlxUIInputText = new FlxUIInputText(); // Input text + var input:FlxInputText = new FlxInputText(); // Input text var outputs:Array = new Array(); // Output texts var interp:Interp = new Interp(); // Script interpretor var graph:FlxSprite; @@ -49,12 +49,11 @@ class State extends FlxState add(labels); // Input text box - input = new FlxUIInputText(); - input.broadcastToFlxUI = false; + input = new FlxInputText(); input.text = ""; input.setPosition(10 + labels.width, 10); input.setFormat("Font", 8, 0xff000000); - input.textField.width = FlxG.width - input.x - 10; + input.fieldWidth = FlxG.width - input.x - 10; add(input); // Output texts @@ -81,11 +80,7 @@ class State extends FlxState { buttons[y].push(new FlxUIButton(10 + x * 23, FlxG.height - 26 - (btns.length - 1 - y) * 18, btns[y][x], function() { - var start = input.text.substring(0, input.caretIndex); - var end = input.text.substring(input.caretIndex); - input.text = start + btns[y][x] + end; - input.hasFocus = true; - input.caretIndex++; + input.text += btns[y][x]; })); buttons[y][x].label.setFormat("Font", 8, 0xff000000, CENTER); @@ -131,7 +126,7 @@ class State extends FlxState } // Next input.text = txt[index]; - input.hasFocus = true; + // input.hasFocus = true; }); examples[i].label.setFormat("Font", 8, 0xff000000, CENTER); @@ -145,7 +140,7 @@ class State extends FlxState add(FlxSpriteUtil.drawRect(graph, 1, 1, graph.width - 2, graph.height - 2, 0xffffffff)); // Set focus - input.hasFocus = true; + // input.hasFocus = true; // Bind classes. You can also bind class instances and call their public functions and use their public data interp.variables.set("x", 0); diff --git a/Tutorials/TurnBasedRPG/source/CombatHUD.hx b/Tutorials/TurnBasedRPG/source/CombatHUD.hx index 07eb8b5a2..c61af26e5 100644 --- a/Tutorials/TurnBasedRPG/source/CombatHUD.hx +++ b/Tutorials/TurnBasedRPG/source/CombatHUD.hx @@ -159,13 +159,13 @@ class CombatHUD extends FlxTypedGroup active = false; visible = false; - fledSound = FlxG.sound.load(AssetPaths.fled__wav); - hurtSound = FlxG.sound.load(AssetPaths.hurt__wav); - loseSound = FlxG.sound.load(AssetPaths.lose__wav); - missSound = FlxG.sound.load(AssetPaths.miss__wav); - selectSound = FlxG.sound.load(AssetPaths.select__wav); - winSound = FlxG.sound.load(AssetPaths.win__wav); - combatSound = FlxG.sound.load(AssetPaths.combat__wav); + fledSound = FlxG.sound.create(AssetPaths.fled__wav); + hurtSound = FlxG.sound.create(AssetPaths.hurt__wav); + loseSound = FlxG.sound.create(AssetPaths.lose__wav); + missSound = FlxG.sound.create(AssetPaths.miss__wav); + selectSound = FlxG.sound.create(AssetPaths.select__wav); + winSound = FlxG.sound.create(AssetPaths.win__wav); + combatSound = FlxG.sound.create(AssetPaths.combat__wav); } /** diff --git a/Tutorials/TurnBasedRPG/source/Enemy.hx b/Tutorials/TurnBasedRPG/source/Enemy.hx index db26ef240..33f778c63 100644 --- a/Tutorials/TurnBasedRPG/source/Enemy.hx +++ b/Tutorials/TurnBasedRPG/source/Enemy.hx @@ -52,7 +52,7 @@ class Enemy extends FlxSprite seesPlayer = false; playerPosition = FlxPoint.get(); - stepSound = FlxG.sound.load(AssetPaths.step__wav, 0.4); + stepSound = FlxG.sound.create(AssetPaths.step__wav).setup(0.4); stepSound.proximity(x, y, FlxG.camera.target, FlxG.width * 0.6); } diff --git a/Tutorials/TurnBasedRPG/source/GameOverState.hx b/Tutorials/TurnBasedRPG/source/GameOverState.hx index f824af731..6ba6142f3 100644 --- a/Tutorials/TurnBasedRPG/source/GameOverState.hx +++ b/Tutorials/TurnBasedRPG/source/GameOverState.hx @@ -60,7 +60,7 @@ class GameOverState extends FlxState mainMenuButton = new FlxButton(0, FlxG.height - 32, "Main Menu", switchToMainMenu); mainMenuButton.screenCenter(FlxAxes.X); - mainMenuButton.onUp.sound = FlxG.sound.load(AssetPaths.select__wav); + mainMenuButton.onUp.sound = FlxG.sound.create(AssetPaths.select__wav); add(mainMenuButton); FlxG.camera.fade(FlxColor.BLACK, 0.33, true); diff --git a/Tutorials/TurnBasedRPG/source/MenuState.hx b/Tutorials/TurnBasedRPG/source/MenuState.hx index 29a71272d..586e125b8 100644 --- a/Tutorials/TurnBasedRPG/source/MenuState.hx +++ b/Tutorials/TurnBasedRPG/source/MenuState.hx @@ -23,7 +23,7 @@ class MenuState extends FlxState add(titleText); playButton = new FlxButton(0, 0, "Play", clickPlay); - playButton.onUp.sound = FlxG.sound.load(AssetPaths.select__wav); + playButton.onUp.sound = FlxG.sound.create(AssetPaths.select__wav); playButton.x = (FlxG.width / 2) - 10 - playButton.width; playButton.y = FlxG.height - playButton.height - 10; add(playButton); diff --git a/Tutorials/TurnBasedRPG/source/OptionsState.hx b/Tutorials/TurnBasedRPG/source/OptionsState.hx index 4a567f211..3ba0fdf1c 100644 --- a/Tutorials/TurnBasedRPG/source/OptionsState.hx +++ b/Tutorials/TurnBasedRPG/source/OptionsState.hx @@ -40,12 +40,12 @@ class OptionsState extends FlxState volumeDownButton = new FlxButton(8, volumeText.y + volumeText.height + 2, "-", clickVolumeDown); volumeDownButton.loadGraphic(AssetPaths.button__png, true, 20, 20); - volumeDownButton.onUp.sound = FlxG.sound.load(AssetPaths.select__wav); + volumeDownButton.onUp.sound = FlxG.sound.create(AssetPaths.select__wav); add(volumeDownButton); volumeUpButton = new FlxButton(FlxG.width - 28, volumeDownButton.y, "+", clickVolumeUp); volumeUpButton.loadGraphic(AssetPaths.button__png, true, 20, 20); - volumeUpButton.onUp.sound = FlxG.sound.load(AssetPaths.select__wav); + volumeUpButton.onUp.sound = FlxG.sound.create(AssetPaths.select__wav); add(volumeUpButton); volumeBar = new FlxBar(volumeDownButton.x + volumeDownButton.width + 4, @@ -71,11 +71,11 @@ class OptionsState extends FlxState clearDataButton = new FlxButton((FlxG.width / 2) - 90, FlxG.height - 28, "Clear Data", clickClearData); - clearDataButton.onUp.sound = FlxG.sound.load(AssetPaths.select__wav); + clearDataButton.onUp.sound = FlxG.sound.create(AssetPaths.select__wav); add(clearDataButton); backButton = new FlxButton((FlxG.width / 2) + 10, FlxG.height - 28, "Back", clickBack); - backButton.onUp.sound = FlxG.sound.load(AssetPaths.select__wav); + backButton.onUp.sound = FlxG.sound.create(AssetPaths.select__wav); add(backButton); // update our bar to show the current volume level diff --git a/Tutorials/TurnBasedRPG/source/PlayState.hx b/Tutorials/TurnBasedRPG/source/PlayState.hx index b2a51962b..5a9754e6e 100644 --- a/Tutorials/TurnBasedRPG/source/PlayState.hx +++ b/Tutorials/TurnBasedRPG/source/PlayState.hx @@ -7,11 +7,12 @@ import flixel.group.FlxGroup.FlxTypedGroup; import flixel.sound.FlxSound; import flixel.tile.FlxTilemap; import flixel.util.FlxColor; + +using flixel.util.FlxSpriteUtil; #if mobile import flixel.ui.FlxVirtualPad; #end -using flixel.util.FlxSpriteUtil; class PlayState extends FlxState { @@ -68,7 +69,7 @@ class PlayState extends FlxState combatHud = new CombatHUD(); add(combatHud); - coinSound = FlxG.sound.load(AssetPaths.coin__wav); + coinSound = FlxG.sound.create(AssetPaths.coin__wav); #if mobile virtualPad = new FlxVirtualPad(FULL, NONE); diff --git a/Tutorials/TurnBasedRPG/source/Player.hx b/Tutorials/TurnBasedRPG/source/Player.hx index 32a3186e6..5d5a3ff62 100644 --- a/Tutorials/TurnBasedRPG/source/Player.hx +++ b/Tutorials/TurnBasedRPG/source/Player.hx @@ -28,7 +28,7 @@ class Player extends FlxSprite setSize(8, 8); offset.set(4, 8); - stepSound = FlxG.sound.load(AssetPaths.step__wav); + stepSound = FlxG.sound.create(AssetPaths.step__wav); } override function update(elapsed:Float) diff --git a/UserInterface/FlxTypeText/source/MenuState.hx b/UserInterface/FlxTypeText/source/MenuState.hx index 727bdc5ed..4954b8464 100644 --- a/UserInterface/FlxTypeText/source/MenuState.hx +++ b/UserInterface/FlxTypeText/source/MenuState.hx @@ -6,9 +6,9 @@ import flash.geom.Rectangle; import flixel.FlxG; import flixel.FlxSprite; import flixel.FlxState; +import flixel.addons.text.FlxTypeText; import flixel.system.FlxAssets; import flixel.ui.FlxButton; -import flixel.addons.text.FlxTypeText; /** * A FlxState which can be used for the game's menu. @@ -45,11 +45,11 @@ class MenuState extends FlxState _typeText.skipKeys = ["SPACE"]; _typeText.sounds = [ #if flash - FlxG.sound.load("assets/type01.mp3"), - FlxG.sound.load("assets/type02.mp3") + FlxG.sound.create("assets/type01.mp3"), + FlxG.sound.create("assets/type02.mp3") #else - FlxG.sound.load("assets/type01.ogg"), - FlxG.sound.load("assets/type02.ogg") + FlxG.sound.create("assets/type01.ogg"), + FlxG.sound.create("assets/type02.ogg") #end ];