Jump to content
IGNORED

New 32k XB Game:ZOMBi (work in progress)


Sinphaltimus

Recommended Posts

And his kind of optimization needs to wait until the very last steps.

 

Yes, you have to find flexibility that suits you. I draw and rearrange characters in graphic oriented programs (like Magellan) and export to XB. I then go back to the graphic file for any changes.

 

I ran your program. Made a memory dump using F10 in Classic99. Imported the graphics and exported XB code as you saw it.

 

;)

  • Like 1
Link to comment
Share on other sites

Not my fault, his patterns are scattered all around. Ideally you'd want to stack your patterns in a more efficient manner, which as he's indicated, is something for the future. :)

 

Well, my fault then for rearranging his patterns then. Oh, I didn't. :-D

 

Not my fault TI chose to have DATA as a token but not CALL CHAR. :lol:

Edited by sometimes99er
  • Like 1
Link to comment
Share on other sites

LOL, Yeah guys. First, I had to be very careful, I nearly ran out of char codes and sprite numbers for that matter, then I realized I needed numbers so I have to split my char codes up to open up a gap to leave the numbers alone. Oh it was crazy. Here's a breakdown of some of the things that I keep in a running "reference" file as I code...

 

sprites used up = 1 to 25 (PUSHING 27 WITH 2 FOR MELEE ATTACKS) - 28 max.
L1-YP=9 (START) Hole spr#2
L2-33 Hole spr#3 - 2/3 - 10/11
L3-57 Hole spr#4 - 4/5 - 12/13
L4-81 Hole spr#5 - 6/7 - 14/15
L5-105 Hole spr#6 - 8/9 - 16/17
L6-129 Hole spr#7 - 10/11 - 18/19
L7-153 Hole spr#8 - 12/13 - 20/21
G-177 - No Hole Location GRND-3,(HLE*8)+1 OR = LastHLE - 14/15 - 22/23
Level
Pixel borders = 7 and 240
display at (22,15):xp CAL
#2-#8 - holes
tHIS IS HOW THE CHARS NEED TO BE
33-38 rr = 6 patterns
39-43 sjr = 5 pat
44 = idle
64-67 jr = 4 pat
68-69 lr = 2 pat
70-75 rl = 6 pat
76-80 sjl = 5 pat
81-84 jl = 4 pat
85-86 ll = 2 pat
(0-9)=48-57
dim default(91)
for deflt=33-124
get pat(
LO0T(2,14)
CHAR
SPRITE#
z3d=(2,14)
for ms=-4 to -50
call sound(20,ms,0)
next ms
char codes and color groups in use
33-43 & 57-73:running jumping man. Color groups:1,2 & 5,6,7
FOR CHRR=33-38/1 !setup for creating running characters right
FOR CHSR=39-43/1,2 !setup for creating stop and jump characters right
FOR CHJR=64-67/5 !setup for creating jumping characters right
*FOR CHLR=68-69/5 !setup for creating landing characters right
left running***********************
FOR CHRL=76-80/6,7 !setup for creating running characters left
FOR CHSL=81-80/6 !setup for creating stop and jump characters left
FOR CHJL=81-84/7 !setup for creating jumping characters left
FOR CHLL=85-86/7 !setup for creating landing characters left
44=idle CG:2
45=MAN MELEE ATTACK
46=MAN RANGED LEFT
47=MAN RANGED RIGHT
nUMBER 0-9 = 48-57 = 3,4
88:heart. Color groups:8 COLOR:7
96:zombie. color groups:9 (up to 8 zombies difficulties) COLOR:4
104:bad girder. Color groups:10 color 15
105:girder. color group 10 color 15
106:the hole. color group 10 color 1 assigned via callsprite
107:the exit. Color groups:10 color 15
112:melee weapon. Color groups:11 COLOR:8
113:ranged weapon. Color groups:11 COLOR:8
DELETE 33-39: Numbers 0-6 Color Group 1 Color: 12
DELETE 128-130: numbers 7-9 Color Group 13 Colot:12
120-122: score char color group 12 color 12
123: X for hearts, melee and ranged. color group 12 color 12
124:EXit char. 11 8
142:BULLET
143:Melee weapon attack 16,12
********Sprites******
#1 - MAN
#2-#8 - holes
#9 - exit
#10-#23 OLDSLOT (loot)
#24/27 for melee weapon atttack or #26 for bullet.

Link to comment
Share on other sites

Maybe one of you advanced programmers could make a notepad++ plugin that copy/insert all lines that start with ! to their matching line numbers in a second document? Pushing down the existing contents starting from top and going down.

Basically, an automatic way to reinsert comments when you have two docs open side by side. The line numbers I refer to above are the internal line numbers of notepad++ not XB line numbers that have been resequenced.

That's basically what I'm doing right now, manually, line by line. It's very tedious and time consuming and monotonous.

Edited by Sinphaltimus
Link to comment
Share on other sites

Note, I use UltraEdit, but understand (googling) that Notepad++ can do the same.

1. In column mode insert a special word before all lines in the program file. Do a column mode selection of the entire contents of the program file (you should see a rectangular area). Copy.

2. Add space characters to the end of the first line of the comment file until it is longer than the longest line in that file. Paste (the above) after the spaces added.

3. Replace the special word with the escape code(s) for "newline". Done.

You will need to set the "Search Mode" to "Extended", so that Notepad++ honors escape codes. "\r\n" is the escape code for carriage-return, the standard for new lines in Windows. Unix-style systems use simply \n (newline). Most IDEs, Notepad++ included, will understand both styles and portray them each with new lines, but core Windows utilities do not understand \n as being equivalent to \r\n, so the latter is usually the most appropriate if the file is intended to be used in Windows environments.

Example using UltraEdit

notepad.gif

Edited by sometimes99er
  • Like 1
Link to comment
Share on other sites

Note, I use UltraEdit, but understand (googling) that Notepad++ can do the same.

 

1. In column mode insert a special word before all lines in the program file. Do a column mode selection of the entire contents of the program file (you should see a rectangular area). Copy.

 

2. Add space characters to the end of the first line of the comment file until it is longer than the longest line in that file. Paste (the above) after the spaces added.

 

3. Replace the special word with the escape code(s) for "newline". Done.

 

You will need to set the "Search Mode" to "Extended", so that Notepad++ honors escape codes. "\r\n" is the escape code for carriage-return, the standard for new lines in Windows. Unix-style systems use simply \n (newline). Most IDEs, Notepad++ included, will understand both styles and portray them each with new lines, but core Windows utilities do not understand \n as being equivalent to \r\n, so the latter is usually the most appropriate if the file is intended to be used in Windows environments.

 

Example using UltraEdit

notepad.gif

 

 

Wow, OK, I'm going to have to get this going ASAP! :)

 

EDIT upon closer inspection, I'm not so sure this would work. In your example, it's every other line and the left side is all comments and the right is all code.

 

For me, it would be left side is code and comments (not as clean as every other line) and the right side is code no comments.

 

post-47352-0-05626100-1472551100_thumb.png

 

What I'm looking for is a pluggin type function that could scan the left doc and locate all lines starting with ! then insert them over to the right side text to the appropriate location and carriage return.

Here's how I see it working line by line.

 

Code starts at left,

line 1 = blank = skip

line 2 does not start with !, skip

line 3 has exclamation, copy line 3, insert at beginning of line 3 right side text document, carriage return at end of inserted line.

Return to document on left and continue.

Edited by Sinphaltimus
Link to comment
Share on other sites

Gave it some thought. One could do as you suggest (plugin, macro, script or something) but it looks like a bit of a time-consuming detour for me, but perhaps also a nice learning experience. Anyways ...

 

If the comments are important, then I suggest a working routine with changes made to the source text-file (no typing in XB). Any change (one line or a chunk) copied to Classic99. Of course Classic99 already having the latest version (either by pasting all of the source or having loaded a previously saved version). Well, that's how I do it with XB.

 

;)

Edited by sometimes99er
Link to comment
Share on other sites

Yeah, I ventured in to their plugin building and went through their existing plugins. Not very helpful on the first run but there are plugins with comparison features that highlight differences. I'm thinking I might be able to play with something like that then edit it.

I just need to find out what kind of code is used to identify certain parts and then figure out if there are any copy paste commands and how much and what kind of control is available for that sort of function.

 

When I get bored.

 

I made a lot of progress last night in getting ranged weapons to work. So I'm more focused on getting this game done than plugins.

Edited by Sinphaltimus
Link to comment
Share on other sites

You could write an XB program. Have two input files and one output open at the same time. ;)

Not there yet. My experience keeps me contained in one simple xb program. The disk controller manual gave me a head ache trying to understand opening files for input and such. I know it's relatively simple for most but I'm not there yet.

 

Someday...

Link to comment
Share on other sites

NEW VERSION 0.33 - >>CLICK HERE<< TO GET IT!

*Zip file contains BASIC code in text (with comments) and Classic99 disk file.

 

GAME IS CURRENTLY EARLY ACCESS ALPHA version. No ETA on Beta.

How To Play:
About: This is meant to be a semi casual zombie survival game to escape a skyscraper. Play for high score.
Combat: A melee attack is a swing attack that covers the space directly in front and behind the player. You get one attack per inventory item.
Joystick down = ranged attack.
ZEDS: Will grab you and attack you. Hold a direction to escape, try hitting with melee, break away as fast as you can.
DODGE: You can attempt to dodge zeds by jumping past them (joystick button or J)
LOOTING: Will slow you down, jump past it to dodge the loot if you need to (for future versions when Zombies run)
Controls:
X=Quit, R=Reset, J and Controller Button = Jump, Joystick Left/Right moves left/right,
Joystick up = melee attack -
Notes: Melee attacks will destroy loot including hearts.
Don't mash the jump button, press and hold. It is possible to run over holes or run past loot without picking it up. Technically it's a COINC detection issue. I call it a feature. Looting while running? You're gonna miss a thing or two. Running over a hole? It's just a high risk jump. The crumbling floor on each side of the hole? Be careful of loose gravel, you can slip and fall.
Backstory: It's the zombie apocalypse. Hordes of the living dead are roaming the streets, you hear a helicopter and climb the tallest building level by crumbling level. You get to the roof and just as you make it to the end, the roof door is barred and you hear the helicopter motors fading in to the distance. Then you hear another sound. The sound of the dead creeping in and closer. They must have followed you. Now, it's time to get out. Escape to the ground floor street level. Good Luck.
V033 changes:
Added ranged weapon attacks
Added more sounds
Add to Notes: Don't spam the jump button, just hold it down.
Cleaned up all code comments and recoded an bunch of mistakes.
To Do Next:
Replace temp zombi health with per sprite health. right now they share 2hps and it gets reset to 2 at each death.
Create basic zombie AI and animate.
Session high score display between level progressions and at end of game.
Regain sprite by not using sprite for level exit.
Adjust range of ranged weapon to not hit at close range. Rely on melee for that.
KNOW ISSUES:
There are no known bugs at time of upload.
There are performance issues.
The code is bloated. A lot of fluff and stuff. I needed it this way to hunt bugs. I will optimize the code in a later version.
Not all functionality or game mechanics have been developed as of this version.
To Do Long Term:
Title screen.
Sounds
Music.
Loot balancing with board progression. (game balancing)
zombie difficulty linked to board progression.
At least 2 more types of ever more difficult zombies.
A lot of code optimizing.

