double click
I would like to assign two different commands, one to a simple click, and a second command to a quick double click...can anyone help me?
I would like to assign two different commands, one to a simple click, and a second command to a quick double click...can anyone help me?
i.e click=jump double click= super jump
https://microstudio.dev/i/Vafis/asmallworld/ , file player
, dash
https://microstudio.dev/i/Loginus/joyultraadventure2/ file joy
, dash
( this is not my code . )
thanks for these links, I'm trying to figure something out but I'm really dumb
if keyboard.press.SPACE and jumps > 0 then jumps -= 1 player.vy += JumpForce for i=0 to 5 by 1 particles.add("objects/smoklet",player.x,player.y-5) end local jump = audio.playSound("jump",.5) end
if player.grounded == false and jumps >= 1 then player.name = "player/player_jump" elsif player.grounded == false and jumps <= 0 then player.name = "player/player_double_jump" end end is this supposed to be it?
I have an update I managed to get a double click command, but now I always get only a double click value this is the code used
if touch.touching or mouse.left then
var currentTime = time
if isWaitingForSingleTap then
if currentTime - lastClickTime <= clickThreshold then
// Double tap detected
isDoubleTap = true
isWaitingForSingleTap = false // Stop waiting for single tap
eroe_vy = 10.5
audio.beep("square tempo 35000 volume 100 span 50 C3 to C7")
print("Double tap detected")
end
else
isWaitingForSingleTap = true
lastClickTime = currentTime
print("First tap registered")
end
end
if isWaitingForSingleTap and (time - lastClickTime > clickThreshold) then
isWaitingForSingleTap = false // Timeout for double tap detection
if not isDoubleTap then
// Single tap logic
if eroe_y == 0 then
eroe_vy = 7.5
audio.beep("square tempo 20000 volume 70 span 100 C4 to C6")
print("Single tap detected")
end
end
isDoubleTap = false // Reset double tap flag
end
I used these variables:
var lastClickTime = 0 var clickThreshold = 0.3 var isDoubleTap = false var isWaitingForSingleTap = false var touchPreviouslyDetected = false