I think the question is self explanatory, thank you.
Is there a PC equivalent for touch swipe?
Well you could probably detect when they press down. Then make a variable for the runner mouses position, then when they let go, see where the current mouse position is compared to the old position.
local UserInputService = game:GetService("UserInputService")
local MouseX
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
UserInputService.InputBegan:Connect(function(inp, gpe)
if inp.UserInputType == Enum.UserInputType.MouseButton1 and not gpe then
MouseX = Mouse.X
end
end)
UserInputService.InputEnded:Connect(function(inp, gpe)
local DiffX = (MouseX - Mouse.X)
if DiffX > 100 or DiffX < -100 then
if DiffX < 0 then
print("move right")
--Player swiped to right
elseif DiffX >= 0 then
print("move left")
--Player swiped to left
end
else
print("Not enough movement")
end
end)
This isn’t the exact code you’re going to be using, but it should give you the basic understanding!
DiffX is the amount (vector2) the player moved their mouse, I check if the difference is greater than 100 OR less than 100 to make sure miniscule swipes aren’t picked up, if the difference is in the negative it means they moved right, if it’s positive they moved left!
Now, you can always use DiffX as a multiplier to determine how powerful of a swipe something was, if they swiped longer the number will be bigger (in negative number cases, just use math.abs)
good luck!
So this is assuming that player clicks the frame and drags the frame until it made enough difference?
This doesn’t drag the frame or anything, this just detects input and handles most of the back end for you, you can do the fancy stuff yourself, if this helped you please mark it as a solution!
So what does a player have to do to perform that ‘swipe’ action? Click and drag or what?
Click and drag to the right or left, read the code you’ll see that if the difference on the X axis is less than 0 it means they clicked and dragged right, else it was left.