hasch command
Author |
Message |
gsquare567
|
Posted: Thu Apr 06, 2006 6:15 pm Post subject: hasch command |
|
|
here is my text:
var charPick,control:string(1)
var screenx,charx,chary:int:=0
charPick:="a"
control:="p"
getch (charPick)
if charPick="m" then
cls
loop
getch (control)
drawfillbox (0+screenx,0,maxx+screenx,maxy,brightblue)
drawfillbox (0+screenx,0,maxx+screenx,100,grey)
drawfilloval (100+charx,200+chary,20,20,66)
delay (200)
drawfilloval (100+charx,200+chary,20,20,brightblue)
charx:=charx-1
screenx:=screenx-1
hasch
if control="d" then
drawfilloval (100+charx,200+chary,20,20,brightblue)
charx:=charx+20
drawfilloval (100+charx,200+chary,20,20,66)
elsif chary>=1 then
if chary>=(-100) then
drawfilloval (100+charx,200+chary,20,20,brightblue)
chary:=0
drawfilloval (100+charx,200+chary,20,20,66)
end if
elsif control="a" then
drawfilloval (100+charx,200+chary,20,20,brightblue)
charx:=charx-20
drawfilloval (100+charx,200+chary,20,20,66)
elsif control="w" then
drawfilloval (100+charx,200+chary,20,20,brightblue)
chary:=chary+200
drawfilloval (100+charx,200+chary,20,20,66)
end if
end loop
end if
ok. so this is pretty crappy i just 4got how to put the hasch in there so it runs even wen u dont input a string 4 the getch.
ty ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
RedRogueXIII
![](http://compsci.ca/v3/uploads/user_avatars/431887573481a2d69185a9.png)
|
Posted: Thu Apr 06, 2006 6:37 pm Post subject: (No subject) |
|
|
Trying to see if it has a character or not ? Your post is a little unclear in the program's function. It looks like the beginning of a side scroller game but i'm not quite sure. I havent actually used hasch but I know of some code that can be helpful for keyboard input. Its this 'abnormal' boolean array and it works more or less like this :
code: |
var chars : array char of boolean
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) then
x += 10
end if
|
It checks to see if the key inside the brackets is pressed so it wont interrupt the flow of the program. Also it can be used for more or less any key, some have "KEY_" prefix while letters and numbers and the space just need to be chars ('A'). Its pretty simple and easy to use. |
|
|
|
|
![](images/spacer.gif) |
HellblazerX
![](http://www.plamania.co.kr/shopimages/plmtest/2910040000213.jpg)
|
Posted: Thu Apr 06, 2006 8:08 pm Post subject: (No subject) |
|
|
Hasch is a procedure that returns a boolean value, so you can't just put it into your code the way you did. You must use that value in some way, like this:
code: | if hasch then
....
end if
%or
exit when hasch
|
But it is recommended that you use RedRogue's method with the InputKeyDown. Also, the Input.KeyDown (chars) must be placed in your loop, and not outside it. |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Sat Apr 08, 2006 5:57 pm Post subject: (No subject) |
|
|
what hellblazers saying is that if you are going to use hasch, it is more or less a condition of some sort like "quit when he presses a char, or, if he presses a char then do this" sort of thing |
|
|
|
|
![](images/spacer.gif) |
|
|