Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / getting into combos

Author
Message
vivi
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 21st Apr 2003 15:15
Can anyone tell me how to do the following things:

1) if i hold down the upkey for a longer amount of time it will do something different (so you can charge up weapons etc). So its easier to do lets say hold it down for 1 second print "a" 2 seconds prints "b" etc.

2) how to a combo of keys eg Up then Down then Space to do something. (but is different to what Up, Down and Space do sepratly)
So lets say
Up print a
Down print b
and Space prints c
combo i want them to print d

thats for any help you can give me.
WHY WAIT FOR GAMES.......MAKE THEM COME TO YOU
>>>>www.sharksoft.scripterz.com<<<<<
THANKS IN ADVANCE
Danmatsuma
21
Years of Service
User Offline
Joined: 2nd Mar 2003
Location: Australia
Posted: 21st Apr 2003 15:40 Edited at: 21st Apr 2003 15:49
You need to learn about the 'timer()' function
and the 'and' operator so basically:

if upkey()=1 then upkeypress=timer()+1000
if timer()>upkeypress then etc

and this kind of thing too:

if upkey()=1 AND if downkey()=1 then etc...

Variations on these commands can do what you want

[edit]

One such variation would be:

sync on
do
cls
if upkey()=1
if uk=0 then upkeypress=timer():uk=1
if timer()>upkeypress+1000 then print "1000"
if timer()>upkeypress+2000 then print "2000"
if timer()>upkeypress+3000 then print "3000"
endif
if upkey()=0 then uk=0
sync
loop

ZX Spectrum 48k Issue 3, Radio shack Tape drive, Rank arena 12" T.V. set.

Login to post a reply

Server time is: 2024-09-20 06:48:09
Your offset time is: 2024-09-20 06:48:09