I'm trying to disable the d-pad for a game mechanic I'm implementing in my game. Is there a way to do this? I had some ideas, but they all seemed convoluted and complicated (like surrounding the player with solid tiles), but the player will move (by turning the crank) while the d-pad is disabled. Is there a simple-ish way to disable d-pad input?
You mean "disable d-pad input" in the last sentence right?
Oh yes, sorry :)) Do you have any ideas?
It’s not simple, but I do this in my projects a lot:
on update do
py = event.py
px = event.px
dy = event.dy
dx = event.dx
if dpad_off==1 then
if dy==-1 then
dy = 0
py -= 1
goto px,py
elseif dy==1 then
dy = 0
py += 1
goto px,py
end
if dpad_off==1 then
if dx==-1 then
dx = 0
px -= 1
goto px,py
elseif dx==1 then
dx = 0
px += 1
goto px,py
This should work.
Thank you! Thankfully i was able to figure it out on my own, and my solution is almost identical to yours. Thanks for the help!
There is a simpler way
on update do
if DisableDPAD==1 then
//if the new position isn't the same as the old one, return to the last position
if event.px!=LastPosX then
goto LastPosX,LastPosY
end
if event.py!=LastPosY then
goto LastPosX,LastPosY
end
else
//store last position
LastPosX = event.px
LastPosY = event.py
end
end
This is really simpler! Thanks :)) I moved the solution to the simpler one to avoid any confusion
1 Like