Here is the complete game code in TGRK. It ended up being 294 bytes, so I cannot test it on the device. My options for running this game are either A. expand the program size from 127 to 300 bytes, which would make me have to refactor a lot of different things. or B, implement the game in C and have it as a feature on the device.
Probably going to keep the interpreter as it is and add the game as an extra feature. Either way, it was fun writing this program in TGRK:
EDIT: I Slimmed it way down. Removed the menu system and just have < > and T buttons. The math for damage and monster health calculations had to be slightly slimmed down as well. As well as removing the option to roll to run away. Now during a fight you can just run.
I also removed XP, and changed gold (Stored in R3) as the players damage multiplier. HP is also a damage multiplier.
Simplified Code now fits in exactly 127 Bytes. Will get my serial dongle out tomorrow and drop it on there and see if it works!
* FIGHT *
F7
FUNC
CG RND 64 AND CE R8 3 AND CG R1 R7
R5 R1 DIV 2
R8 1
SEP
CE R8 1
R6 RND ADD R1 ADD R5 DIV 12
R2 SUB R6
R8 0
SEP
CE R8 2
R6 R2 ADD R3 ADD RND DIV 12
R5 SUB R6
R8 1
SEP
CLE R5 0
R7 R1
R3 ADD RND DIV 2
R8 0
FUNC
* CONTROLS *
F8
FUNC
BG
L0L
L1L
S1
CE BV 1
R1 SUB 1
L0H
SEP
CE BV 2
R1 ADD 1
R8 3
L1H
SEP
CE BV 3
L1H
L0H
R8 2
SEP
CE BV 3 AND CE R1 0
R2 ADD R3
R3 0
BB R3
SEP
F7
FUNC
R2 64
* MAIN LOOP *
CG R2 0 AND CLE R1 126
F8
LP
EOPOriginal Code:
R2 64
* INN *
F1
FUNC
CE R8 0 AND CG R2 0
R2 ADD R3
R3 0
SEP
CE R8 1
BB R3
SEP
CE R8 2
BB R2
SEP
CE R8 3
R1 ADD 1
SEP
FUNC
* MONSTER ATTACK *
F2
FUNC
R6 RND ADD R1 ADD R5 DIV 12
R2 SUB R6
FUNC
* PLAYER ATTACK *
F3
FUNC
R6 R2 ADD R4 ADD RND DIV 12 ADD 1
R5 SUB R6
CLE R5 0
R7 R1
R4 ADD R1 DIV 10
R3 ADD RND ADD R1 DIV 2 ADD 1
FUNC
* FIGHT MENU *
F4
FUNC
CE R8 3
F2
SEP
R8 3
BG
CE BV 1 AND CG RND 60
R1 SUB 1
R5 0
R8 0
SEP
CE BV 2 AND CG RND 50
R1 ADD 1
R5 0
R8 3
SEP
CE BV 3
F3
SEP
CE BV 4
BB R2
R8 2
SEP
CG R5 0 AND CG R2 0
LPF
SEP
R8 3
FUNC
* ROAD MENU *
F5
FUNC
CE R8 3
R1 ADD 1
SEP
CE R8 0
R1 SUB 1
SEP
CE R8 1
BB R1
SEP
CE R8 2
BB R2
SEP
CG RND 50 AND CG R1 R7
R5 R1 DIV 2 ADD 1
F4
FUNC
* MENU LED *
F6
FUNC
CE R8 0
L0L
L1L
SEP
CE R8 1
L0H
L1L
SEP
CE R8 2
L0L
L1H
SEP
CE R8 3
L0H
L0H
FUNC
* BUTTON INPUT *
F7
FUNC
BG
CE BV 1 AND CG F8 0
F8 SUB 1
F6
SEP
CE BV 2 AND CL F8 3
F8 ADD 1
F6
SEP
CE BV 3 AND CE F1 0
F6
F1
SEP
CE BV 3 AND CG F1 0
F6
F5
FUNC
* GAME LOOP *
F8
FUNC
CG R2 0 AND CLE R1 126
F7
LP
SEP
CE R1 127
L1L L0H S1
L0L L1H S1
LP
SEP
L1H L0H S1
L1L L0L S1
LP
FUNC
EOP
Gordon
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.