Skip to content

Commit

Permalink
fix flixel 6 warnings (#374)
Browse files Browse the repository at this point in the history
* fix flixel 6 warnings

* d'oh!

* add flash sounds fix CI warnings
  • Loading branch information
Geokureli authored Jan 29, 2025
1 parent 487ce2c commit ccc1a1d
Show file tree
Hide file tree
Showing 22 changed files with 29 additions and 13 deletions.
7 changes: 7 additions & 0 deletions Features/FlxCamera/source/input/PlayerControls.hx
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,17 @@ abstract VirtualPad(FlxVirtualPad) from FlxVirtualPad to FlxVirtualPad
{
return switch(input)
{
#if (flixel >= version("6.0.0"))
case Input.LEFT : this.getButton(FlxVirtualInputID.LEFT).pressed;
case Input.RIGHT: this.getButton(FlxVirtualInputID.RIGHT).pressed;
case Input.UP : this.getButton(FlxVirtualInputID.UP).pressed;
case Input.DOWN : this.getButton(FlxVirtualInputID.DOWN).pressed;
#else
case Input.LEFT : this.buttonLeft.pressed;
case Input.RIGHT: this.buttonRight.pressed;
case Input.UP : this.buttonUp.pressed;
case Input.DOWN : this.buttonDown.pressed;
#end
default: false;
}
}
Expand Down
4 changes: 3 additions & 1 deletion Features/FlxFSM/Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@

<set name="BUILD_DIR" value="export" />
<source path="source" />
<assets path="assets" />
<assets path="assets" exclude="*.mp3" unless="flash"/>
<assets path="assets" exclude="*.ogg" if="flash"/>

<!-- _______________________________ Libraries ______________________________ -->

Expand Down Expand Up @@ -65,6 +66,7 @@
<haxedef name="FLX_NO_KEYBOARD" if="mobile" />
<haxedef name="FLX_NO_TOUCH" />
<haxedef name="FLX_NO_GAMEPAD" />
<haxedef name="FLX_DEFAULT_SOUND_EXT" />

<!--Disable the Flixel core sound tray-->
<!--<haxedef name="FLX_NO_SOUND_TRAY" />-->
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added Features/FlxFSM/assets/sounds/groundpound.mp3
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file added Features/FlxFSM/assets/sounds/happynewyear.mp3
Binary file not shown.
File renamed without changes.
Binary file added Features/FlxFSM/assets/sounds/jump.mp3
Binary file not shown.
File renamed without changes.
Binary file added Features/FlxFSM/assets/sounds/powerup.mp3
Binary file not shown.
File renamed without changes.
Binary file added Features/FlxFSM/assets/sounds/superjump.mp3
Binary file not shown.
File renamed without changes.
Binary file added Features/FlxFSM/assets/sounds/walk.mp3
Binary file not shown.
File renamed without changes.
12 changes: 6 additions & 6 deletions Features/FlxFSM/source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PlayState extends FlxState
// Music by 8-BITek
// Licensed under CC BY-NC-ND 3.0
// https://www.newgrounds.com/audio/listen/1341678
FlxG.sound.playMusic("assets/happynewyear.ogg", 0);
FlxG.sound.playMusic("assets/sounds/happynewyear", 0);
FlxG.sound.music.fadeIn(2, 0, 0.2);

final J = 99;
Expand Down Expand Up @@ -66,16 +66,16 @@ class PlayState extends FlxState

final tileSize = 16;
_map = new FlxTilemap();
_map.loadMapFromArray(data, 20, 15, "assets/tiles.png", tileSize, tileSize);
_map.loadMapFromArray(data, 20, 15, "assets/images/tiles.png", tileSize, tileSize);
add(_map);

_slime = new Slime(192, 128);
add(_slime);

_superJump = new FlxSprite((superJumpIndex % columns) * tileSize, Std.int(superJumpIndex / columns) * tileSize, "assets/powerup.png");
_superJump = new FlxSprite((superJumpIndex % columns) * tileSize, Std.int(superJumpIndex / columns) * tileSize, "assets/images/powerup.png");
add(_superJump);

_groundPound = new FlxSprite((groundPoundIndex % columns) * tileSize, Std.int(groundPoundIndex / columns) * tileSize, "assets/powerup.png");
_groundPound = new FlxSprite((groundPoundIndex % columns) * tileSize, Std.int(groundPoundIndex / columns) * tileSize, "assets/images/powerup.png");
_groundPound.flipY = true;
_groundPound.y += 4;
add(_groundPound);
Expand All @@ -92,14 +92,14 @@ class PlayState extends FlxState

FlxG.overlap(_slime, _superJump, function (_, _)
{
FlxG.sound.play("assets/powerup.ogg");
FlxG.sound.play("assets/sounds/powerup");
_slime.addSuperJump();
_superJump.kill();
});

FlxG.overlap(_slime, _groundPound, function (_, _)
{
FlxG.sound.play("assets/powerup.ogg");
FlxG.sound.play("assets/sounds/powerup");
_slime.addGroundPound();
_groundPound.kill();
startGroundPoundInfoTween();
Expand Down
12 changes: 6 additions & 6 deletions Features/FlxFSM/source/Slime.hx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Slime extends FlxSprite
{
super(X, Y);

loadGraphic("assets/slime.png", true, 16, 16);
loadGraphic("assets/images/slime.png", true, 16, 16);
setFacingFlip(LEFT, true, false);
setFacingFlip(RIGHT, false, false);
facing = RIGHT;
Expand Down Expand Up @@ -100,7 +100,7 @@ class Idle extends FlxFSMState<Slime>

override function enter(owner:Slime, fsm:FlxFSM<Slime>):Void
{
walkSnd = FlxG.sound.load("assets/walk.ogg", 0.4);
walkSnd = FlxG.sound.load("assets/sounds/walk", 0.4);
owner.animation.play("standing");
}

Expand Down Expand Up @@ -131,7 +131,7 @@ class Jump extends FlxFSMState<Slime>
{
override function enter(owner:Slime, fsm:FlxFSM<Slime>):Void
{
FlxG.sound.play("assets/jump.ogg", FlxG.random.float(0.9, 1.0));
FlxG.sound.play("assets/sounds/jump", FlxG.random.float(0.9, 1.0));
owner.animation.play("jumping");
owner.velocity.y = -200;
}
Expand All @@ -150,7 +150,7 @@ class SuperJump extends Jump
{
override function enter(owner:Slime, fsm:FlxFSM<Slime>):Void
{
FlxG.sound.play("assets/superjump.ogg", FlxG.random.float(0.9, 1.0));
FlxG.sound.play("assets/sounds/superjump", FlxG.random.float(0.9, 1.0));
owner.animation.play("jumping");
owner.velocity.y = -300;
}
Expand All @@ -162,7 +162,7 @@ class GroundPound extends FlxFSMState<Slime>

override function enter(owner:Slime, fsm:FlxFSM<Slime>):Void
{
FlxG.sound.play("assets/groundpound.ogg");
FlxG.sound.play("assets/sounds/groundpound");
owner.animation.play("pound");
owner.velocity.x = 0;
owner.acceleration.x = 0;
Expand All @@ -187,7 +187,7 @@ class GroundPoundFinish extends FlxFSMState<Slime>
{
override function enter(owner:Slime, fsm:FlxFSM<Slime>):Void
{
FlxG.sound.play("assets/groundpoundfinish.ogg");
FlxG.sound.play("assets/sounds/groundpoundfinish");
owner.animation.play("landing");
FlxG.camera.shake(0.025, 0.25);
owner.velocity.x = 0;
Expand Down
7 changes: 7 additions & 0 deletions Input/FlxAction/source/Player.hx
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,17 @@ class Player extends FlxSprite

function updateDigital():Void
{
#if (flixel >= version("6.0.0"))
_virtualPad.getButton(UP).color = FlxColor.WHITE;
_virtualPad.getButton(DOWN).color = FlxColor.WHITE;
_virtualPad.getButton(LEFT).color = FlxColor.WHITE;
_virtualPad.getButton(RIGHT).color = FlxColor.WHITE;
#else
_virtualPad.buttonUp.color = FlxColor.WHITE;
_virtualPad.buttonDown.color = FlxColor.WHITE;
_virtualPad.buttonLeft.color = FlxColor.WHITE;
_virtualPad.buttonRight.color = FlxColor.WHITE;
#end

if (down.triggered)
{
Expand Down

0 comments on commit ccc1a1d

Please sign in to comment.