100 SCORE=0000 :: HEALTH=10 :: BOARD=1 :: HSCORE=0
!weapons inventory
110 MELEE=0 :: RANGED=0::bull=8
120 CALL SCREEN(2)
130 CALL COLOR(10,15,1):: CALL COLOR(12,12,1):: CALL COLOR(3,12,1):: CALL COLOR(4,12,1)
140 CALL COLOR(8,7,1):: CALL COLOR(11,8,1):: CALL COLOR(14,12,1):: HCLR=1
150 CALL CLEAR
!running patterns right
160 DATA 1818101010101018,1818183C1C142630,181A3C5E1A334060,18197E981C724100,18197E9818147243,1818385E581C2436
!stop and jump right
170 DATA 1818101010101018,000C1C3058081018,00000C1C305C1C18,0000060E183C0C18,0003070C18081018
!jumping right
180 DATA 0303040609081010,1818141810106000,1818103810180C00,1818503010180404
!landing right
190 DATA 0018183050180818,1818101038501018
!running patterns left
200 DATA 1818080808080818,1818183C3828640C,18583C7A58CC0206,18987E19384E8200,18987E1918284EC2,18181C7A1A38246C
!stop and jump left
210 DATA 1818080808080818,0030380C1A100818,000030380C3A3818,00006070183C3018,00C0E03018100818
!jumping left
220 DATA C0C0206090100808,1818281808080600,1818081C08183000,18180A0C08182020
!landing right
230 DATA 0018180C0A181018,181808081C0A0818
!setup for creating running characters right
240 FOR CHRR=33 TO 38
250 READ PAT$
260 CALL CHAR(CHRR,PAT$)
270 NEXT CHRR
!setup for creating stop and jump characters right
280 FOR CHSR=39 TO 43
290 READ PAT$
300 CALL CHAR(CHSR,PAT$)
310 NEXT CHSR
!setup for creating jumping characters right
320 FOR CHJR=64 TO 67
330 READ PAT$
340 CALL CHAR(CHJR,PAT$)
350 NEXT CHJR
!setup for creating landing characters right
360 FOR CHLR=68 TO 69
370 READ PAT$
380 CALL CHAR(CHLR,PAT$)
390 NEXT CHLR
! left running***********************
!setup for creating running characters left
400 FOR CHRL=70 TO 75
410 READ PAT$
420 CALL CHAR(CHRL,PAT$)
430 NEXT CHRL
!setup for creating stop and jump characters left
440 FOR CHSL=76 TO 80
450 READ PAT$
460 CALL CHAR(CHSL,PAT$)
470 NEXT CHSL
!setup for creating jumping characters left
480 FOR CHJL=81 TO 84
490 READ PAT$
500 CALL CHAR(CHJL,PAT$)
510 NEXT CHJL
!setup for creating landing characters left
520 FOR CHLL=85 TO 86
530 READ PAT$
540 CALL CHAR(CHLL,PAT$)
550 NEXT CHLL
!BAD girder for level HOLE creation
560 BGIR$="3C4426D999A5C3FF"
!GIRDER FOR LEVELS
570 GIR$="FFC3A59999A5C3FF"
!girder for level creation
580 CALL CHAR(104,BGIR$,105,GIR$)
!THE HOLE
590 GRAV$="FFFFFFFFFFFFFFFF" :: CALL CHAR(106,GRAV$)
!THE EXIT
600 EXT$="1F1111111D11111F" :: CALL CHAR(107,EXT$)
!THE HEART
610 HRT$="66FFFFFF7E7E3C18" :: CALL CHAR(88,HRT$)
!THE ZED
620 ZED$="3C2418FF9918183C" :: CALL CHAR(96,ZED$)
!MELEE
630 MLE$="C0E0703A1E0C1A01" :: CALL CHAR(112,MLE$)
!RANGED WEAPONS
640 RNG$="000000FF7F1E1606" :: CALL CHAR(113,RNG$)
!Word Score
650 SCTXT1$="70808063141414E3" :: SCTXT2$="00000000334A4A32" :: SCTXT3$="00000000993C2118"
660 CALL CHAR(120,SCTXT1$):: CALL CHAR(121,SCTXT2$):: CALL CHAR(122,SCTXT3$)
! the letter X remain for GUI
670 EXTXT$="0044442810284444" :: CALL CHAR(123,EXTXT$)
! EX TEXT IN GUI
680 LVLTXT$="E0E080E9EF86EFE9" :: CALL CHAR(124,LVLTXT$)
!***IDLE MAN
690 IDLE$="3838107CBA38286C" :: CALL CHAR(44,IDLE$)
! MELEE & l/r RANGED ATTACKS
700 MMELE$="3C3C18FF7E3C183C" :: MRNGL$="0C0C04FC4C3C286C" :: MRNGR$="3030203F323C1436"
!WEAPONS FIRE
710 MWA$="002418FF1824" :: BULET$="0000008"
!ZED IDLE&WALK LEFT
720 ZDI$="3C2418FF9918183C" :: ZDA$="3CA5DB7E1818183C" :: ZWL1$="3C2C18F81838246C" :: ZWL2$="3C2C18F818181838"
!ZED WALK RIGHT
730 ZWR1$="3C34181F181C2436" :: ZWR2$="3C34181F1818181C"
!MAN ATTTACKS
740 CALL CHAR(45,MMELE$,46,MRNGL$,47,MRNGR$)
!WEAPONS FIRE
750 CALL CHAR(143,MWA$,142,BULET$)
760 RANDOMIZE
!STARTING SPRITE NUMBER FOR LOOT and more
770 SLOT=10
780 OPTION BASE 1
!LOOT DISTRIBUTION AND COLLISION.
790 DIM LO0T(3,14)
!LOOT ARRAY COORDS COL
800 LTN=1
!LOOT ARRAY COORDS ROW
810 LAB=1
!START ground level on top girder (YP+8pixels), LEVEL AND SPRITE HOLE #
820 SHL=2 :: GRND=17
!start pos,vel,controller run speed
830 LVL=3 :: YP=9 :: XP=8 :: RS=0 :: CS=16 :: RSPD=2.0 :: RSPDD=3.3
!default health of zombies start of game
840 ZHELTH=2
!*******************************Create Level
850 GOSUB 1960
!***************************************Create Sprite Idle********
!**********wall collision checks
860 CALL SPRITE(#1,44,6,YP,XP):: GOSUB 5160
!check for joystick input
870 CALL JOYST(1,JX,JY)::
880 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 7300
885 IF K=6 THEN 890 ELSE 900
890 CALL DELSPRITE(ALL):: RESTORE 160 :: GOTO 100
! check for combat
900 IF JY=0 THEN 920 ELSE 910
! goto combat
910 GOSUB 7210
920 IF JX=0 THEN 960
!**********wall collision checks
930 GOSUB 5160
940 CALL COINC(ALL,C):: IF C=0 THEN 960
!****************************collision checks
950 GOSUB 2170
!no kb pressed check for joyst
960 CALL KEY(1,K,S):: IF K<>18 AND K<>74 AND K<>106 THEN 1500
! ********jump routine check********
970 CALL MOTION(#1,0,0)
980 IF CS<>-16 THEN 1020
!get new position for next sprite
990 CALL POSITION(#1,YP,XP)
! goto jump left
1000 GOSUB 1060
1010 GOTO 860
1020 IF CS<>16 THEN 1500
1030 CALL POSITION(#1,YP,XP)
!get new position for next sprite
!goto jump right**************************
1040 GOSUB 1280
1050 GOTO 860
!*************jump left routine*********
!joystick button pressed so STOP running
1060 CS=0 :: CALL MOTION(#1,0,CS)
!recreate sprite1 as stop and jump characters
1070 CALL SPRITE(#1,CHSL,6,YP,XP)
!setup stop and jump animation lef
1080 FOR PT=76 TO 80
1090 CALL SOUND(1,191-PT,5)
!ANIMATE
1100 CALL PATTERN(#1,PT)
!continue animating the stop and jump until done
1110 NEXT PT
!get new postion for animating the jumping
1120 CALL POSITION(#1,YP,XP)
1130 IF XP<=24 THEN 1210
!jumping left
1140 CS=-20 :: YP=YP-3 :: RS=0 :: CALL SPRITE(#1,CHJL,6,YP,XP,RS,CS)
1150 FOR PT=81 TO 84
1160 CALL PATTERN(#1,PT):: CALL SOUND(1,110+PT,5)
1170 NEXT PT
!stop motion at end of jumping animation to begin landing animation.
1180 CS=0 :: CALL MOTION(#1,0,CS)
!get new position for starting landing animation.
1190 CALL POSITION(#1,YP,XP)
!RESET YP TO BE GROUND.
1200 YP=YP+3
1210 CALL SPRITE(#1,CHLL,6,YP,XP)
!setup landing animation left
1220 FOR PT=85 TO 86
1230 CALL PATTERN(#1,PT):: CALL SOUND(1,200-PT,5)
! continue landing animation until last frame
1240 NEXT PT
!get new position for next sprite
1250 CALL POSITION(#1,YP,XP)
1260 CS=-16
1270 RETURN
!*************jump right routine******
!joystick button pressed so STOP running right
1280 CS=0 :: CALL MOTION(#1,0,CS)
!recreate sprite1 as stop and jump characters right
1290 CALL SPRITE(#1,CHSR,6,YP,XP)
!setup stop and jump animation right
1300 FOR PT=39 TO 43
1310 CALL SOUND(1,191-(PT+37),5)
1320 CALL PATTERN(#1,PT)
!continue animating the stop and jump until done right
1330 NEXT PT
!get new postion for animating the jumping right
1340 CALL POSITION(#1,YP,XP)
1350 IF XP>=224 THEN 1430
!jumping right
1360 CS=20 :: YP=YP-3 :: CALL SPRITE(#1,CHJR,6,YP,XP,RS,CS)
!setup jumping characters right
1370 FOR PT=64 TO 67
1380 CALL PATTERN(#1,PT):: CALL SOUND(1,110+(PT+13),5)
1390 NEXT PT
!stop motion at end of jumping animation to begin landing animation.
1400 CS=0 :: CALL MOTION(#1,0,CS)
!get new position for starting landing animation.
1410 CALL POSITION(#1,YP,XP)
1420 YP=YP+3
1430 CALL SPRITE(#1,CHLR,6,YP,XP)
!setup landing animation
1440 FOR PT=68 TO 69
1450 CALL PATTERN(#1,PT):: CALL SOUND(1,191-(PT+11),5)
! continue landing animation until last frame
1460 NEXT PT
!get new position for next sprite
1470 CALL POSITION(#1,YP,XP)
1480 CS=16
1490 RETURN
! **************Check Joyst Options************
1500 IF JX<>0 THEN 1530
1510 CALL MOTION(#1,0,0)
1520 GOTO 860
! ********running check***************
1530 IF JX<>-4 THEN 1550
1540 GOSUB 1770
1550 IF JX<>4 THEN 860
1560 GOSUB 1580
!after RETURN goto joyst check
1570 GOTO 860
! ************run right routine********
!create the runner and send running
1580 CALL POSITION(#1,YP,XP):: CS=16 :: CALL SPRITE(#1,CHRR,6,YP,XP,0,JX*RSPD)
!setup for animating the run right
1590 FOR PT=33 TO 38 STEP 2
1600 CALL PATTERN(#1,PT):: CALL SOUND(1,-2,5)
!jump
1610 CALL KEY(1,K,S):: IF K=18 OR K=74 OR K=106 THEN 970
!check for joystick input
1620 CALL JOYST(1,JX,JY)
!**********wall collision checks
1630 GOSUB 5160
!collision actions
1640 CALL COINC(ALL,C):: IF C=0 THEN 1650
1645 CALL MOTION(#1,0,(JX*RSPD)/RSPDD):: GOSUB 2170
1650 IF JY=0 THEN 1670 ELSE 1660
1660 GOSUB 7210
!not joy pressed keep running
1670 IF JX<>0 THEN 1690 ELSE 1680
1680 CALL POSITION(#1,YP,XP):: CALL MOTION(#1,0,0):: CALL SPRITE(#1,44,6,YP,XP):: RETURN
1690 CALL JOYST(1,JX,JY)
1700 IF JX=4 THEN 1720
1710 IF JX=-4 THEN 1760
1720 CALL MOTION(#1,0,JX*RSPD)
1730 NEXT PT
1740 IF JX=4 THEN 1590
!check position and store before stopping motion
1750 CALL POSITION(#1,YP,XP)
1760 RETURN
!**********run left routine**************
!create the runner and send running
1770 CALL POSITION(#1,YP,XP):: CS=-16 :: CALL SPRITE(#1,CHRL,6,YP,XP,0,JX*RSPD)
!setup for animating the run left
1780 FOR PT=70 TO 75 STEP 2
1790 CALL PATTERN(#1,PT):: CALL SOUND(1,-2,5)
!jump
1800 CALL KEY(1,K,S):: IF K=18 OR K=74 OR K=106 THEN 970
!check for joystick input
1810 CALL JOYST(1,JX,JY)
!**********wall collision checks
1820 GOSUB 5160
!collision actions
1830 CALL COINC(ALL,C):: IF C=0 THEN 1840
1835 CALL MOTION(#1,0,(JX*RSPD)/RSPDD)
1837 GOSUB 2170
1840 IF JY=0 THEN 1860 ELSE 1850
1850 GOSUB 7210
!not joy pressed keep running
1860 IF JX<>0 THEN 1880
1870 CALL POSITION(#1,YP,XP):: CALL MOTION(#1,0,0):: CALL SPRITE(#1,44,6,YP,XP):: RETURN
1880 CALL JOYST(1,JX,JY)
1890 IF JX=-4 THEN 1910
1900 IF JX=4 THEN 1950
1910 CALL MOTION(#1,0,JX*RSPD)
1920 NEXT PT
1930 IF JX=-4 THEN 1780
!check position and store for next sprite
1940 CALL POSITION(#1,YP,XP)
1950 RETURN
!*************************************************************************level creation************************
!*************************gui creation******
1960 GOSUB 5230
1970 HLE=INT((RND*15)+5)
1980 FOR LVL=1 TO 8
1990 IF LVL=1 THEN 2010
!*************************************GOSUB********LOOT DS**********
2000 GOSUB 4810
!LEFT WALL
2010 CALL VCHAR(1,1,105,24)
!RIGHT WALL
2020 CALL VCHAR(1,32,105,24)
!LEFT SIDE GIRDERS
2030 CALL HCHAR(LVL*3,1,105,HLE-1)
!HOLE PROPER
2040 IF LVL=8 THEN 2060
2045 CALL SPRITE(#SHL,106,HCLR,GRND-8,(HLE* 8)+1)
!ADVANCE SPRITE #
2050 SHL=SHL+1
!RIGHT SIDE Girders
2060 LASTHLE=(HLE* 8)+1 :: CALL HCHAR(LVL*3,HLE+3,105,32-(HLE+3))
!CRUMBLE LEFT SIDE
2070 IF LVL=8 THEN 2130
2075 CALL HCHAR(LVL*3,HLE,104)
!crumble right side
2080 CALL HCHAR(LVL*3,HLE+2,104)
2090 GRND=GRND+24
!NEW LOCATION FOR HOLE
2100 HOL=INT((RND*15)+5)
!NOT EQUAL TO PREVIOUS HOLE
2110 IF HOL=HLE THEN 2100
!SET PROPER HOLE VARIABLE
2120 HLE=HOL
!GO CREATE NEXT LEVEL
2130 NEXT LVL
! THE EXIT
2140 CALL SPRITE(#9,107,15,22*8,30* 8)
!THE FLOOR
2150 CALL HCHAR(24,1,105,31)
2160 RETURN
! *********************************collision detection routines*******
!**********wall collision checks
2170 GOSUB 5160
2180 CALL POSITION(#1,YP,XP)
! top level 1
2190 IF YP<>9 THEN 2220
2200 CALL COINC(#1,#2,8,C)
!check for hole level 1
2210 IF C=0 THEN RETURN ELSE 4780
!level 2
2220 IF YP<>33 THEN 2570
2230 CALL POSITION(#3,HY,HX):: LOOT=LO0T(1,1)
2240 CALL POSITION(#1,YP,XP)
2250 IF XP<=HX THEN 2260 ELSE 2400
2260 CALL COINC(#1,#10,8,C)
2270 IF C<>0 THEN 2310
2280 CALL COINC(#1,#3,8,C)
!check for hole level 2
2290 IF C<>0 THEN 4780
2300 RETURN
2310 DET=10
2320 IF LOOT<>88 THEN 2340
!do heart
2330 GOTO 4740
2340 IF LOOT<>96 THEN 2360
!do zed
2350 GOTO 4710
2360 IF LOOT<>112 THEN 2380
!do melee
2370 GOTO 4680
2380 IF LOOT<>113 THEN RETURN
! do ranged
2390 GOTO 4650
2400 LOOT=LO0T(1,2)
2410 CALL POSITION(#1,YP,XP)
2420 IF XP>HX THEN 2430 ELSE RETURN
2430 CALL COINC(#1,#11,8,C)
2440 IF C<>0 THEN 2480
2450 CALL COINC(#1,#3,8,C)
!check for hole level 2
2460 IF C<>0 THEN 4780
2470 RETURN
2480 DET=11
2490 IF LOOT<>88 THEN 2510
!do heart
2500 GOTO 4740
2510 IF LOOT<>96 THEN 2530
!do zed
2520 GOTO 4710
2530 IF LOOT<>112 THEN 2550
!do melee
2540 GOTO 4680
2550 IF LOOT<>113 THEN RETURN
! do ranged
2560 GOTO 4650
!level 3
2570 IF YP<>57 THEN 2920
2580 CALL POSITION(#4,HY,HX):: LOOT=LO0T(1,3)
2590 CALL POSITION(#1,YP,XP)
2600 IF XP<=HX THEN 2610 ELSE 2750
2610 CALL COINC(#1,#12,8,C)
2620 IF C<>0 THEN 2660
2630 CALL COINC(#1,#4,8,C)
!check for hole level 3
2640 IF C<>0 THEN 4780
2650 RETURN
2660 DET=12
2670 IF LOOT<>88 THEN 2690
!do heart
2680 GOTO 4740
2690 IF LOOT<>96 THEN 2710
!do zed
2700 GOTO 4710
2710 IF LOOT<>112 THEN 2730
!do melee
2720 GOTO 4680
2730 IF LOOT<>113 THEN RETURN
! do ranged
2740 GOTO 4650
2750 LOOT=LO0T(1,4)
2760 CALL POSITION(#1,YP,XP)
2770 IF XP>HX THEN 2780 ELSE RETURN
2780 CALL COINC(#1,#13,8,C)
2790 IF C<>0 THEN 2830
2800 CALL COINC(#1,#4,8,C)
!check for hole level 3
2810 IF C<>0 THEN 4780
2820 RETURN
2830 DET=13
2840 IF LOOT<>88 THEN 2860
!do heart
2850 GOTO 4740
2860 IF LOOT<>96 THEN 2880
!do zed
2870 GOTO 4710
2880 IF LOOT<>112 THEN 2900
!do melee
2890 GOTO 4680
2900 IF LOOT<>113 THEN RETURN
! do ranged
2910 GOTO 4650
!level 4
2920 IF YP<>81 THEN 3270
2930 CALL POSITION(#5,HY,HX):: :: LOOT=LO0T(1,5)
2940 CALL POSITION(#1,YP,XP)
2950 IF XP<=HX THEN 2960 ELSE 3100
2960 CALL COINC(#1,#14,8,C)
2970 IF C<>0 THEN 3010
2980 CALL COINC(#1,#5,8,C)
!check for hole level 4
2990 IF C<>0 THEN 4780
3000 RETURN
3010 DET=14
3020 IF LOOT<>88 THEN 3040
!do heart
3030 GOTO 4740
3040 IF LOOT<>96 THEN 3060
!do zed
3050 GOTO 4710
3060 IF LOOT<>112 THEN 3080
!do melee
3070 GOTO 4680
3080 IF LOOT<>113 THEN RETURN
! do ranged
3090 GOTO 4650
3100 LOOT=LO0T(1,6)
3110 CALL POSITION(#1,YP,XP)
3120 IF XP>HX THEN 3130 ELSE RETURN
3130 CALL COINC(#1,#15,8,C)
3140 IF C<>0 THEN 3180
3150 CALL COINC(#1,#5,8,C)
!check for hole level 4
3160 IF C<>0 THEN 4780
3170 RETURN
3180 DET=15
3190 IF LOOT<>88 THEN 3210
!do heart
3200 GOTO 4740
3210 IF LOOT<>96 THEN 3230
!do zed
3220 GOTO 4710
3230 IF LOOT<>112 THEN 3250
!do melee
3240 GOTO 4680
3250 IF LOOT<>113 THEN RETURN
! do ranged
3260 GOTO 4650
!level 5
3270 IF YP<>105 THEN 3620
3280 CALL POSITION(#6,HY,HX):: LOOT=LO0T(1,7)
3290 CALL POSITION(#1,YP,XP)::
3300 IF XP<=HX THEN 3310 ELSE 3450
3310 CALL COINC(#1,#16,8,C)
3320 IF C<>0 THEN 3360
3330 CALL COINC(#1,#6,8,C)
!check for hole level 5
3340 IF C<>0 THEN 4780
3350 RETURN
3360 DET=16
3370 IF LOOT<>88 THEN 3210
!do heart
3380 GOTO 4740
3390 IF LOOT<>96 THEN 3410
!do zed
3400 GOTO 4710
3410 IF LOOT<>112 THEN 3430
!do melee
3420 GOTO 4680
3430 IF LOOT<>113 THEN RETURN
! do ranged
3440 GOTO 4650
3450 LOOT=LO0T(1, 8)
3460 CALL POSITION(#1,YP,XP)
3470 IF XP>HX THEN 3480 ELSE RETURN
3480 CALL COINC(#1,#17,8,C)
3490 IF C<>0 THEN 3530
3500 CALL COINC(#1,#6,8,C)
!check for hole level 5
3510 IF C<>0 THEN 4780
3520 RETURN
3530 DET=17
3540 IF LOOT<>88 THEN 3560
!do heart
3550 GOTO 4740
3560 IF LOOT<>96 THEN 3580
3570 GOTO 4710
!do zed
3580 IF LOOT<>112 THEN 3600
!do melee
3590 GOTO 4680
3600 IF LOOT<>113 THEN RETURN
! do ranged
3610 GOTO 4650
!level 6
3620 IF YP<>129 THEN 3970
3630 CALL POSITION(#7,HY,HX):: LOOT=LO0T(1,9)
3640 CALL POSITION(#1,YP,XP)
3650 IF XP<=HX THEN 3660 ELSE 3800
3660 CALL COINC(#1,#18,8,C)
3670 IF C<>0 THEN 3710
3680 CALL COINC(#1,#7,8,C)
!check for hole level 6
3690 IF C<>0 THEN 4780
3700 RETURN
3710 DET=18
3720 IF LOOT<>88 THEN 3740
!do heart
3730 GOTO 4740
3740 IF LOOT<>96 THEN 3760
!do zed
3750 GOTO 4710
3760 IF LOOT<>112 THEN 3780
!do melee
3770 GOTO 4680
3780 IF LOOT<>113 THEN RETURN
! do ranged
3790 GOTO 4650
3800 LOOT=LO0T(1,10)
3810 CALL POSITION(#1,YP,XP)
3820 IF XP>HX THEN 3830 ELSE RETURN
3830 CALL COINC(#1,#19,8,C)
3840 IF C<>0 THEN 3880
3850 CALL COINC(#1,#7,8,C)
!check for hole level 6
3860 IF C<>0 THEN 4780
3870 RETURN
3880 DET=19
3890 IF LOOT<>88 THEN 3910
!do heart
3900 GOTO 4740
3910 IF LOOT<>96 THEN 3930
!do zed
3920 GOTO 4710
3930 IF LOOT<>112 THEN 3950
!do melee
3940 GOTO 4680
3950 IF LOOT<>113 THEN RETURN
! do ranged
3960 GOTO 4650
!level 7
3970 IF YP<>153 THEN 4320
3980 CALL POSITION(#8,HY,HX):: LOOT=LO0T(1,11)
3990 CALL POSITION(#1,YP,XP)
4000 IF XP<=HX THEN 4010 ELSE 4150
4010 CALL COINC(#1,#20,8,C)
4020 IF C<>0 THEN 4060
4030 CALL COINC(#1,#8,8,C)
!check for hole level 7
4040 IF C<>0 THEN 4780
4050 RETURN
4060 DET=20
4070 IF LOOT<>88 THEN 4090
!do heart
4080 GOTO 4740
4090 IF LOOT<>96 THEN 4110
!do zed
4100 GOTO 4710
4110 IF LOOT<>112 THEN 4130
!do melee
4120 GOTO 4680
4130 IF LOOT<>113 THEN RETURN
! do ranged
4140 GOTO 4650
4150 LOOT=LO0T(1,12)
4160 CALL POSITION(#1,YP,XP)
4170 IF XP>HX THEN 4180 ELSE RETURN
4180 CALL COINC(#1,#21,8,C)
4190 IF C<>0 THEN 4230
4200 CALL COINC(#1,#8,8,C)
!check for hole level 7
4210 IF C<>0 THEN 4780
4220 RETURN
4230 DET=21
4240 IF LOOT<>88 THEN 4260
!do heart
4250 GOTO 4740
4260 IF LOOT<>96 THEN 4280
!do zed
4270 GOTO 4710
4280 IF LOOT<>112 THEN 4300
!do melee
4290 GOTO 4680
4300 IF LOOT<>113 THEN RETURN
! do ranged
4310 GOTO 4650
!level 8 ground floor
4320 IF YP<>177 THEN RETURN
4330 HX=LASTHLE :: LOOT=LO0T(1,13)
4340 CALL POSITION(#1,YP,XP)
4350 IF XP<=HX THEN 4360 ELSE 4490
4360 CALL COINC(#1,#22,8,C)
4370 IF C<>0 THEN 4400
4380 CALL COINC(#1,#9,4,C)
!****collision check against exit
4390 IF C<>0 THEN 4800 ELSE RETURN
4400 DET=22
4410 IF LOOT<>88 THEN 4430
!do heart
4420 GOTO 4740
4430 IF LOOT<>96 THEN 4450
!do zed
4440 GOTO 4710
4450 IF LOOT<>112 THEN 4470
!do melee
4460 GOTO 4680
4470 IF LOOT<>113 THEN RETURN
! do ranged
4480 GOTO 4650
4490 LOOT=LO0T(1,14)
4500 CALL POSITION(#1,YP,XP)
4510 IF XP>HX THEN 4520 ELSE RETURN
4520 CALL COINC(#1,#23,8,C)
4530 IF C<>0 THEN 4560
4540 CALL COINC(#1,#9,4,C)
!****collision check against exit
4550 IF C<>0 THEN 4800 ELSE RETURN
4560 DET=23
4570 IF LOOT<>88 THEN 4590
!do heart
4580 GOTO 4740
4590 IF LOOT<>96 THEN 4610
!do zed
4600 GOTO 4710
4610 IF LOOT<>112 THEN 4630
!do melee
4620 GOTO 4680
4630 IF LOOT<>113 THEN RETURN
! do ranged
4640 GOTO 4650
!**********ranged
4650 SCORE=SCORE+5 :: IF RANGED<10 THEN RANGED=RANGED+1
4655 CALL SOUND(1,1000,5):: CALL SOUND(1,1200,2)
!*************************gui UPDATE*****
4660 GOSUB 5230
4670 GOTO 4760
!*********melee
4680 SCORE=SCORE+3 :: IF MELEE<10 THEN MELEE=MELEE+1
4685 CALL SOUND(1,1500,5):: CALL SOUND(1,1600,2)
!*************************gui UPDATE******
4690 GOSUB 5230
4700 GOTO 4760
! *************zed
4710 CALL SOUND(100,-4,0,110,0,1000,0):: HEALTH=HEALTH-1 :: IF HEALTH<=0 THEN 5280
!*************************gui UPDATE******
4720 GOSUB 5230
4730 RETURN
! *************HEART
4740 SCORE=SCORE+8 :: CALL SOUND(1,500,5):: CALL SOUND(1,600,2):: IF HEALTH<10 THEN HEALTH=HEALTH+1
!*************************gui UPDATE******
4750 GOSUB 5230
4760 IF DET=O THEN 4770
4765 CALL DELSPRITE(#DET):: RETURN
4770 RETURN
!*************FALL********
4780 FOR FALL=1 TO 24 :: YP=YP+1 :: CALL SOUND(1,666-(FALL*10),5):: CALL SPRITE(#1,44,6,YP,XP):: NEXT FALL
4790 RETURN
! *****************************************************BOARD**Progression************
4800 CALL DELSPRITE(ALL):: BOARD=BOARD+1 :: RESTORE 160 :: IF SCORE>HSCORE THEN HSCORE=SCORE
4805 GOTO 120
!**********************LOOT DISTRIBUTION SYSTEM******
4810 LOOTL=INT(RND*4)+1
4820 LOOTR=INT(RND*4)+1
4830 IF LOOTL<>1 THEN 4870
!HEART 88
4840 CALL SPRITE(#SLOT,88,7,GRND-9,((HLE+1)* 8)-40):: SLOT=SLOT+1
4850 LO0T(LAB,LTN)=88 :: LAB=LAB+1
4860 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1
4870 IF LOOTL<>2 THEN 4910
!ZED 96
4880 CALL SPRITE(#SLOT,96,4,GRND-9,((HLE+1)* 8)-40):: SLOT=SLOT+1
4890 LO0T(LAB,LTN)=96 :: LAB=LAB+1
4900 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1
4910 IF LOOTL<>3 THEN 4950
!MELEE 112
4920 CALL SPRITE(#SLOT,112,8,GRND-9,((HLE+1)* 8)-40):: SLOT=SLOT+1
4930 LO0T(LAB,LTN)=112 :: LAB=LAB+1
4940 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1
4950 IF LOOTL<>4 THEN 4990
!RANGED 113
4960 CALL SPRITE(#SLOT,113,14,GRND-9,((HLE+1)* 8)-40):: SLOT=SLOT+1
4970 LO0T(LAB,LTN)=113 :: LAB=LAB+1
4980 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1
4990 IF LOOTR<>1 THEN 5030
!HEART 88
5000 CALL SPRITE(#SLOT,88,7,GRND-9,((HLE+1)* 8)+40):: SLOT=SLOT+1
5010 LO0T(LAB,LTN)=88 :: LAB=LAB+1
5020 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1
5030 IF LOOTR<>2 THEN 5070
!ZED 96
5040 CALL SPRITE(#SLOT,96,4,GRND-9,((HLE+1)* 8)+40):: SLOT=SLOT+1
5050 LO0T(LAB,LTN)=96 :: LAB=LAB+1
5060 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1
5070 IF LOOTR<>3 THEN 5110
!MELEE 112
5080 CALL SPRITE(#SLOT,112,8,GRND-9,((HLE+1)* 8)+40):: SLOT=SLOT+1
5090 LO0T(LAB,LTN)=112 :: LAB=LAB+1
5100 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1
5110 IF LOOTR<>4 THEN 5150
!RANGED 113
5120 CALL SPRITE(#SLOT,113,14,GRND-9,((HLE+1)* 8)+40):: SLOT=SLOT+1
5130 LO0T(LAB,LTN)=113 :: LAB=LAB+1
5140 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1
5150 RETURN
! **********cOLLISION cHECK WALLs
5160 CALL POSITION(#1,YP,XP)
5170 IF XP<=12 THEN 5180 ELSE 5200
5180 CALL LOCATE(#1,YP,13):: CALL MOTION(#1,0,0)
5190 CALL JOYST(1,JX,JY):: IF JX=-4 THEN 5180 ELSE RETURN
5200 IF XP>=240 THEN 5210 ELSE RETURN
5210 CALL LOCATE(#1,YP,239):: CALL MOTION(#1,0,0)
5220 CALL JOYST(1,JX,JY):: IF JX=4 THEN 5210 ELSE RETURN
!********************GUI Update***********
!Output GUI
5230 DISPLAY AT(1,3):SCORE :: DISPLAY AT(1,10):BOARD :: DISPLAY AT(1,15):HEALTH :: DISPLAY AT(1,21):MELEE :: DISPLAY AT(1,26):RANGED
!score text gui
5240 CALL VCHAR(1,3,120):: CALL VCHAR(1,4,121):: CALL VCHAR(1,5,122)
!Xs gui
5250 CALL VCHAR(1,12,123):: CALL VCHAR(1,17,123):: CALL VCHAR(1,23,123):: CALL VCHAR(1,28,123)
!BOARD,hearts,melee,ranged gui
5260 CALL VCHAR(1,11,124):: CALL VCHAR(1,16,88):: CALL VCHAR(1,22,112):: CALL VCHAR(1,27,113)
5270 RETURN
! ******************************YOU ARE DEAD***********************
5280 CALL MOTION(#1,0,0):: CALL DELSPRITE(ALL):: CALL SCREEN(10)
5290 DATA 89,0044442810101010,79,007C44444444447C,85,0044444444444438
5300 DATA 65,003844447C444444,82,0078444478504844,69,007C40407840407C
5310 DATA 68,0078242424242478
5320 FOR YAD=1 TO 7
5330 READ YADC,YADP$
5340 CALL CHAR(YADC,YADP$)
5350 NEXT YAD
5360 CALL CLEAR
!YOU
5370 CALL VCHAR(12,10,89):: CALL VCHAR(12,11,79):: CALL VCHAR(12,12,85):: CALL VCHAR(12,13,32)
!ARE
5380 CALL VCHAR(12,14,65):: CALL VCHAR(12,15,82):: CALL VCHAR(12,16,69):: CALL VCHAR(12,17,32)
!DEAD
5390 CALL VCHAR(12,18,68):: CALL VCHAR(12,19,69):: CALL VCHAR(12,20,65):: CALL VCHAR(12,21,68)
5400 FOR CLRS=1 TO 13 :: CALL COLOR(CLRS,16,1):: NEXT CLRS
5410 CALL SCREEN(2)
5420 GOSUB 5230
5430 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 7300
5435 IF K=6 THEN 5440 ELSE 5450
5440 CALL DELSPRITE(ALL):: RESTORE 160 :: GOTO 100
5450 CALL JOYST(1,JX,JY):: IF JX=0 THEN 5430
5455 IF JY=0 THEN 5430 ELSE 5440
!*******************MAN MELEE ATTACK
!melee attack pattern
5460 CALL PATTERN(#1,45)
!right attack
5470 CALL SPRITE(#24,143,12,YP,XP+ 8):: CALL SOUND(125,-5,0)
!MELLE HIT DETECTION RIGHT
5480 GOSUB 7320
5490 CALL DELSPRITE(#24)
!left attack
5500 CALL SPRITE(#25,143,12,YP,XP- 8):: CALL SOUND(125,-6,0)
!MELEE HIT DETECTION LEFT
5510 GOSUB 7370
5520 CALL DELSPRITE(#25)
5530 CALL PATTERN(#1,44):: CALL COLOR(#DET,4):: RETURN
!MAN MELEE ATTACK
5540 CALL PATTERN(#1,45)
5550 CALL SPRITE(#24,143,12,YP,XP+ 8):: CALL SOUND(125,-5,0)
!right attack
5560 GOSUB 7320
!MELLE HIT DETECTION RIGHT
5570 CALL DELSPRITE(#24)
5580 CALL SPRITE(#25,143,12,YP,XP- 8):: CALL SOUND(125,-6,0)
!left attack
5590 GOSUB 7390
!MELEE HIT DETECTION LEFT
5600 CALL DELSPRITE(#25)
5610 CALL PATTERN(#1,44):: CALL COLOR(#DET,4):: RETURN
5620 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP)
!******************************************************************MAN RANGED ATTACK
5630 IF RANGED<=0 THEN CALL SOUND(100,-6,0) else 5635
5632 return
5635 ranged=ranged-1:: GOSUB 5230
!*********************************Shoot Right
5637 IF CS<>16 THEN 6150
5640 CALL SPRITE(#1,47,6,YP,XP)
5650 IF YP<>33 THEN 5730
5660 IF LO0T(1,1)<>96 THEN 5680
5670 ZED1=1 :: CALL POSITION(#10,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,1)::IF XP>=XZ1 THEN ZED1=0
5675 GOTO 5690
5680 ZED1=0
5690 IF LO0T(1,2)<>96 THEN 5720
5710 ZED2=1 :: CALL POSITION(#11,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,2)::IF XP>=XZ2 THEN ZED2=0
5715 GOTO 6670
5720 ZED2=0 :: GOTO 6670
5730 IF YP<>57 THEN 5800
5740 IF LO0T(1,3)<>96 THEN 5760
5750 ZED1=1 :: CALL POSITION(#12,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,3)::IF XP>=XZ1 THEN ZED1=0
5755 GOTO 5770
5760 ZED1=0
5770 IF LO0T(1,4)<>96 THEN 5790
5780 ZED2=1 :: CALL POSITION(#13,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,4)::IF XP>=XZ2 THEN ZED2=0
5785 GOTO 6670
5790 ZED2=0 :: GOTO 6670
5800 IF YP<>81 THEN 5870
5810 IF LO0T(1,5)<>96 THEN 5830
5820 ZED1=1 :: CALL POSITION(#14,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,5)::IF XP>=XZ1 THEN ZED1=0
5825 GOTO 5840
5830 ZED1=0
5840 IF LO0T(1,6)<>96 THEN 5860
5850 ZED2=1 :: CALL POSITION(#15,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,6)::IF XP>=XZ2 THEN ZED2=0
5855 GOTO 6670
5860 ZED2=0 :: GOTO 6670
5870 IF YP<>105 THEN 5940
5880 IF LO0T(1,7)<>96 THEN 5900
5890 ZED1=1 :: CALL POSITION(#16,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,7)::IF XP>=XZ1 THEN ZED1=0
5895 GOTO 5910
5900 ZED1=0
5910 IF LO0T(1, 8)<>96 THEN 5930
5920 ZED2=1 :: CALL POSITION(#17,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2, 8)::IF XP>=XZ2 THEN ZED2=0
5925 GOTO 6670
5930 ZED2=0 :: GOTO 6670
5940 IF YP<>129 THEN 6010
5950 IF LO0T(1,9)<>96 THEN 5970
5960 ZED1=1 :: CALL POSITION(#18,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,9)::IF XP>=XZ1 THEN ZED1=0
5965 GOTO 5980
5970 ZED1=0
5980 IF LO0T(1,10)<>96 THEN 6000
5990 ZED2=1 :: CALL POSITION(#19,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,10)::IF XP>=XZ2 THEN ZED2=0
5995 GOTO 6670
6000 ZED2=0 :: GOTO 6670
6010 IF YP<>153 THEN 6080
6020 IF LO0T(1,11)<>96 THEN 6040
6030 ZED1=1 :: CALL POSITION(#20,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,11)::IF XP>=XZ1 THEN ZED1=0
6030 GOTO 6050
6040 ZED1=0
6050 IF LO0T(1,12)<>96 THEN 6070
6060 ZED2=1 :: CALL POSITION(#21,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,12)::IF XP>=XZ2 THEN ZED2=0
6065 GOTO 6670
6070 ZED2=0 :: GOTO 6670
6080 IF YP<>177 THEN return
6090 IF LO0T(1,13)<>96 THEN 6110
6100 ZED1=1 :: CALL POSITION(#22,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,13)::IF XP>=XZ1 THEN ZED1=0
6105 GOTO 6120
6110 ZED1=0
6120 IF LO0T(1,14)<>96 THEN 6140
6130 ZED2=1 :: CALL POSITION(#23,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,14):: IF XP>=XZ2 THEN ZED2=0
6135GOTO 6670
6140 ZED2=0 :: GOTO 6670
!*******************************************Shoot Left
6150 IF CS<>-16 THEN return
6160 CALL SPRITE(#1,46,6,YP,XP)
6170 IF YP<>33 THEN 6250
6180 IF LO0T(1,1)<>96 THEN 6200
6190 ZED1=1 :: CALL POSITION(#10,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,1):: IF XP<=XZ1 THEN ZED1=0
6195 GOTO 6210
6200 ZED1=0
6210 IF LO0T(1,2)<>96 THEN 6240
6230 ZED2=1 :: CALL POSITION(#11,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,2):: IF XP<=XZ2 THEN ZED2=0
6235 GOTO 6940
6240 ZED2=0 :: GOTO 6940
6250 IF YP<>57 THEN 6315
6260 IF LO0T(1,3)<>96 THEN 6280
6270 ZED1=1 :: CALL POSITION(#12,YZ1,XZ1):: CALL POSITION(#1,YP,XP)::DET1=LO0T(2,3):: IF XP<=XZ1 THEN ZED1=0
6275GOTO 6290
6280 ZED1=0
6290 IF LO0T(1,4)<>96 THEN 6310
6300 ZED2=1 :: CALL POSITION(#13,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,4):: IF XP<=XZ2 THEN ZED2=0
6305 GOTO 6940
6310 ZED2=0 :: GOTO 6940
6315 IF YP<>81 THEN 6380
6320 IF LO0T(1,5)<>96 THEN 6340
6330 ZED1=1 :: CALL POSITION(#14,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,5):: IF XP<=XZ1 THEN ZED1=0
6335 GOTO 6350
6340 ZED1=0
6350 IF LO0T(1,6)<>96 THEN 6370
6360 ZED2=1 :: CALL POSITION(#15,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,6):: IF XP<=XZ2 THEN ZED2=0
6365 GOTO 6940
6370 ZED2=0 :: GOTO 6940
6380 IF YP<>105 THEN 6450
6390 IF LO0T(1,7)<>96 THEN 6410
6400 ZED1=1 :: CALL POSITION(#16,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,7):: IF XP<=XZ1 THEN ZED1=0
6405 GOTO 6420
6410 ZED1=0
6420 IF LO0T(1, 8)<>96 THEN 6440
6430 ZED2=1 :: CALL POSITION(#17,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2, 8):: IF XP<=XZ2 THEN ZED2=0
6435 GOTO 6940
6440 ZED2=0 :: GOTO 6940
6450 IF YP<>129 THEN 6520
6460 IF LO0T(1,9)<>96 THEN 6480
6470 ZED1=1 :: CALL POSITION(#18,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,9):: IF XP<=XZ1 THEN ZED1=0
6475 GOTO 6490
6480 ZED1=0
6490 IF LO0T(1,10)<>96 THEN 6510
6500 ZED2=1 :: CALL POSITION(#19,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,10):: IF XP<=XZ2 THEN ZED2=0
6505 GOTO 6940
6510 ZED2=0 :: GOTO 6940
6520 IF YP<>153 THEN 6590
6530 IF LO0T(1,11)<>96 THEN 6550
6540 ZED1=1 :: CALL POSITION(#20,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DDET1=LO0T(2,11):: IF XP<=XZ1 THEN ZED1=0
6545 GOTO 6560
6550 ZED1=0
6560 IF LO0T(1,12)<>96 THEN 6580
6570 ZED2=1 :: CALL POSITION(#21,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,12):: IF XP<=XZ2 THEN ZED2=0
6575 GOTO 6940
6580 ZED2=0 :: GOTO 6940
6590 IF YP<>177 THEN RETURN
6600 IF LO0T(1,13)<>96 THEN 6620
6610 ZED1=1 :: CALL POSITION(#22,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,13):: IF XP<=XZ1 THEN ZED1=0
6615 GOTO 6630
6620 ZED1=0
6630 IF LO0T(1,14)<>96 THEN 6650
6640 ZED2=1 :: CALL POSITION(#23,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,14):: IF XP<=XZ2 THEN ZED2=0
6645 GOTO 6940
6650 ZED2=0 :: GOTO 6940
6660 RETURN
!***************************************Bullet fire right
6670 IF ZED1=0 AND ZED2=0 THEN 6910
6671 IF ZED1=1 AND ZED2=0 THEN 6770
6672 IF ZED1=0 AND ZED2=1 THEN 6810
6673 IF ZED1=1 AND ZED2=1 THEN 6770
!Kill ZED1
6770 CALL SOUND(100,-6,0):: CALL SPRITE(#26,142,6,YP,XP+8,0,16)
6775 call coinc(#26,#DET1,bull,c)
6777 IF C<>1 THEN 6780 ELSE 6775
!*****gui UPDATE******
6780 CALL COLOR(#DET1,7):: ZHELTH=ZHELTH-2 :: IF ZHELTH>=1 THEN 7110
6785 Score=Score+10::CALL DELSPRITE(#26):: CALL DELSPRITE(#det1):: GOSUB 5230
6800 GOTO 7110
!KILL ZED2
6810 CALL SOUND(100,-6,0):: CALL SPRITE(#26,142,6,YP,XP+8,0,16)
6815 call coinc(#26,#DET2,bull,c)
6820 IF C<>0 THEN 6830 ELSE 6815
!gui UPDATE
6830 CALL COLOR(#DET2,7):: ZHELTH=ZHELTH-2 :: IF ZHELTH>=1 THEN 7110
:: Score=Score+10::CALL DELSPRITE(#26):: CALL DELSPRITE(#det2):: GOSUB 5230
6840 GOTO 7110
!NO ZED KILLS
6910 CALL SOUND(100,-6,0):: CALL SPRITE(#26,142,6,YP,XP+8,0,16)
6915 CALL POSITION(#26,YB,XB)
6920 IF XB>=238 THEN 6930 ELSE 6915
6930 CALL DELSPRITE(#26):: GOTO 7110
!****************************************Bullet fire left
6940 IF ZED1=0 AND ZED2=0 THEN 7100
6942 IF ZED1=1 AND ZED2=0 THEN 6975
6945 IF ZED1=0 AND ZED2=1 THEN 7005
6947 IF ZED1=1 AND ZED2=1 THEN 6975
!Kill ZED1
6975 CALL SOUND(100,-6,0):: CALL SPRITE(#26,142,6,YP,XP-8,0,-16)
6980 call coinc(#26,#DET1,bull,c)
6985 IF C<>0 THEN 6990 ELSE 6980
!*****gui UPDATE*****
6990 CALL COLOR(#DET1,7):: ZHELTH=ZHELTH-2 :: IF ZHELTH=1 THEN 7110
6995 Score=Score+10::CALL DELSPRITE(#26):: CALL DELSPRITE(#det1)::GOSUB 5230
7000 GOTO 7110
!KILL ZED2
7005 CALL SOUND(100,-6,0):: CALL SPRITE(#26,142,6,YP,XP-8,0,-16)
7010 call coinc(#26,#DET2,bull,c)
7015 IF C<>0 THEN 7020 ELSE 7010
!gui UPDATE
7020 CALL COLOR(#DET2,7):: ZHELTH=ZHELTH-2 :: IF ZHELTH>=1 THEN 7110
7025 Score=Score+10::CALL DELSPRITE(#26):: CALL DELSPRITE(#det2)::GOSUB 5230
7030 GOTO 7110
!NO ZED KILLS
7100 CALL SOUND(100,-6,0):: CALL SPRITE(#26,142,6,YP,XP-8,0,-16)
7102 CALL POSITION(#26,YB,XB)
7104 IF XB<=17 THEN 7106 ELSE 7102
7106 CALL DELSPRITE(#26):: GOTO 7110
! attack ranged again or end **********************************************NEEDS WORK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7110 CALL JOYST(1,JX,JY):: IF jy=0 THEN RETURN
7115 IF JY-4 THEN 7120 ELSE RETURN
7120 gosub 5630
7130 return
!ZED COINC BEHAVIOR
!ZED ATTACK
!JOYS Combat choice
7140 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP)
!UPDATE GUI
7150 MELEE=MELEE-1 :: GOSUB 5230
!MELEE ATTACK
7160 GOSUB 5540
7170 RETURN
!*****************ZED COINC BEHAVIOR*************
!****************ZED ATTACK******************
!*****JOYS Combat choice*****
7210 IF JY=4 AND MELEE>=1 THEN 7230
7212 if JY=4 and melee<=0 then 7220
7214 if jy=-4 then 7215 ELSE return
7215 gosub 5630
7217 return
7220 CALL SOUND(100,-3,0):: RETURN
7230 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP)
!*******UPDATE GUI
7240 MELEE=MELEE-1 :: GOSUB 5230
!PERFORM MELEE ATTACK
7250 GOSUB 5460
7260 RETURN
7270 IF JY=-4 THEN 7280 ELSE CALL SOUND(100,-6,0)
7275 RETURN
7280 GOSUB 5630
7290 RETURN
!***quit game
7300 CALL CLEAR :: END
!************************mELEE collision check against LOOT*********************
7320 FOR DET=10 TO 23
7330 CALL COINC(#24,#DET,7,C)
7340 IF C<>0 THEN 7420 ELSE 7350
7350 NEXT DET
7360 RETURN
!MELEE LEFT
7370 FOR DET=10 TO 23
7380 CALL COINC(#25,#DET,7,C)
7390 IF C<>0 THEN 7420 ELSE 7400
7400 NEXT DET
7410 RETURN
7420 TLOOP1=DET-9
!heart
7430 IF LO0T(1,TLOOP1)<>88 THEN 7440 ELSE 7520
!zed - ALL ALPHA TEMP CODE
7440 IF LO0T(1,TLOOP1)<>96 THEN 7490
7450 CALL COLOR(#DET,7):: ZHELTH=ZHELTH-1 :: IF ZHELTH>=1 THEN 7530
7460 SCORE=SCORE+10 :: ZHELTH=2
!*****gui UPDATE******
7470 GOSUB 5230
7480 GOTO 7520
!melee
7490 IF LO0T(1,TLOOP1)<>112 THEN 7510
7500 GOTO 7520
!range
7510 IF LO0T(1,TLOOP1)<>113 THEN 7530
7520 CALL DELSPRITE(#DET):: RETURN
7530 RETURN
!do melee
7540 GOTO 4680

 

Edited by Sinphaltimus
Link to comment
Share on other sites

Man, just use TIdBiT.... Game changer... Life changer...

 

 

I can't. I don't know how.

 

What I mean is, I learned how to use TI basic with line numbers. My brain breaks when I try to not do that.

 

I can code without line numbers in GML because I learned GML that way. IN GML i can use switch statements. In XB I cannot they don't exist.

 

I get that I can replace goto and gosub with sub and such But I don't know the acceptable syntax for tidbit that will accurately translate it toTI XB.

 

Trust me, I want to.

 

Here's a small example of GM code I have in another game:

I wouldn't know how to do the same for TI XB.

 

 

os_powersave_enable(false); //disables device's power saving features
// The following 4 lines are for Android tilt control - rem them out for PC testing
// Taking control of static gravity for Troom 13 pinball game with "IF" statement - see also this objects END step event.
if room != rm_Troom13
{
var gx,gy;
gx=device_get_tilt_x()*grav_tilt*(-1);
gy=device_get_tilt_y()*grav_tilt;
physics_world_gravity(gx,gy);
}
//Creates paddle under players finger if game is not paused.
if global.gameMode = 1 then global.GEnergy = global.maxGEnergy;
if mouse_check_button_pressed(mb_left) && !instance_exists(obj_pause_bkgrnd) && global.GEnergy >0
{
if room != rm_Score && room != rm_Troom13 && !instance_exists(obj_falsePaddle){instance_create(mouse_x,mouse_y,obj_falsePaddle);if !instance_exists(obj_touchSparks) instance_create(mouse_x,mouse_y,obj_touchSparks);}
}
else
{
if mouse_check_button_pressed(mb_left) && !instance_exists(obj_touchSparks) && room != rm_Troom13 {instance_create(mouse_x,mouse_y,obj_touchSparks);}
}
if global.GEnergy < 1 then global.GEnergy = 0;
if global.sound_toggle == 1
{
if !instance_exists(obj_paddle) && !instance_exists(obj_falsePaddle)then audio_stop_sound(snd_ElectroBuzz);
if !instance_exists(obj_paddle) && !instance_exists(obj_falsePaddle)then audio_stop_sound(snd_ElectroPop);
}
if(mouse_check_button_released(mb_left))
{
if instance_exists(obj_falsePaddle) with (obj_falsePaddle){instance_destroy();}
if instance_exists(obj_paddle) with (obj_paddle){instance_destroy();}
if !instance_exists(obj_touchSparks) && room != rm_Troom13 && room != rm_levels then instance_create(mouse_x,mouse_y,obj_touchSparks);
}

Edited by Sinphaltimus
Link to comment
Share on other sites

So I check SIZE and found 602 bytes free.
Cleaned up just the first few lines of code and now I'm over 2k free. :)
After "running" the program then quitting and checking size, I end up with 1.5k. So there's still some room to work with and I still have a lot of optimizing to do.

Here's what the cleaned up code looks like so far. You can compare if you like or update the version you have if you like. No other changes as I'm not ready to release the next version.

My next huge challenge right now is zombie conic. I have to determine how many zombies there are and to a coinc for left right boundaries as well as a coinc for the hole, for each, on every cycle separate from the player character..

I'm really concerned about the performance hit I'm going to take and the amount of code it's going to take to do all this.

 

100 SCORE=0000 :: HEALTH=10 :: BOARD=1 :: HSCORE=0 :: MELEE=0 :: RANGED=0 :: BULL=8 :: CALL SCREEN(2)
110 CALL COLOR(10,15,1,3,12,1,4,12,1,11,12,1,12,12,1):: HCLR=1 :: CALL CLEAR
!running,stopping,jumping,left and right patterns
160 CALL CHAR(33,"18181010101010181818183C1C142630181A3C5E1A33406018197E981C724100")
165 CALL CHAR(37,"18197E98181472431818385E581C24361818101010101018000C1C3058081018")
170 CALL CHAR(41,"00000C1C305C1C180000060E183C0C180003070C18081018")
180 CALL CHAR(64,"030304060908101018181418101060001818103810180C001818503010180404")
190 CALL CHAR(68,"0018183050180818181810103850101818180808080808181818183C3828640C")
200 CALL CHAR(72,"18583C7A58CC020618987E19384E820018987E1918284EC218181C7A1A38246C")
210 CALL CHAR(76,"18180808080808180030380C1A100818000030380C3A381800006070183C3018")
220 CALL CHAR(80,"00C0E03018100818C0C020609010080818182818080806001818081C08183000")
230 CALL CHAR(84,"18180A0C081820200018180C0A181018181808081C0A0818")
240 CALL CHAR(104,"3C4426D999A5C3FFFFC3A59999A5C3FFFFFFFFFFFFFFFFFF1F1111111D11111F")
610 CALL CHAR(88,"66FFFFFF7E7E3C18",96,"3C2418FF9918183C")
630 CALL CHAR(112,"C0E0703A1E0C1A01000000FF7F1E1606")
650 CALL CHAR(120,"70808063141414E300000000334A4A3200000000993C21180044442810284444")
680 CALL CHAR(124,"E0E080E9EF86EFE9",142,"0000008000000000002418FF1824")
690 CALL CHAR(44,"3838107CBA38286C3C3C18FF7E3C183C0C0C04FC4C3C286C3030203F323C1436")
720 CALL CHAR(97,"3C2C18F81838246C3C2C18F8181818383C34181F181C24363C34181F1818181C")
760 RANDOMIZE
770 SLOT=10
780 OPTION BASE 1
790 DIM LO0T(3,14)
800 LTN=1::LAB=1::SHL=2 :: GRND=17::ZHELTH=2
830 LVL=3 :: YP=9 :: XP=8 :: RS=0 :: CS=16 :: RSPD=2.0 :: RSPDD=3.3
840 CHRR=33::CHSR=39::CHJR=64::CHLR=68::CHRL=70::CHSL=76::CHJL=81::CHLL=85::

Edited by Sinphaltimus
Link to comment
Share on other sites

I can't. I don't know how.

 

What I mean is, I learned how to use TI basic with line numbers. My brain breaks when I try to not do that.

Sadly, learning line-number BASIC means you have a lot to un-learn when you move to any other language. Back when I was moving from BASIC to any other language, I remember not understanding how to make a program repeat something (like a game loop) without using GOTO. Since BASIC / XB do not have any looping constructs (DO/WHILE, WHILE/WEND, REPEAT/UNTIL, etc.) other than FOR/NEXT, stepping away from line numbers was a huge expansion of my understanding. Interestingly, the original BASIC language as created by John G. Kemeny and Thomas E. Kurtz does not have line numbers, and *does* have many of the constructs missing from line-number BASICs. Still, BASIC made home computers easily accessible for many people and probably started many careers (like my own).

 

Using TidBit is easy. Start writing code just like you normally would, but leave out the line numbers. Any time you would normally want to use a line number in a GOTO, GOSUB, or THEN, just use a label. Heck, use labels like _250, _1000, etc. if that helps you (just don't start a label with a number). You can use C/C++ style comments in TidBit and they will all get stripped out, so you can combine your notes right in with your code and stop the madness.

 

I can code without line numbers in GML because I learned GML that way. IN GML i can use switch statements. In XB I cannot they don't exist.

Unfortunately, most of the ROM BASIC dialects that existed in the home computers are missing these constructs. You can simulate SWITCH in XB, but that would just add overhead. If your variable is numeric you can use ON GOTO or ON GOSUB in a very SWITCH-ish kind of way. But the old BASICs are limited and you certainly have to change your way of thinking to work with them efficiently. Any language is like that though. The syntax is easy part, but learning how to use the language in the way it was intended is what takes time. But the lack of indentation and complications of editing code with line numbers are the main reasons I wrote TidBit.

 

I get that I can replace goto and gosub with sub and such But I don't know the acceptable syntax for tidbit that will accurately translate it toTI XB.

 

Trust me, I want to.

It seems you think TidBit is doing more than it really is. You are still writing BASIC or XB, that does not change. You can try it out on my web site here: http://codehackcreate.com/archives/237

 

There is even a quick simple example. You can even begin by using your existing code, since TidBit will not replace any line numbers you already have. So, if you just want to use it to comment your code, you can do that. Then you can start to replace line numbers in your code with labels where you need them.

 

For example:

Code in:
// The quintessential Hello World program.
100 CALL CLEAR
200 PRINT "HELLO WORLD"


Code out:
100 CALL CLEAR
200 PRINT "HELLO WORLD"
Here is another example that mixes line-number XB with code that will get line-numbers assigned. While you can do this, you have to be careful since TidBit can get confused and won't stop you from overwriting lines if the auto-generated lines run into a line number you force. But I think you will get the idea:

Code in:
// Zombie Attack.
100 CALL CLEAR
200 PRINT "ZOMBIE ATTACK"

PRINT "This line will get an auto line number from TidBit"

GOSUB collision_detection
GOSUB 2000
GOSUB zombie_ai

END

// Collision detection subroutine
1000  // This line number will force this subroutine to start on line 1000.
collision_detection:
  PRINT "Do collision detection"
  RETURN

// Some other routine, the line number is forced and TidBit will not over-write it.
2000 PRINT "Another sub routine"
2010 RETURN

// Zombie AI - this routine will start on whatever line number follows from the previous code.
// But we don't care what line number is gets assigned, since the GOSUB above uses the label
// "name" instead of a hard-coded line number.
zombie_ai:
  PRINT "BRAINS!"
  RETURN


Code out:
100 CALL CLEAR
200 PRINT "ZOMBIE ATTACK"
210 PRINT "This line will get an auto line number from TidBit"
220 GOSUB 1000
230 GOSUB 2000
240 GOSUB 2020
250 END
1000 PRINT "Do collision detection"
1010 RETURN
2000 PRINT "Another sub routine"
2010 RETURN
2020 PRINT "BRAINS!"
2030 RETURN

I went ahead and took part of your code and TidBit-ified it. It no longer relies on line numbers, you can comment the heck out of it, more easily check your structure and program flow, etc.

 

 

// *******************************************
// Shoot Left
// *******************************************
    IF CS<>-16 THEN return

    CALL SPRITE(#1,46,6,YP,XP)
 
    IF YP<>33 THEN _6250

    IF LO0T(1,1)<>96 THEN _6200
        ZED1=1 ::
        CALL POSITION(#10,YZ1,XZ1)::
        CALL POSITION(#1,YP,XP)::
        DET1=LO0T(2,1)::
        IF XP<=XZ1 THEN ZED1=0
        GOTO _6210
    _6200:
        ED1=0

    _6210:
    IF LO0T(1,2)<>96 THEN _6240
        ZED2=1 ::
        CALL POSITION(#11,YZ2,XZ2)::
        CALL POSITION(#1,YP,XP)::
        DET2=LO0T(2,2)::
        IF XP<=XZ2 THEN ZED2=0
        GOTO bullet_file_left
    _6240:
        ZED2=0::
        GOTO bullet_file_left
 
    _6250:
    IF YP<>57 THEN _6315

    IF LO0T(1,3)<>96 THEN _6280
        ZED1=1 ::
        CALL POSITION(#12,YZ1,XZ1)::
        CALL POSITION(#1,YP,XP)::
        DET1=LO0T(2,3)::
        IF XP<=XZ1 THEN ZED1=0
        GOTO _6290
    _6280:
        ZED1=0

    _6290:
    IF LO0T(1,4)<>96 THEN _6310
        ZED2=1 ::
        CALL POSITION(#13,YZ2,XZ2)::
        CALL POSITION(#1,YP,XP)::
        DET2=LO0T(2,4)::
        IF XP<=XZ2 THEN ZED2=0
        GOTO bullet_file_left
    _6310:
        ZED2=0::
        GOTO bullet_file_left
 
    _6315:
    IF YP<>81 THEN _6380

    IF LO0T(1,5)<>96 THEN _6340
        ZED1=1 ::
        CALL POSITION(#14,YZ1,XZ1)::
        CALL POSITION(#1,YP,XP)::
        DET1=LO0T(2,5)::
        IF XP<=XZ1 THEN ZED1=0
        GOTO _6350
    _6340:
        ZED1=0

    _6350: IF LO0T(1,6)<>96 THEN _6370
        ZED2=1 ::
        CALL POSITION(#15,YZ2,XZ2)::
        CALL POSITION(#1,YP,XP)::
        DET2=LO0T(2,6)::
        IF XP<=XZ2 THEN ZED2=0
        GOTO bullet_file_left
    _6370:
        ZED2=0::
        GOTO bullet_file_left

    _6380:
    IF YP<>105 THEN _6450
    
    IF LO0T(1,7)<>96 THEN _6410
        ZED1=1 :: 
        CALL POSITION(#16,YZ1,XZ1):: 
        CALL POSITION(#1,YP,XP):: 
        DET1=LO0T(2,7):: 
        IF XP<=XZ1 THEN ZED1=0
        GOTO _6420
    _6410:
        ZED1=0

    _6420:
    IF LO0T(1, <>96 THEN _6440
        ZED2=1 :: 
        CALL POSITION(#17,YZ2,XZ2):: 
        CALL POSITION(#1,YP,XP):: 
        DET2=LO0T(2, :: 
        IF XP<=XZ2 THEN ZED2=0
        GOTO bullet_file_left
    _6440:
        ZED2=0:: 
        GOTO bullet_file_left

    _6450:
    IF YP<>129 THEN _6520

    IF LO0T(1,9)<>96 THEN _6480
        ZED1=1 :: 
        CALL POSITION(#18,YZ1,XZ1):: 
        CALL POSITION(#1,YP,XP):: 
        DET1=LO0T(2,9):: 
        IF XP<=XZ1 THEN ZED1=0
        GOTO _6490
    _6480:
        ZED1=0

    _6490:
    IF LO0T(1,10)<>96 THEN _6510
        ZED2=1 :: 
        CALL POSITION(#19,YZ2,XZ2):: 
        CALL POSITION(#1,YP,XP):: 
        DET2=LO0T(2,10):: 
        IF XP<=XZ2 THEN ZED2=0
        GOTO bullet_file_left
    _6510:
        ZED2=0:: 
        GOTO bullet_file_left

    _6520:
    IF YP<>153 THEN _6590

    IF LO0T(1,11)<>96 THEN _6550
        ZED1=1 :: 
        CALL POSITION(#20,YZ1,XZ1):: 
        CALL POSITION(#1,YP,XP):: 
        DDET1=LO0T(2,11):: 
        IF XP<=XZ1 THEN ZED1=0
        GOTO _6560
    _6550: 
        ZED1=0

    _6560:
    IF LO0T(1,12)<>96 THEN _6580
        ZED2=1 :: 
        CALL POSITION(#21,YZ2,XZ2):: 
        CALL POSITION(#1,YP,XP):: 
        DET2=LO0T(2,12):: 
        IF XP<=XZ2 THEN ZED2=0
        GOTO bullet_file_left
    _6580:
        ZED2=0:: 
        GOTO bullet_file_left

    _6590:
    IF YP<>177 THEN RETURN

    IF LO0T(1,13)<>96 THEN _6620
        ZED1=1 :: 
        CALL POSITION(#22,YZ1,XZ1):: 
        CALL POSITION(#1,YP,XP):: 
        DET1=LO0T(2,13):: 
        IF XP<=XZ1 THEN ZED1=0
        GOTO _6630
    _6620: 
        ZED1=0
    
    _6630:
    IF LO0T(1,14)<>96 THEN _6650
        ZED2=1 :: 
        CALL POSITION(#23,YZ2,XZ2):: 
        CALL POSITION(#1,YP,XP):: 
        DET2=LO0T(2,14):: 
        IF XP<=XZ2 THEN ZED2=0
        GOTO bullet_file_left
    _6650: 
        ZED2=0:: 
        GOTO bullet_file_left

RETURN



// ****************************************
// Bullet fire left
// ****************************************
bullet_file_left:
6940 IF ZED1=0 AND ZED2=0 THEN 7100
6942 IF ZED1=1 AND ZED2=0 THEN 6975
6945 IF ZED1=0 AND ZED2=1 THEN 7005
6947 IF ZED1=1 AND ZED2=1 THEN 6975

 

 

Output. Looks almost identical to your original code except where TidBit was numbering by 10 and in a few places you had to slip in a line number incremented by 5.

 

 

6150 IF CS<>-16 THEN return
6160 CALL SPRITE(#1,46,6,YP,XP)
6170 IF YP<>33 THEN 6260
6180 IF LO0T(1,1)<>96 THEN 6210
6190 ZED1=1 :: CALL POSITION(#10,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,1):: IF XP<=XZ1 THEN ZED1=0
6200 GOTO 6220
6210 ED1=0
6220 IF LO0T(1,2)<>96 THEN 6250
6230 ZED2=1 :: CALL POSITION(#11,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,2):: IF XP<=XZ2 THEN ZED2=0
6240 GOTO 6940
6250 ZED2=0:: GOTO 6940
6260 IF YP<>57 THEN 6350
6270 IF LO0T(1,3)<>96 THEN 6300
6280 ZED1=1 :: CALL POSITION(#12,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,3):: IF XP<=XZ1 THEN ZED1=0
6290 GOTO 6310
6300 ZED1=0
6310 IF LO0T(1,4)<>96 THEN 6340
6320 ZED2=1 :: CALL POSITION(#13,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,4):: IF XP<=XZ2 THEN ZED2=0
6330 GOTO 6940
6340 ZED2=0:: GOTO 6940
6350 IF YP<>81 THEN 6440
6360 IF LO0T(1,5)<>96 THEN 6390
6370 ZED1=1 :: CALL POSITION(#14,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,5):: IF XP<=XZ1 THEN ZED1=0
6380 GOTO 6400
6390 ZED1=0
6400 IF LO0T(1,6)<>96 THEN 6430
6410 ZED2=1 :: CALL POSITION(#15,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,6):: IF XP<=XZ2 THEN ZED2=0
6420 GOTO 6940
6430 ZED2=0:: GOTO 6940
6440 IF YP<>105 THEN 6530
6450 IF LO0T(1,7)<>96 THEN 6480
6460 ZED1=1 :: CALL POSITION(#16,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,7):: IF XP<=XZ1 THEN ZED1=0
6470 GOTO 6490
6480 ZED1=0
6490 IF LO0T(1, <>96 THEN 6520
6500 ZED2=1 :: CALL POSITION(#17,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2, :: IF XP<=XZ2 THEN ZED2=0
6510 GOTO 6940
6520 ZED2=0:: GOTO 6940
6530 IF YP<>129 THEN 6620
6540 IF LO0T(1,9)<>96 THEN 6570
6550 ZED1=1 :: CALL POSITION(#18,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,9):: IF XP<=XZ1 THEN ZED1=0
6560 GOTO 6580
6570 ZED1=0
6580 IF LO0T(1,10)<>96 THEN 6610
6590 ZED2=1 :: CALL POSITION(#19,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,10):: IF XP<=XZ2 THEN ZED2=0
6600 GOTO 6940
6610 ZED2=0:: GOTO 6940
6620 IF YP<>153 THEN 6710
6630 IF LO0T(1,11)<>96 THEN 6660
6640 ZED1=1 :: CALL POSITION(#20,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DDET1=LO0T(2,11):: IF XP<=XZ1 THEN ZED1=0
6650 GOTO 6670
6660 ZED1=0
6670 IF LO0T(1,12)<>96 THEN 6700
6680 ZED2=1 :: CALL POSITION(#21,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,12):: IF XP<=XZ2 THEN ZED2=0
6690 GOTO 6940
6700 ZED2=0:: GOTO 6940
6710 IF YP<>177 THEN RETURN
6720 IF LO0T(1,13)<>96 THEN 6750
6730 ZED1=1 :: CALL POSITION(#22,YZ1,XZ1):: CALL POSITION(#1,YP,XP):: DET1=LO0T(2,13):: IF XP<=XZ1 THEN ZED1=0
6740 GOTO 6760
6750 ZED1=0
6760 IF LO0T(1,14)<>96 THEN 6790
6770 ZED2=1 :: CALL POSITION(#23,YZ2,XZ2):: CALL POSITION(#1,YP,XP):: DET2=LO0T(2,14):: IF XP<=XZ2 THEN ZED2=0
6780 GOTO 6940
6790 ZED2=0:: GOTO 6940
6800 RETURN



6940 IF ZED1=0 AND ZED2=0 THEN 7100
6942 IF ZED1=1 AND ZED2=0 THEN 6975
6945 IF ZED1=0 AND ZED2=1 THEN 7005
6947 IF ZED1=1 AND ZED2=1 THEN 6975

 

Edited by matthew180
  • Like 1
Link to comment
Share on other sites

Sadly, learning line-number BASIC means you have a lot to un-learn

 

<SNIP>

 

 

6940 IF ZED1=0 AND ZED2=0 THEN 7100

6942 IF ZED1=1 AND ZED2=0 THEN 6975

6945 IF ZED1=0 AND ZED2=1 THEN 7005

6947 IF ZED1=1 AND ZED2=1 THEN 6975

 

MATTHEW, thank you much for all this. I've moved tidbit several notches up my priority list.

 

I guess that's the hard part for me. Getting rid of the line numbers and still writing in xb. Your examples of my code slow me to see the labels and how to write them. The light bulb is beginning to glow.

Link to comment
Share on other sites

On a side note, I've optimized all the code freeing up just over 3k before typing run. I'm now going through all the code again to see where I can replace repetitive routines with something more concise like a sub I can pass arguments to. But I need to know the limitations of that as far as global vs. local variables better. Heading out for some appointments, bringing my Extended BASIC book with me.

Link to comment
Share on other sites

Note: I use the term "BASIC" to refer to any ROM-based line-number BASIC dialect on early 80's home computers. There are modern "BASIC" dialects that are compiled or run very fast on modern computers; I am not talking about those variations.

 

You have to be careful with line-number BASIC of any kind. When you are first learning it is fun because you can do a lot quickly. Then as you expand your code organically, the shortcomings of BASIC really start to come out. The simple lack of indentation prevents you from seeing any structure in your code and it starts to ramble. Soon, using GOTO to jump wherever you need to be in the code causes you to lose any benefit you were getting from trying to use subroutines, etc.

 

It is actually harder, IMO, to write good code in line-number BASIC than in most other languages. Also, because these machines are limited in speed and other resources like memory they are not forgiving. You can't get away with things that you might on a modern computer with gigahertz of speed and gigabytes or RAM. Actions games and BASIC do not mix very well. BASIC makes the machine very accessible, but don't set your performance sights very high or try to make a huge application.

 

Unfortunately reading the XB manual won't give you much insight into making good XB programs. You will know the syntax and what is available, but it does not explain how the language was meant to be used. As I mentioned before, this is the hard part of getting into a new language. You have to start thinking in the way that XB was designed to be used, with all the little quirks and nuances, and that takes a lot of time investment. The sad part is, your reward for the investment will always be less than you hope for (IMO) because of the speed and memory limitations of XB. This is why most people move on to something like Assembly, C, Forth, or Pascal.

 

You do a lot of brute-force problem solving in your code, which is a really good way to dive in an start learning. But you are now at a point where improving the code requires significant effort and time, and it will start to become less fun. My suggestion would to not go there. It will kill your enthusiasm and the fun you are having. More simply, when it is not fun any more, stop. But only you can make that determination.

  • Like 2
Link to comment
Share on other sites

You do a lot of brute-force problem solving in your code, which is a really good way to dive in an start learning. But you are now at a point where improving the code requires significant effort and time, and it will start to become less fun. My suggestion would to not go there. It will kill your enthusiasm and the fun you are having. More simply, when it is not fun any more, stop. But only you can make that determination.

This is part of the fun for me. Never taking any coding instruction, even with GML in GameMaker, I found it difficult to grasp rather simple concepts like arrays and passing arguments to scripts. Coming here and doing TI XB and I learned both concepts and am kind of embarrassed I didn't understand for so long. And now, I want to go and optimize my code. That daunting task is a challenge. When I push through now will certainly give me the motivation to never do that again. And in the end make me bettter. I'm far from being discouraged. Every day is getting more exciting.

 

Here, let me show you something.

 

I wrote my first ever sub program in XB that I actually took the time to plan out. It may not be perfect or as efficient as it can be. But it's a reduction in size from the original code. And if I got this correct and it works, I can easily crunch the heck out of my loot collision detection area simply by passing variables in to the script for processing. All the effort for me is designing that hand off. I know this isn't much, but it's huge to me.

 

Here's the original code that was used from 2 areas of the main program using a gosub 970 call.

 

! ********jump routine check********
970 CALL MOTION(#1,0,0)::IF CS<>-16 THEN 1020
990 CALL POSITION(#1,YP,XP)::GOSUB 1060
1010 GOTO 860
1020 IF CS<>16 THEN 1500
!goto jump right**************************
1030 CALL POSITION(#1,YP,XP)::GOSUB 1280
1050 GOTO 860
!*************jump left routine*********
!joystick button pressed so STOP running
1060 CS=0 :: CALL MOTION(#1,0,CS)::CALL SPRITE(#1,CHSL,6,YP,XP)
1080 FOR PT=76 TO 80::CALL SOUND(1,191-PT,5)::CALL PATTERN(#1,PT)::NEXT PT
1120 CALL POSITION(#1,YP,XP)::IF XP<=24 THEN 1210
1140 CS=-20 :: YP=YP-3 :: RS=0 :: CALL SPRITE(#1,CHJL,6,YP,XP,RS,CS)
1150 FOR PT=81 TO 84::CALL PATTERN(#1,PT):: CALL SOUND(1,110+PT,5)::NEXT PT
1180 CS=0 :: CALL MOTION(#1,0,CS)::CALL POSITION(#1,YP,XP)::YP=YP+3
1210 CALL SPRITE(#1,CHLL,6,YP,XP)::FOR PT=85 TO 86::CALL PATTERN(#1,PT):: CALL SOUND(1,200-PT,5)::NEXT PT
1250 CALL POSITION(#1,YP,XP)::CS=-16::RETURN
!*************jump right routine******
!joystick button pressed so STOP running right
1280 CS=0 :: CALL MOTION(#1,0,CS)::CALL SPRITE(#1,CHSR,6,YP,XP)
1300 FOR PT=39 TO 43::CALL SOUND(1,191-(PT+37),5)::CALL PATTERN(#1,PT)::NEXT PT
1340 CALL POSITION(#1,YP,XP)::IF XP>=224 THEN 1430
1350 CS=20 :: YP=YP-3 :: CALL SPRITE(#1,CHJR,6,YP,XP,RS,CS)
1370 FOR PT=64 TO 67::CALL PATTERN(#1,PT):: CALL SOUND(1,110+(PT+13),5)::NEXT PT
1400 CS=0 :: CALL MOTION(#1,0,CS)::CALL POSITION(#1,YP,XP)::YP=YP+3
1430 CALL SPRITE(#1,CHLR,6,YP,XP)::FOR PT=68 TO 69::CALL PATTERN(#1,PT):: CALL SOUND(1,191-(PT+11),5)::NEXT PT
1470 CALL POSITION(#1,YP,XP)::CS=16::RETURN

And here is my optimized version using

CALL JUMP(XP,YP,CHSL,CHSR,CHJL,CHJR,CHLL,CHLR)
 

! ********JUMP ROUTINE CHECK********
2000 SUB JUMP(XP,YP,CHSL,CHSR,CHJL,CHJR,CHLL,CHLR)
2010 CALL MOTION(#1,0,0)::IF CS<>-16 THEN 2050
2020 CALL POSITION(#1,YP,XP)::G1=CHSL::G2=CHJL::G3=CHLL::N1=76::N2=80::JRD=0::JRD2=0::JCS=-20
2030 GOTO 2090
2040 SUBEXIT
2050 IF CS<>16 THEN subexit
2060 CALL POSITION(#1,YP,XP)::G1=CHSR::G2=CHJR::G3=CHLR::N1=39::N2=43::JRD=20::JRD2=17::JCS=20
2070 GOTO 2090
2080 SUBEXIT
2090 CALL MOTION(#1,0,0)::CALL SPRITE(#1,G1,6,YP,XP)
2100 FOR PT=N1 TO N2::CALL SOUND(1,191-(PT+37),5)::CALL PATTERN(#1,PT)::NEXT PT
2110 CALL POSITION(#1,YP,XP)::IF XP>=224 THEN 2160
2120 YP=YP-3 :: CALL SPRITE(#1,G2,6,YP,XP,RS,JCS)
2130 N1=(PT+1)+JRD::N2=(PT+4)+JRD2
2140 FOR PT=N1 TO N2::CALL PATTERN(#1,PT):: CALL SOUND(1,110+(PT+13),5)::NEXT PT
2150 CS=0 :: CALL MOTION(#1,0,CS)::CALL POSITION(#1,YP,XP)::YP=YP+3
2160 N1=(PT+1)::N2=N2+2
2170 CALL SPRITE(#1,G3,6,YP,XP)::FOR PT=n1 TO n2::CALL PATTERN(#1,PT):: CALL SOUND(1,191-(PT+11),5)::NEXT PT
2180 CALL POSITION(#1,YP,XP)::SUBEND

I'm about to test this right now. :) =Success - :( not so much.

 

Result.....(brb) I have to copy/paste...tic toc...

 

:( - For-Next Nesting in 2000. Well, I'm going to get back to this... be back later...

Edited by Sinphaltimus
Link to comment
Share on other sites

And now, I want to go and optimize my code.

You probably got a plan for what to do or look for. You pick up breadcrumbs here and there. Turning and touching this and that in a learning process. Practice makes master. Program optimizations is, like most things, subjective. Try and quantize, and handpicked costs and benefits, and their weight is, subjective.

 

;)

 

ref.:

https://en.wikipedia.org/wiki/Program_optimization

 

 

 

Link to comment
Share on other sites

This is part of the fun for me. Never taking any coding instruction, even with GML in GameMaker, I found it difficult to grasp rather simple concepts like arrays and passing arguments to scripts. Coming here and doing TI XB and I learned both concepts and am kind of embarrassed I didn't understand for so long. And now, I want to go and optimize my code. That daunting task is a challenge. When I push through now will certainly give me the motivation to never do that again. And in the end make me better. I'm far from being discouraged. Every day is getting more exciting.

By all means, carry on! :-)

 

Self learning is the best way, IMO. I think you will find a lot of people here taught themselves to code the same way, and on the same computer. I learned from the blue Beginner's BASIC book that came with the 99/4A, as well as typing in many many programs from computer magazines like COMPUTE!, as well as books. Reading code is one of the best ways to learn and you get to see how other people solve similar problems. Also, after typing in the programs you get curious and start to hack on them, learning the details of how and why they work. I highly recommend you spend some time typing in some programs that other people have written, you will learn more than you imagine.

  • Like 1
Link to comment
Share on other sites

I'm stuck right now. I have a for-next nesting situation with my sub program that I cannot for the life of me figure out. I think it's a gosub call early on, several jumps before the actual call sub that doesn't return until well after the call sub.

I may post some new code for review. I think I'm going to need some help on this one.

 

 

EDIT: Amazing, after a good night's sleep I find the problem in 10 minutes after getting started this morning. I love the human brain but I wish it did't have such lag (sleeping on it)...

Edited by Sinphaltimus
Link to comment
Share on other sites

I remember fighting an evil bug in some on site in Singapore. Couldn't find the problem. That night in bed in the hotel the solution came to me at three in the morning in a dream! I got dressed, down to the lobby, into a taxi and back to the factory. Had it working in five minutes!

Edited by Willsy
  • Like 2
Link to comment
Share on other sites

Deconstructing XB for TidBit.

 

OK Matthew180

 

Here's my original code that ran error free afaik:

 

ZOMBtiV034F.txt

 

My first step was to structure it as best i could in one run with labels.

 

ZOMBtiV034FforTIDBIT_part1.txt

 

 

After that, I went back in removed all the line numbers I could. The ones I couldn't, I created labels for.

 

ZOMBtiV034_source.txt

 

 

Then the output from TidBit

 

ZOMBtiV034FforTIDBIT_part3.txt

 

 

And there are a lot of bugs. So I think I'm going to stick with it. I can work out the bugs from here and easy start to really crunch my code down.

 

Th'ere a lot of weird hings happening right now with some aspects of the game. I'm betting it's some changes i made along the way of stripping it down for TidBit. I was amazed the game ran and worked for the most part.

 

Now I have a free an open source file to work from, without the need for line numbers and a very easy way to move things around and shrink them.

 

Thanks for pushing me to use it. The hours and hours and hours it took me to do this, It's well worth it. It's where I should have started from. But who knew this was going to turn in to a game?

 

I didn't. And now that it is, I'm in a much better position to complete the development and fix the issues thanks to the persistence of the members here. :)

 

 

EDIT: Thanks to Matthew, he found some issues with my code pasted in to tidbit and the way tidbit dealt with it.

 

I've cleaned it all up this morning but not in time to post before leaving for work. I'll test the new cleaner code when I get home later today. If all goes well I'll continue optimizing the code to free up more space for more code. Need to do zombie ai and coinc detections. So I'll need a bit of room for that.

Edited by Sinphaltimus
  • Like 4
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...