[Solved] FlxControl



  • Has anyone successfully implemented FlxControl in their game? I have it enabled but I can't seem to get it working.

    Here is the code from the Player class:

    import flixel.addons.plugin.control.FlxControl;
    import flixel.addons.plugin.control.FlxControlHandler;
    
    FlxControl.create(this, FlxControlHandler.MOVEMENT_ACCELERATES, FlxControlHandler.STOPPING_DECELERATES, 1, true, true);
    
    FlxControl.player1.setCursorControl(false, false, true, true);
    
    FlxControl.player1.setJumpButton("SPACE", FlxControlHandler.KEYMODE_PRESSED, 200, FlxObject.FLOOR, 250, 200);
    
    FlxControl.player1.setMovementSpeed(675, 0, 195, 200, 600, 0);
    
    FlxControl.player1.setGravity(0, 400);
    

    The character doesn't move at all. I can manually enter the control functions (FlxG.keys...) and it works but not FlxControl. What else do I need to do to get this working in HaxeFlixel?


  • administrators

    You are missing this call:

    FlxG.plugins.add(new FlxControl());
    

    Withtout it, FlxControl's update() function won't be called.



  • @Gama11 said in FlxControl:

    You are missing this call:

    FlxG.plugins.add(new FlxControl());
    

    Withtout it, FlxControl's update() function won't be called.

    Forgot to copy that from the Actionscript code. facepalm Thanks


Log in to reply