forum.boolean.name

forum.boolean.name (http://forum.boolean.name/index.php)
-   MidletPascal (http://forum.boolean.name/forumdisplay.php?f=46)
-   -   getKeyClicked (http://forum.boolean.name/showthread.php?t=13417)

NastyKhan 27.09.2010 18:32

getKeyClicked
 
Hi,

I have something like this:

if (keyToAction(getKeyClicked)=GA_LEFT) then s:=1;
if (keyToAction(getKeyClicked)=GA_DOWN) then s:=2;
if (keyToAction(getKeyClicked)=GA_RIGHT) then s:=3;


but it works only when i press 'left'. Nothing happens, when i press 'down' or 'right'.

What's more interesting, if i disable the first one:

{if (keyToAction(getKeyClicked)=GA_LEFT) then s:=1;}
if (keyToAction(getKeyClicked)=GA_DOWN) then s:=2;
if (keyToAction(getKeyClicked)=GA_RIGHT) then s:=3;


then only 'down' works.

Using 'else' instead of three separete "IFs" doesn't work as well.

Everything is fine, when i use "getKeyPressed", instead of "getKeyClicked", but in this case i NEED "getKeyClicked".

So.. any idea, how to solve this?

Thanks

DIMMON4IK 27.09.2010 18:50

Ответ: getKeyClicked
 
PHP код:

if (keyToAction(getKeyClicked)=GA_LEFTthen s:=else
if (
keyToAction(getKeyClicked)=GA_DOWNthen s:=else
if (
keyToAction(getKeyClicked)=GA_RIGHTthen s:=3

Maybe it works

Dj_Alex 27.09.2010 18:50

Ответ: getKeyClicked
 
var key:integer;
key:=getKeyClicked;
if (keyToAction(key)=GA_LEFT) then s:=1;
if (keyToAction(key)=GA_DOWN) then s:=2;
if (keyToAction(key)=GA_RIGHT) then s:=3;

NastyKhan 27.09.2010 19:11

Ответ: getKeyClicked
 
DIMMON4IK:
I already said that using 'else' instead of three separete "IFs" doesn't work as well. Thanks for trying anyway.

Dj_Alex:
Bulls' eye! It works :) Thx!


Часовой пояс GMT +4, время: 00:35.

vBulletin® Version 3.6.5.
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Перевод: zCarot