mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-05 06:14:36 +00:00
android pause and controls tweaks
This commit is contained in:
parent
61ba71d3db
commit
4d97591e30
|
@ -201,6 +201,8 @@ class FreeplayState extends MusicBeatState
|
|||
}
|
||||
|
||||
var touchY:Float = 0;
|
||||
var touchX:Float = 0;
|
||||
var dxTouch:Float = 0;
|
||||
var dyTouch:Float = 0;
|
||||
var velTouch:Float = 0;
|
||||
|
||||
|
@ -243,12 +245,23 @@ class FreeplayState extends MusicBeatState
|
|||
velTouch = Math.abs((touch.screenY - dyTouch)) / 50;
|
||||
|
||||
dyTouch = touch.screenY - touchY;
|
||||
dxTouch = touch.screenX - touchX;
|
||||
|
||||
if (touch.justPressed)
|
||||
{
|
||||
touchY = touch.screenY;
|
||||
dyTouch = 0;
|
||||
velTouch = 0;
|
||||
|
||||
touchX = touch.screenX;
|
||||
dxTouch = 0;
|
||||
}
|
||||
|
||||
if (Math.abs(dxTouch) >= 100)
|
||||
{
|
||||
touchX = touch.screenX;
|
||||
if (dxTouch != 0)
|
||||
dxTouch < 0 ? changeDiff(1) : changeDiff(-1);
|
||||
}
|
||||
|
||||
if (Math.abs(dyTouch) >= 100)
|
||||
|
@ -264,23 +277,23 @@ class FreeplayState extends MusicBeatState
|
|||
{
|
||||
touchTimer = 0;
|
||||
|
||||
if (velTouch >= 0)
|
||||
{
|
||||
trace(velTouch);
|
||||
velTouch -= FlxG.elapsed;
|
||||
|
||||
veloctiyLoopShit += velTouch;
|
||||
|
||||
trace("VEL LOOP: " + veloctiyLoopShit);
|
||||
|
||||
if (veloctiyLoopShit >= 30)
|
||||
/* if (velTouch >= 0)
|
||||
{
|
||||
veloctiyLoopShit = 0;
|
||||
changeSelection(1);
|
||||
}
|
||||
trace(velTouch);
|
||||
velTouch -= FlxG.elapsed;
|
||||
|
||||
// trace(velTouch);
|
||||
}
|
||||
veloctiyLoopShit += velTouch;
|
||||
|
||||
trace("VEL LOOP: " + veloctiyLoopShit);
|
||||
|
||||
if (veloctiyLoopShit >= 30)
|
||||
{
|
||||
veloctiyLoopShit = 0;
|
||||
changeSelection(1);
|
||||
}
|
||||
|
||||
// trace(velTouch);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,15 @@ class PauseSubState extends MusicBeatSubstate
|
|||
changeSelection(1);
|
||||
}
|
||||
|
||||
var androidPause:Bool = false;
|
||||
|
||||
#if android
|
||||
androidPause = FlxG.android.justPressed.BACK;
|
||||
#end
|
||||
|
||||
if (androidPause)
|
||||
close();
|
||||
|
||||
if (accepted)
|
||||
{
|
||||
var daSelected:String = menuItems[curSelected];
|
||||
|
|
|
@ -1948,7 +1948,13 @@ class PlayState extends MusicBeatState
|
|||
|
||||
scoreTxt.text = "Score:" + songScore;
|
||||
|
||||
if (controls.PAUSE && startedCountdown && canPause)
|
||||
var androidPause:Bool = false;
|
||||
|
||||
#if android
|
||||
androidPause = FlxG.android.justPressed.BACK;
|
||||
#end
|
||||
|
||||
if ((controls.PAUSE || androidPause) && startedCountdown && canPause)
|
||||
{
|
||||
persistentUpdate = false;
|
||||
persistentDraw = true;
|
||||
|
@ -2666,30 +2672,30 @@ class PlayState extends MusicBeatState
|
|||
{
|
||||
if (touch.justPressed)
|
||||
{
|
||||
if (touch.justPressedPosition.x >= widHalf)
|
||||
var getHeight:Int = Math.floor(touch.justPressedPosition.y / (FlxG.height / 3));
|
||||
|
||||
switch (getHeight)
|
||||
{
|
||||
if (touch.justPressedPosition.y >= heightHalf)
|
||||
pressArray[3] = true;
|
||||
else
|
||||
case 0:
|
||||
pressArray[2] = true;
|
||||
case 1:
|
||||
touch.justPressedPosition.x < widHalf ? pressArray[0] = true : pressArray[3] = true;
|
||||
case 2:
|
||||
pressArray[1] = true;
|
||||
}
|
||||
else if (touch.justPressedPosition.y >= heightHalf)
|
||||
pressArray[1] = true;
|
||||
else
|
||||
pressArray[0] = true;
|
||||
}
|
||||
|
||||
if (touch.justPressedPosition.x >= widHalf)
|
||||
var getHeight:Int = Math.floor(touch.justPressedPosition.y / (FlxG.height / 3));
|
||||
|
||||
switch (getHeight)
|
||||
{
|
||||
if (touch.justPressedPosition.y >= heightHalf)
|
||||
holdArray[3] = true;
|
||||
else
|
||||
case 0:
|
||||
holdArray[2] = true;
|
||||
case 1:
|
||||
touch.justPressedPosition.x < widHalf ? holdArray[0] = true : holdArray[3] = true;
|
||||
case 2:
|
||||
holdArray[1] = true;
|
||||
}
|
||||
else if (touch.justPressedPosition.y >= heightHalf)
|
||||
holdArray[1] = true;
|
||||
else
|
||||
holdArray[0] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2706,7 +2712,7 @@ class PlayState extends MusicBeatState
|
|||
// PRESSES, check for note hits
|
||||
if (pressArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
|
||||
{
|
||||
Haptic.vibrate(400, 70);
|
||||
Haptic.vibrate(100, 100);
|
||||
|
||||
boyfriend.holdTimer = 0;
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ import flixel.addons.transition.FlxTransitionableState;
|
|||
import flixel.addons.transition.TransitionData;
|
||||
import flixel.graphics.FlxGraphic;
|
||||
import flixel.group.FlxGroup;
|
||||
import flixel.input.android.FlxAndroidKey;
|
||||
import flixel.input.android.FlxAndroidKeys;
|
||||
import flixel.input.gamepad.FlxGamepad;
|
||||
import flixel.input.gamepad.id.SwitchJoyconLeftID;
|
||||
import flixel.math.FlxPoint;
|
||||
|
@ -81,6 +83,10 @@ class TitleState extends MusicBeatState
|
|||
|
||||
override public function create():Void
|
||||
{
|
||||
#if android
|
||||
FlxG.android.preventDefaultKeys = [FlxAndroidKey.BACK];
|
||||
#end
|
||||
|
||||
FlxG.debugger.addButton(LEFT, new BitmapData(200, 200), function()
|
||||
{
|
||||
FlxG.debugger.visible = false;
|
||||
|
@ -478,16 +484,18 @@ class TitleState extends MusicBeatState
|
|||
FlxG.fullscreen = !FlxG.fullscreen;
|
||||
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;
|
||||
|
||||
#if mobile
|
||||
for (touch in FlxG.touches.list)
|
||||
if (FlxG.onMobile)
|
||||
{
|
||||
if (touch.justPressed)
|
||||
for (touch in FlxG.touches.list)
|
||||
{
|
||||
FlxG.switchState(new FreeplayState());
|
||||
pressedEnter = true;
|
||||
if (touch.justPressed)
|
||||
{
|
||||
FlxG.switchState(new FreeplayState());
|
||||
pressedEnter = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
if (gamepad != null)
|
||||
|
|
Loading…
Reference in a new issue