Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MondayHopscotch/23e75a9bf91273ac9e61fe3a27a2bba5 to your computer and use it in GitHub Desktop.
Save MondayHopscotch/23e75a9bf91273ac9e61fe3a27a2bba5 to your computer and use it in GitHub Desktop.
HaxeFlixel HTML5 mobile haptics
var button = new FlxButton(X, Y);
#if js // access to JS packages
if (FlxG.onMobile) { // on mobile device
button.onDown.callback = () -> {
js.Browser.navigator.vibrate(5); // vibrate breifly to indicate button was pressed
};
}
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment