How to detect diagonal on the directional pad..
Moderators: Shine, Insert_witty_name
How to detect diagonal on the directional pad..
How can I detect the pressing of a diagonal on the directional pad. Like pressing up and right at the same time.
-
- Posts: 116
- Joined: Mon Jul 18, 2005 2:20 am
Here for 'hardcoded':
Make sure the diagonals are before the 'normal' ones.
You can prolly use this if you use it for some kind of value changes, like y=y+1 and x=x+1 etc.:
Code: Select all
if pad:up() and pad:right() then
....
elseif pad:up() and pad:left() then
....
elseif pad:up() then
....
elseif pad:left() then
....
end
You can prolly use this if you use it for some kind of value changes, like y=y+1 and x=x+1 etc.:
Code: Select all
if pad:up() then
....
end
if pad:right() then
....
end
if pad:left() then
....
end
Last edited by MikeHaggar on Sat Feb 11, 2006 7:36 am, edited 1 time in total.
If you do it the second way suggested by MikeHaggar, i.e.,
It should work perfectly without having to introduce the complexity of a timer or worrying about what order to call the checks in.MikeHaggar wrote: You can prolly use this if you use it for some kind of value changes, like y=y+1 and x=x+1 etc.:
Code: Select all
if pad:up() then .... end if pad:right() then .... end if pad:left() then .... end
-
- Posts: 116
- Joined: Mon Jul 18, 2005 2:20 am