The delay for the next move should come as the key is held, but once
released there should be no delay (so you can tap the key).
I'm having a bit of problem trying to figure out the best way to do it.
I've tried somethings but haven't got it right.
code Example:
Check()
if keyboard.asyncKeyDown(&h7B) then//left
If item.X > 0 then
if Grid(item.x-1,item.y) = -1 then
if Grid(item.x-1,item.y+1) = -1 then
item.X = item.X -1
end if
end if
end if
elseif keyboard.asyncKeyDown(&h7c) then//right
if item.X < 9 then
if Grid(item.x+1,item.y)= -1 then
if Grid(item.x+1,item.y+1)= -1 then
item.X = item.X +1
end if
end if
end if
elseif keyboard.asyncKeyDown(&h7D) then // down
If item.y >-1 and item.Y <= 19 then //make sure we are in bounds
if Grid(item.x,item.y+1) = -1 then //make sure there isn't a
piece in next spot
item.Y = item.Y + 1
else
if item.Y > 19 then
item.Y = 19
end if
end if
end if
end if
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|