realbasic-games
[Top] [All Lists]

Re: Get the feel

To: realbasic-games at lists dot realsoftware dot com
Subject: Re: Get the feel
From: Eric Richards <erockus at earthlink dot net>
Date: Thu, 03 Aug 2006 15:21:05 -0500
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <20060803170027 dot 8018513F5F33 at lists dot realsoftware dot com>



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>


<Prev in Thread] Current Thread [Next in Thread>