67 lines
1.7 KiB
Plaintext
Executable file
67 lines
1.7 KiB
Plaintext
Executable file
( L E V E L 0 0 0 0 6 )
|
|
|
|
objects: O
|
|
|
|
2 const ^1
|
|
30 const code-y
|
|
20 const code-x
|
|
|
|
: wait-for-digit ( -- n )
|
|
0 begin suspend ^1 dup 11 + for i key-pressed if drop i then next dup until
|
|
^1 - 1 + dup 10 = if drop 0 then ;
|
|
: draw-digit ( x n -- ) code-y swap 48 + text-color @ textc ;
|
|
: code-digit ( code x -- code )
|
|
wait-for-digit swap code-x + over draw-digit swap 10 * + ;
|
|
|
|
: read-code ( -- n )
|
|
WHITE text-color !
|
|
s" ####" code-x code-y textxy
|
|
0 0 code-digit
|
|
1 code-digit
|
|
2 code-digit
|
|
3 code-digit ;
|
|
|
|
var pady-introduced
|
|
: keypad-code responder entity.user cell + @ ;
|
|
: keypad create-extra-linked-object
|
|
:| dup EVTOUCH = if
|
|
pady-introduced @ not if
|
|
pady say" Hello, stranger! I'm Pady,\the friendly keypad lock!"
|
|
jaye say" I need to get through this\door, Pady."
|
|
pady say" You didn't say the magic\word, stranger!"
|
|
1 pady-introduced !
|
|
then
|
|
isneut? if move-player then
|
|
PAD-OFF responder>tile? if
|
|
runon pady say" Enter your 4-digit door code!\And have a super day!"
|
|
read-code keypad-code = if
|
|
pady say" That's right! Hooray!\You get a gold star!"
|
|
drop EVACT
|
|
else
|
|
pady say" Ohhh, sorry! That's not it.\Better luck next time!"
|
|
then
|
|
else
|
|
pady say" Oh hi again! I missed you too!"
|
|
then
|
|
then
|
|
dup PAD-ON PAD-OFF handle-onoff
|
|
PAD-ON handle-link |; listener! ;
|
|
|
|
3 1 door d1
|
|
17 1 door d2
|
|
4 11 door d3
|
|
10 9 door d4
|
|
|
|
1234 ' d1 3 2 keypad k1
|
|
-1 ' d2 17 2 keypad k2 ( must be hacked )
|
|
3456 ' d3 4 10 keypad k3
|
|
|
|
LEV_END 13 12 exitdoor dx
|
|
' dx 14 12 scanner sx
|
|
|
|
:noname O
|
|
5 1 tile>world Jaye entity.pos!
|
|
4 0 tile>world Neut entity.pos!
|
|
with-gord
|
|
; ' onload redefine
|