add stuff?

This commit is contained in:
Nico 2021-04-01 20:05:41 +01:00
parent f2c33f880f
commit 3553032a05
1 changed files with 19 additions and 2 deletions

21
main.fs
View File

@ -47,6 +47,8 @@ create constructcost 0 , 0
variable constructcount
\ count-messages-shown contains the amount of device count milestone messages that have been shown.
variable count-messages-shown
\ the variable detector-unlocked stores if the metal detector has been unlocked.
variable detector-unlocked
\ the variable screen contains the current screen number.
\ 0 = devices
\ 1 = garden
@ -92,9 +94,13 @@ S" you feel like throwing some stuff into the pool." set-message
30 devices can-afford? constructcost @ 0= and if
40 constructcost !
S" You figure out that you can probably hack these devices." set-message then ;
: unlock-detector
100 devices can-afford? detector-unlocked @ 0= and if
-1 detector-unlocked ! then ;
\ the word unlock tests to see if any unlock conditions are matched, and unlocks them if they are.
: unlock unlock-members unlock-constructs ;
: unlock unlock-members unlock-constructs unlock-detector ;
\ the word wait-tick waits a tick. Ticks are 1ms currently.
: wait-tick 1 ms ;
@ -159,6 +165,10 @@ S" you feel like throwing some stuff into the pool." set-message
clear-message
then ;
\ the word buy-detector buys the metal detector!
: buy-detector
400 devices can-afford? if
1 screens +! then ;
\ DEBUGGING STUFF
@ -188,6 +198,7 @@ S" you feel like throwing some stuff into the pool." set-message
case
[char] h of hire-chat-member endof
[char] b of build-construct endof
[char] g of buy-detector endof
endcase ;
\ the word handle-input handles input every time around the game loop.
@ -276,11 +287,17 @@ S" you feel like throwing some stuff into the pool." set-message
else drop then
inc-y ;
: draw-detector ( x y -- x y )
detector-unlocked @ screens @ 0= and if
." (g)o metal detecting! [400 Devices]"
then inc-y ;
\ draw-actions draws a list of the actions you've unlocked.
: draw-actions ( x y -- x y )
2dup at-xy
draw-members cr over move-right
draw-constructs cr over move-right
draw-detector cr over move-right
." (q)uit (without saving)"
\ add 1 to y
inc-y ;