Jump to content
IGNORED

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


Sinphaltimus

Recommended Posts

 

This is crazy..........

 

EDIT: Well, it's all working. Just need to adjust and test and adjust and test and adjust and test and adjust and test and adjust and test and adjust and test and.....

 

 

A big pain in the butt when using the compiler is adjusting timing delays and other variables so the game runs at the right speed. One thing you can do is set up an editing window in whatever screen you are not using. I think you are using screen1 for Zombi, so make screen 2 the editing window and you can get there by pushing <Fctn 3> or some other "hot" key. Set this up as a subroutine that you GOSUB to. (Sort of like Shift 838). In the editing window you can input different values for the variables you want to test and when you are done, just RETURN to the game.where you left off, but with new values for the variables.

 

Also, remember that you can RUN the program created by the compiler loader. No need to go to the editor/assembler cartridge to test.

Link to comment
Share on other sites

Yep,

Many if the variables I have set up in the beginning of the program are directly linked to give tuning. I could change just about anything in the game in the first 20 or so lines.

 

I discovered the "running the game in the compiler" buy accident the other day when I made a mistake and the compiler quit, I typed run to get it to run again but my game came up instead. Lol. I don't know the conditions that caused it do thanks for confirming. That will indeed save me a lot of time testing.

Edited by Sinphaltimus
Link to comment
Share on other sites

New version 0.41 details available here:

http://atariage.com/forums/topic/255837-new-32k-xb-gamezombi-work-in-progress/?p=3570558

Highlighted changes = Title, Instruction and You are dead screens added/reworked.

 

DOWNLOAD:

http://atariage.com/forums/index.php?app=core&module=attach&section=attach&attach_id=475061

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

Alrighty then, got them legs working...

ZombiWalk.zip

 

 

 

100 CALL CLEAR::CALL SCREEN(2)
110 CALL CHAR(96,"3C2418FF9918183C")
120 CALL CHAR(97,"3C2C18F81838246C3C2C18F8181818383C34181F181C24363C34181F1818181C")
130 ZY=12::ZX=12::ZEDDIR=1
140 ZEDSTEPL=0::ZEDSETPR=0
150 CALL SPRITE(#10,97,4,ZY,ZX)
160 CALL KEY(1,K,S)::IF S<>0 THEN 170 ELSE 190
170 CALL SPRITE(#10,96,4,ZY,ZX)
180 IF ZEDDIR=1 THEN ZEDDIR=-1 ELSE ZEDDIR=1
190 IF ZEDDIR=-1 THEN 220
200 ZX=ZX+1::IF ZX>=100 THEN 210 ELSE 240
210 ZX=11::GOTO 240
220 ZX=ZX-1::IF ZX<=10 THEN 230 ELSE 240
230 ZX=99
240 IF ZEDDIR=1 THEN 250 ELSE 280
250 IF ZEDSTEPR=0 THEN 260 ELSE 270
260 CALL SPRITE(#10,100,4,ZY,ZX)::ZEDSTEPR=1::GOTO 160
270 CALL SPRITE(#10,99,4,ZY,ZX)::ZEDSTEPR=0::GOTO 160
280 IF ZEDSTEPL=0 THEN 290 ELSE 300
290 CALL SPRITE(#10,98,4,ZY,ZX)::ZEDSTEPL=1::GOTO 160
300 CALL SPRITE(#10,97,4,ZY,ZX)::ZEDSTEPL=0::GOTO 160
310 GOTO 160
Edited by Sinphaltimus
Link to comment
Share on other sites


180 IF ZEDDIR=1 THEN ZEDDIR=-1 ELSE ZEDDIR=1

Line 180 will not compile correctly. I think you can do this with

180 ZEDDIR=1+2*(ZEDDIR=1)

If I recall correctly (ZEDDIR=1) returns a value of -1 if true and 0 if false.

 

(Edit) Just checked and the suggestion above works properly. I did a lot of programming in TI BASIC which lacks the relational operators found in XB and got into the habit of writing lines like this.

Edited by senior_falcon
Link to comment
Share on other sites

New version 0.42 available >>>HERE<<<

V042 changes:
YOU ARE DEAD screen *fixed*
Zombie walking animations *fixed*
High Score displayed @death & level progression
IDLE Step timer added - every (Board*2) steps, minus 1 point (encourages urgency).
Bullets destroy loot
Loot distribution balance adjusted - still testing.
Gave Zombies more health.
Link to comment
Share on other sites

NEW VERSION 0.43 AVAILABLE >>>HERE<<<

 

V043 CHANGES:
Improvements to jumping. Rewrote jumping behaviour.
Title and instruction screen delay. To prevent skipping over instructions if key press not released soon enough.
Ranged fixed (issues pertaining to bullets)- Completely rewrote the ranged attack routine.
Bullets now destroy loot.
*FIXED* No points for shooting zombies. You were getting points - the gui wasn't updating at kill time.
*FIXED* Zombie health still at 2 hit points. Zombies now have 4 hit points to start. 2 ranged shots or 4 melee to take one down.
*FIXED* Need to spawn more zeds at beginning of game - Adjusted Zombie and Loot balance
*FIXED* Holes destroy bullets. - bullets now pass over holes.
Chance to miss a zombie. If a zombie is heading towards you there is a small chance you'll miss a shot.
  • Like 1
Link to comment
Share on other sites

Sounds as if you've got the upper hand now. :)

 

 

I guess that's then by design. Usually that was something you wrote in the instructions when XB wouldn't catch all the collisions. ;)

What design? There is no design. LOL

Accidental design.

It's a mixed bag of tricks. It is actually a missed coinc that rarely happens. I noticed it once during testing when the bullet whizzed by the zombie and destroyed a heart loot item behind the zombie. Of all the testing I did thus far, it feels better since zombies are such easy targets to hit. I decided to leave it as is. To stop the behavior all I have to do is up the coinc detection radius. But the game becomes too easy at that point. And it only has a chance of happening when a zed is coming at you which adds to the panic.

 

In other words, nothing has changed, it's exactly as you've observed. But not something I can't fix, just something I prefer not fixed. A FEATURE!

 

 

Also, I haven't tested on real iron. Only emulation. I find real iron a lot tighter so I have yet to see if this holds true on an actual TI. *it does*

Edited by Sinphaltimus
Link to comment
Share on other sites

A note about the development. It's literally by the seat of my pants. The more I play the more I see it needs. I need to make it fun and change it up as you go so as not to get bored with the same old stuff just getting harder.

There is no GCD or GDD or any plan whatsoever. It started as an animation demo that turned in to a game. What sort of game I end up with remains to be determined.

The big picture is this:
At Level (board) 66 I will introduce a new zombie. Same as the old except it will try to match the player's X position as best it can (chase the player).

At Level (board) 33 I will introduce a new zombie. Unlike any others, this zombie will be new animations. It will be a free roaming zombie that crawls on walls. When it spawns, it will target all hearts on the board first. If no hearts, it will target the player. It will be a slow traveler relative to player speed.

This is breaking news and not part of the original idea as of yesterday but after play testing this morning I've decided....
There will be 3 power ups to assist as things get difficult. At level 75 a health power up that will double you max health.

At level 50 a ranged weapon power up that will double your capacity to 20. at level 25 a weapon power up that will double your melee weapon capacity to 20.

I don't yet know how I'm going to end the game. I have several ideas but no spoilers because I want it to be something completely different on the last level. A surprise. A tough boss fight or really hard level? Maybe a dramatic really easy level as the reward? With tons of loot and zombies? A rescue scene? It ends with the death of the character? I simply don't know yet. I'll know when I get there.

Then there's all the secondary stuff and polish. Like having Zombie death and loot destroyed animations with sound effects. Possibly redoing munch of the existing artwork. Maybe change up ZEDai so they will randomly change direction instead of waiting to hit a hole. I don't want to go beta until I have all this answered and in game. Beta, to me, is for fixing remaining bugs, optimizing all code and polishing up the look and feel.

No deadlines, no rush, just the way I like it. It would have been nice to have had this done by Halloween. I'm hopeful by Christmas.

Then guess what? I may port it to PC and Android.

But I know one thing for sure. I know what my next project is going to be for the http://atariage.com/forums/topic/254360-graphics-on-your-ti-are-you-interested/topic. and with any luck, it will turn in to my next TI game project. :) Only this time, I'd have gained enough knowledge to actually plan it out. :)


  • Like 1
Link to comment
Share on other sites

New version 0.44 alpha available >>>HERE<<<!!!

V044 CHANGES:
Player starts game with full inventory. *Testing this out may revert to no inventory again*
Rearranged source code for better readability (flow).
Loot balanced to 25%
Highscore YAD screen WIP. Needs a display at for actual score and test it first.
*FIXED*Can't figure out why HSCORE not remaining.
*FIXED* character Shooting stance
*FIXED* last zed freezing when another zed killed. Zed teleporting to level1 - This was a bvuig related to how I was dealing with arrays.
*FIXED* Melee attacks at far edge of levels could produce an out of range y coordinate for melee weapon attack sprite call.
*FIXED* Bug in the way melee was being checked for coinc with loot AND ZEDS.
*FIXED* a lot of bugs that were created by fixing previous bugs. too many to list.
Edited by Sinphaltimus
  • Like 1
Link to comment
Share on other sites

New version 0.45 alpha available >>>HERE<<<!!!

 

V0.45 changes:

added more delay after jump. *needs more delay
added delay at loot. *needs more delay
zombies continue to move during player fall.
*Fixed* High Score display between levels and at You Are Dead screens.
Zombies destroy hearts upon contact.
Rewrote the collisions a bit at the expense of performance. Will optimize in beta.

 

Link to comment
Share on other sites

New version 0.46 alpha available >>>HERE<<<!!!

V0.46 changes:

Added more delay after jump.
Added more delay at loot.
Added a lot more comments to source code.
Added 3 power ups to assist as things get difficult. At level 75 a health power up that will double your max health.
At level 50 a ranged weapon power up that will double your capacity to 20. at level 25 a weapon power up that will double your melee weapon capacity to 20.
At level 50 zombie health is increased by 50%
At Level (board) 66 existing zombies will try to match the player's X position as best it can (chase the player) when on the same level
At level 33 all zeds chase the player regardless of level they are on.
Added framework for crawler.
Link to comment
Share on other sites

Yes, there are animation issues that will get fixed in beta and the slow down is a known issue also waiting for beta as it will take a lot of rewriting a lot of code to fix it.

I'm not 100% certain how I will do it either because with one Zombie it does x-amount of checking and if there is a coinc involved it gets expensive figuring out with what the coinc occurred. This check takes place every cycle. So as zeds get added, the amount of time it takes to get through all the check goes up quickly. To the point where it's unplayable at about 4 zombies on the screen at once.

:)

The way I handle the player COINC checks is very different to the way I handle Zombie coinc checks. So I'm pretty sure I'm going to have to come up with some hybrid solution that works and keeps the pace of the game through out.

 

I have 2 major tasks to complete before entering beta. First, I need to get zombies dropping to lower levels once the player passes them up to work. Everything is in game now and working except for coinc checks when 3 or more zombies are on the same level. I know the issue and how to fix (might already be fixed in 0.47) but have disabled it until I can test it thoroughly.

We have call coinc from one sprite number to another and we have call coinc for all. I really wish we had a call coinc for sprite number vs all.

I'm almost convinced I have to do a coinc check individually for every item on the level every cycle in order to reduce the overhead of calculations being used to figure out who is coincident.

This is kind of how I have been doing it but I'm slowly transitioning away. Here's what I mean:

I populate the board in a specific pattern and I record the results in an array. That means that the player is always sprite number 1, the holes are always sprite #2 - #8 with 2 being on the top level, 3 being one below, etc...

I mimic gravity by controlling the Y position so I know that the top level is Y=9 the next one down is Y=33, then 57, etc...

So I know when YP (player's y position) = 57, I only have to do 3 coince checks. One against sprite number 3 (the hole) #10 and #11 (loot - I treat zombies like loot). So I have only 3 coinc calls to make and once one it true if it's a hole it's instant fall routine. If it's not, then I have to check the sprite number in the correct position in the array against its char code assignment to identify what exactly we are coinc with.

 

The method seemed a lot more efficient that cycling through all the loot at every coinc event which was the original way I was doing it.

As soon as I put the zombies in motion, performance died. That's when I went compiled. Which made it possible to continue.

Now, the player is still doing the coincs as described above with the exception of the zed. I moved the zed off the player coinc checks and instead made each zed do a coinc against the player. This helped.

So I think my next iteration is going to do an individual coinc check for all srptie numbers against the player and the zed separately.

right now, I'm relying on a CALL COINC(ALL,C) to trigger the events that start all the things needed to discover what is actually coincident or not.

I think the new way is going to be a lot more efficient when a coinc does occur. Only time will tell.

If you made it this far, here's a reward for reading through my ramblings... Press B at anytime to advance a board. it allows me to watch progression of loot distribution in real time. Especially in classic99 in CPU overdrive.

Edited by Sinphaltimus
Link to comment
Share on other sites

OK... So my collisions are actually in better shape than I recalled in my last post.

I've got some ideas on how to improve performance that I think are viable enough to try.
The Char Codes are causing a big issue (it has been reported by sometimes99er in the jump right animation) in calling the proper char codes for a needed frame. That is to say I'm cycling through char codes and patterns to animate. Those ASCII codes are not contiguous. It's been this way from very early on and only recently (I think 2 or 3 versions ago) did the jump right animation issue become apparent. Even after patching it over and over again as I made progress.

So now, I've decided to redo my char codes.

Yes, I have to reassign all my ascii char code patterns to be neat and tidy so I can better control the animations.

This is a huge overhaul I've been trying to put off until beta.

And I'm one step away from beta. I have the zombies dropping down levels without issue. I just have to create the crawler zombie spawn and ai to get to "feature complete". That's when beta begins.

However; performance and coincs I'm doing are really starting to weigh in so I'm going to do all this over Thanksgiving break. Hopefully by Monday I will have all of these things worked out in game AND announce that we have entered beta testing.

Wish me luck, I'm going in...

  • Like 1
Link to comment
Share on other sites

EVERYTHINGS IS BROKEN! HAHAaaa!

 

Redid ALL graphics properly this time, re did all code that relies on on graphcs fixed a bunch of stuff BEFORE doing that.

And now it's all broken. :)

Which was to be expected SOOO everything is going according to the plan we dont have!

Taking the rest of the day and tomorrow off during my time off to NOT WORK ON THIS. At all. :) Back in action Saturday.

Happy Thanksgiving to everyone applicable.

 

Be safe, be happy. Have fun.

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

OK, now that I have this straightened out it's time to fix everything...

32,112,111,119,139-142: BLANK COLOR: N/A Color Sets: N/A
33-47:W,G,Z,I,i,+,J,C,K,Q,U,L,F,H COLOR: 12* Color Sets: 1, 2
48-57: NUMBERS 0-9 COLOR: 12* Color Sets: 3, 4
58-74:M,V,A,Y,v,w,X,T,O,Q,G,B,P,R,E,S,N COLOR: 12* Color Sets: 4, 5, 6
75-77: SCORE CHAR  COLOR: 12 Color Sets: 6
78-79:Level CHAR.  COLOR: 12 Color Sets: 6
80-89:*, ~, MELEE ATTACK, BULLET, :, &, (, ), =, .CLR: 12*6 Color Sets: 7, 8
90:HEART.  COLOR: 7 Color Sets: 8
91:MELEE WEAPON.  COLOR: 8  Color Sets: 8
92:RANGED WEAPON. COLOR: 8 Color Sets: 8
93:BAD GIRDER.  COLOR: 15 Color Sets: 8
94:GIRDER.  COLOR: 15* Color Sets: 8
95:THE HOLE.  ASSIGNED VARIABLE HCLR COLOR: 15 Color Sets: 8
96:ZOMBIE.  COLOR: 4 Color Sets: 9
97-98: Zombie run left COLOR: 4 Color Sets: 9
99-100: Zombie run right COLOR: 4 Color Sets: 9
101-102&103:Zombie crawler&ZCrawler Idle COLOR: 13 Color Sets: 9
104:PLAYER IDLE COLOR: 6 Color Sets: 10
105-110:PLAYER RUN RIGHT COLOR: 6 Color Sets: 10
113-118:PLAYER RUN LEFT COLOR: 6 Color Sets: 11
120-127:PLAYER STOP,JUMP,LAND RIGHT COLOR: 6 Color Sets: 12
128-135:PLAYER STOP,JUMP,LAND LEFT COLOR: 6 Color Sets: 13
136: pLAYER MELEE ATTACK COLOR: 6 Color Sets: 14
137-138:PLAYER RANGED ATTACK LEFT AND RIGHT. COLOR: 6 Color Sets: 14
143:THE EXIT.  COLOR: 10* Color Sets: 14
*USE CALL COLOR - THE REST ARE SPRITES AND GET ASSIGNED UPON CREATION.

 

  • Like 2
Link to comment
Share on other sites

Everything is fixed. :)

I will most likely upload a new Alpha version today.

I have 3 things I want to accomplish before I go beta.

1. Crawler Zombie. - Need AI and level enable (level 50 down)

2. Bonus level every 10 levels (treasure room, rewarding challenge, etc..) - I just have to control loot distribution every 10 levels.

3. Final level showdown. (currently cycles back up from zero to infinity)

Getting all the character codes in line required a ton of work since it broken just about every aspect of the game. A lot of it relies on character codes to identify items in coinc, frames or an animating and specific conditions.

So changing those meant a lot of things were impacted. While fixing all the known issue it would create,

I discovered a lot of previously unknown issues around certain conic incidents that could crash the game if certain other conditions were being met.

For example, jumping (holding the jump button) while a zombie was coinc with anything else would crash the game with a NEXT without FOR error that didn't really exist. A lot of inception errors like gosubs leading to gosubs that lead back via gosubs.

And of course a slew of typos.

Anywho. so much has been rewritten in to code, I'm really excited to have it as cleaned up and solid as it is. This version may not seem like much compared to the previous version, but under the hood, a lot of it has changed since the last version.

Anyway, back to work before I have to go outside and fire up the forge. The boy and I are looking to melt down aluminum in to ingots for later use.

Link to comment
Share on other sites

New version 0.48 alpha available >>>HERE<<<!!!

 

V0.48 changes:

Title and Instruction screens, move joystick to continue as well as hitting enter (for easy use on real consoles)
Rewrote instructions for ranged.
Changed girder graphics.
Zeds at level 50 will fall to lower level as player descends.
A lot more comments being added to source code.
Fixed YAD screen goes to high score and not reset game.
Fixed animation issues.
Reassign charcodes to optimize animation performance.
This broke everything and required going through all
lines of code with a fine toothed comb. Which revealed
many other bugs in the code that went undiscovered until
now. Too many bug fixes to list when everything breaks.
All items are now re-coded and fixed.
This is a huge release as there was a lot of things fixed, changed and optimized. The issue of the game slowing to a crawl with too many zombies is waiting for me to go beta.

I want to get at least these 3 things in game and functional before I enter beta testing and optimizing.

1. Crawler Zombie. - Need AI and level enable (level 50 down)

2. Bonus level every 10 levels (treasure room, rewarding challenge, etc..) - I just have to control loot distribution every 10 levels.

3. Final level showdown. (currently cycles back up from zero to infinity)

Edited by Sinphaltimus
Link to comment
Share on other sites

Sounds as if you've got the upper hand now. :)

 

 

I guess that's then by design. Usually that was something you wrote in the instructions when XB wouldn't catch all the collisions. ;)

OK, I got it nailed. The deal is this.

 

By design - bullets do zero damage at 4 spaces or less.

Not by Design until now. - Sometimes, at a distance (seemed random) bullets would miss. However, I noticed from the opposite side of the screen, they would miss zombies a lot more.

Bug discovered - My bullet animation code is accelerating the bullet over time. At some point towards the far end of the screen, it is moving too fast for coinc to happen within the detection threshold.

Not going to fix - I can of course make one simple change to the bullet speed by setting XB=BS instead of XB=XB+BS (XB = bullet x position, BS=bullet speed)

But I don't want to. I think it's a good feature. There is a sweet spot to kill a zombie for certain, beyond that it's hit or miss instead of every single bullet being a hit all the time.

 

Bug in code becomes feature. :)

 

PS - I don't actually leave bugs in and call them features. I figure them out and eliminate them or use them. Here's another example. There is a bug where a loot item may register too many times (more than once, up to 8 I counted so far) before disappearing. It doesn't make sense because the code is correct, but I'm pretty sure I have another inception thing going on where a gosub is leading to a gosub that leads back to the original gosub. And this is causing the multiple registers of loot at seemingly random times. As soon as I figure that out, I'm going to fix it, then use it as a game feature where some loot will indeed give you more than one collection. As a small random bonus through out the game. But I have to fix it first because I don't know if the cause is having adverse effects on the rest of the game and well, I don't like buggy software let alone making it. So by v1.0 it will be as bug free as I can tell.

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

Sick day, can't sleep, so I thought I'd poke around at 0.49.

Not too shabby at this point in the game.

The first "Size" is simply after loading the program.
The second "Size" is after running the running the game Object file.

First:post-47352-0-90679300-1480526910_thumb.png

 

 

 

Second:post-47352-0-51587900-1480526909_thumb.png

 

 

 

And as a sneak peak on progress before beta...

COMING SOON IN VERSION 0.49!

More code optimizations resulting in slightly better performance.
More source code comments.
Removed looting delay for all items.
Adjusted jump delay to discourage jump abuse.
Increased player running speed by 1 (doubling it).
Adjusted Zombie hole collision turn around distance.
Found and removed zombi random speed change at every cycle. This code was supposed to only be present when a Zombi is created
and when a Zombi hits a hole to turn around or fall. Cleaning this up helped boost performance a bit.
Fixed Melee attack animation frame issue.
Added framework for new collision detection routines with the purpose of greatly improving game performance.

Version 0.49 source for code review - not usable without zombits2-m file for merging.


 

// NOTES: MUST BE MERGED WITH ZOMBITS-M IN EXTENDED BASIC THEN UNREMARK LINES 100 AND 1090. MUST BE LOADED WITH XB256 RUNNING IF YOU PLAN T RUN IT IN XB.
//FOR MORE SIDE NOTES AND REFERENCE SCROLL TO BOTTOM.
 
_START:
 
! GOSUB 30000 //GFX AND TITLE SCREENS *ALSO EDIT THE GOSUB RIGHT AFTER _DEAD (APROX L1090)
 
_GAMESTART:
 
SCORE=5 :: HEALTH=5 :: BOARD=99 :: MELEE=5 :: RANGED=5 :: BULL=1 :: MAXHEALTH=10 :: MAXZHELTH=4
ZEDPERC=20 :: ZEDSTEPL=0 :: ZEDSETPR=0 :: JDELAY = 8 :: MAXMELEE=10 :: MAXRANGED=10
ATDELAY=10 :: ZSS=3 //ZED ATTACK DELAY, ZED MAX SPEED
_NEWBOARD:
RANDOMIZE
SLOT=10
OPTION BASE 1
DIM LO0T(2,14) //Array to store sprite number and char code for all 14 loot items spawned.
DIM HART(1,14) //ARRAY TO STORE sprite number for all HEART items spawned.
DIM RANG(1,14) //ARRAY TO STORE sprite number for all RANGED items spawned.
DIM MELE(1,14) //ARRAY TO STORE sprite number for all MELEE items spawned.
DIM ZEDZ(14,6) //Array to store Zed Sprite Number, Zed hole number, zed direction, zed speed, zed health, zed active
LTN=1 :: LAB=1 :: SHL=2 :: GRND=17 :: ZHELTH=4 :: YP=9 :: XP=8 :: PD=1 :: PS=2 //Loot Number, Loot Label, Ground, Zombi Health, Player Y pos, player x pos, Player direction, player speed
JMP=0 :: ZOMBEZ=0 :: ZEDDIR=1 :: HCLR=1 :: TYMER=BOARD*2 //Jumping status, zombi count, zombi direction, hole color
RLUT=1 :: MLUT=1 :: HLUT=1 //FOR _LDS ARRAY POPULATION OF LOOT.
GOSUB _CREATELEVEL
GOTO _SPIDLE
_CREATELEVEL:
CALL COLOR(1,12,1,2,12,1,3,12,1,4,12,1,5,12,1,6,12,1,7,12,1,8,15,1,14,10,1)  :: CALL CLEAR :: CALL SCREEN(2)
GOSUB _GUI
HLE=INT((RND*15)+5) :: FOR LVL=1 TO 8 :: IF LVL<>1 THEN _GSLDS ELSE _910 //HLE = HOLE COORDINATE IN X PER LEVEL. WE SKIP LOOT DISTRIBUTION ON LEVEL 1
_GSLDS:
GOSUB _LDS
_910:
CALL VCHAR(1,1,94,24) :: CALL VCHAR(1,32,94,24) :: CALL HCHAR(LVL*3,1,94,HLE-1)//LEFT WALL, RIGHT WALL, LEFT SIDE OF HOLE FLOOR
IF LVL=8 THEN _920 ELSE _915 //LAST LEVEL WE HAVE TO HIDE HOLE SO USER EXITS AT DOOR
_915:
CALL SPRITE(#SHL,95,HCLR,GRND-7,(HLE*+1) :: SHL=SHL+1 //SHL = SPRITE NUMBER FOR HOLE 2 AT START OF BOARD - HERE WE MAKE BLACK HOLES
NHLE=INT(GRND/8)
CALL HCHAR(NHLE+1,HLE+1,95) //GRAPHICS TO REPLACE BLACK HOLE.
_920:
LASTHLE=(HLE*+1 :: CALL HCHAR(LVL*3,HLE+3,94,32-(HLE+3)) //LAST HOLE DEFINITION AND LEFT SIDE OF HOLE GROUND.
IF LVL=8 THEN _970 ELSE _921 // IF THIS IS LAST HOLE WE NEED TO TREAT IT DIFFERENTLY SO PLAYER WONT FALL.
_921:
CALL HCHAR(LVL*3,HLE,93) :: CALL HCHAR(LVL*3,HLE+2,93) :: GRND=GRND+24 //FLOOR ON RIGHT SIDE OF HOLE
_940:
HOL=INT((RND*15)+5) //DETERMINES LOCATION OF NEXT HOLE
IF HOL=HLE THEN _940 ELSE _945 //ENSURE NEXT HOLE IS NOT DIRECTLY NDER PREVIOUS ONE. 
_945:
HLE=HOL
_970:
NEXT LVL
FOR EXTX=1 TO 31 STEP 30
FOR EXTY=2 TO 23 STEP 3
CALL HCHAR(EXTY,EXTX,143) //EXITS
NEXT EXTY
NEXT EXTX
CALL HCHAR(24,1,94,31) :: RETURN //CREATE GIRDER
_LDS:
_SIDEZS: //SIDEZ DETERMINES WHAT SIDE OF THE HOLE A PARTICULAR LOOT ITEM WILL APPEAR. NEG#=LEFT POS#=RIGHT
SIDEZ=-40 //START ON LEFT SIDE OF HOLE
FOR REPT=1 TO 2 //ONCE FOR LEFT, ONCE FOR RIGHT SIDE OF HOLE
IF LVL=8 AND ZOMBEZ=0 THEN _DOZED
LDSN=INT(RND*100)+(1+ZEDPERC) //PICK A RANDOM NUMBER FROM 1-100 -- FIRST DISTRIBUTION NUMBER TO DETERMINE 
//HEARTS/ZEDS VS WEAPONS.
IF LDSN<BOARD THEN _MR //IF THE RANDOM NUMBER IS HIGHER THAN THE PERCENTILE (60(LDSV) AT START OF GAME) THEN WEAPONS WIN
// SO GO DETERMINE IF IT IS A MELEE WEAPON OR A RANGED WEAPON (_MR)
_HZL: //LDSN (RANDOMLY SELECTED NUMBER) IS NOT HIGHER THAN THE PERCENTILE THRESHOLD (LDSV)
LDSN=INT(RND*100)+(1+ZEDPERC)
IF LDSN>BOARD THEN _DOZED // NUMBER BY MY ZEDPERCENTAGE INCREASE. IF THIS NEW NUMBER IS GREATER THAN THE CURRENT BOARD (START AT 99 END AT 0)
_DOHART: // THEN GO DO ZED (_DOZED) ELSE DO HEARTS (_DOHART)
HART(1,HLUT)=SLOT :: HLUT=HLUT+1
CALL SPRITE(#SLOT,90,7,GRND-9,((HLE+1)*+SIDEZ) :: SLOT=SLOT+1
LO0T(LAB,LTN)=90 :: LAB=LAB+1 :: LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1
GOTO _NEXLDS
 
_DOZED:
IF BOARD>=51 THEN _NOUPZHELTH
ZSS=4
_NOUPZHELTH:
CALL SPRITE(#SLOT,96,4,GRND-8,((HLE+1)*+SIDEZ)
//ZED TABLE POPULATION PER LEVEL 
ZHELTH=MAXZHELTH
ZOMBEZ=ZOMBEZ+1
ZEDZ(ZOMBEZ,1)=SLOT
ZEDZ(ZOMBEZ,2)=((HLE+1)*
ZS=INT((RND*ZSS)+1) //SETS RANDOM ZED SPEED
ZEDZ(ZOMBEZ,4)=ZS
ZEDZ(ZOMBEZ,5)=ZHELTH
ZEDZ(ZOMBEZ,6)=1
SLOT=SLOT+1
LO0T(LAB,LTN)=96 :: LAB=LAB+1 :: LO0T(LAB,LTN)=SLOT-1 :: LAB=1  :: LTN=LTN+1
IF BOARD>33 THEN _NEXLDS
GOSUB _CREATECRAWLER
GOTO _NEXLDS
 
_MR:
LDSN=INT(RND*100)+1 
LDSN=LDSN+ZEDPERC //REGENERATE A RANDOM NUMBER TO DETERMINE RANGE OR MELEE WEAPON SPAWN.
IF LDSN<BOARD THEN _DORAN //IF THE NUMBER IS GREATER THAN LDSV (60 PERCENT AT BOARD99) THEN DO RANGED (_DORAN) ELSE DO MELEE (_DOMEL)
 
_DOMEL:
MELE(1,MLUT)=SLOT :: MLUT=MLUT+1
CALL SPRITE(#SLOT,91,8,GRND-9,((HLE+1)*+SIDEZ) :: SLOT=SLOT+1 :: LO0T(LAB,LTN)=91 :: LAB=LAB+1 :: LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1
GOTO _NEXLDS
 
_DORAN:
RANG(1,RLUT)=SLOT :: RLUT=RLUT+1
CALL SPRITE(#SLOT,92,14,GRND-9,((HLE+1)*+SIDEZ) :: SLOT=SLOT+1 :: LO0T(LAB,LTN)=92 :: LAB=LAB+1 :: LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1
 
_NEXLDS:
SIDEZ=40 :: NEXT REPT //DONE WITH LEFT SIDE LOOT, BO BACK AND DO RIGHT SIDE OF HOLE.
RETURN
_CREATECRAWLER:
//CREATE THE CRAWLEER AT THE EXIT. LOCATE A HEART IF ANY, GO FOR IT IN THE AI. IF NO HEART GO FOR THE PLAYER IN THE AI.
RETURN
_GUI: ////OUTPUT GUI
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
CALL VCHAR(1,3,75) :: CALL VCHAR(1,4,76) :: CALL VCHAR(1,5,77) :: CALL VCHAR(1,12,79) :: CALL VCHAR(1,17,64) :: CALL VCHAR(1,23,64)
CALL VCHAR(1,28,64) :: CALL VCHAR(1,11,78) :: CALL VCHAR(1,16,90) :: CALL VCHAR(1,22,91) :: CALL VCHAR(1,27,92) ::RETURN
_BOARDPROG:
IF BOARD<=20 THEN _ZPA //I lower the zed spawn percentile sincxe the chances are very high anyway.
_MHC:
IF BOARD<=75 THEN _MXHLT //Power up max health for player
_MRC:
IF BOARD<=50 THEN _MXRNG //power up max range for player
_MMC:
IF BOARD<=25 THEN _MXMEL  ELSE _BPC //power up max melee for player
_ZPA:
ZEDPERC=0 :: GOTO _MHC
_MXHLT:
MAXHEALTH=20 :: GOTO _MRC
_MXRNG:
MAXRANGED=20 :: MAXZHELTH=6 :: GOTO _MMC
_MXMEL:
MAXMELEE=20 
_BPC:
CALL DELSPRITE(ALL) :: BOARD=BOARD-1 :: IF SCORE>HSCORE THEN _HSCOR ELSE _DSPLAYHS
_HSCOR:
HSCORE=SCORE
_DSPLAYHS:
CALL SCREEN(2) :: FOR CCLOR=0 TO 14 :: CALL COLOR(CCLOR,16,1) :: NEXT CCLOR :: HCLR=2 :: CALL CLEAR
CALL VCHAR(11,12,47) :: CALL VCHAR(11,13,36) :: CALL VCHAR(11,14,34) :: CALL VCHAR(11,15,47)
CALL VCHAR(11,16,73) :: CALL VCHAR(11,17,40) :: CALL VCHAR(11,18,66) :: CALL VCHAR(11,19,71)
CALL VCHAR(11,20,72) :: DISPLAY AT(12,13):HSCORE
CALL LINK("DELAY",200)
_HOLDHS:
CALL KEY(1,K,S) :: IF S=0 THEN _HOLDHS
GOTO _NEWBOARD
_EXITCHK: 
IF YP=177 AND XP>=235 THEN _BOARDPROG ELSE _GORET
_DEAD:
CALL SCREEN(10) :: CALL CLEAR :: CALL DELSPRITE(ALL)
! GOSUB 30270
FOR CCLOR=0 TO 14 :: CALL COLOR(CCLOR,16,10) :: NEXT CCLOR
DISPLAY AT(7,13):HSCORE :: DISPLAY AT(21,13):SCORE
CALL SCREEN(2) :: CALL LINK("DELAY",200)
_YADINPUT:
CALL KEY(1,K,S) :: CALL JOYST(1,X,Y) :: IF K<>-1 OR S<>0 OR X<>0 OR Y<>0 THEN _NEWGAME 
GOTO _YADINPUT
_NEWGAME:
CALL DELSPRITE(ALL) :: GOTO _GAMESTART
 
_RESET:
CALL DELSPRITE(ALL) :: GOTO _START
_QUIT:
CALL CLEAR :: END :: RETURN
 
_SPIDLE:
CALL SPRITE(#1,104,6,YP,XP) :: GOSUB _COLDETROU :: GOSUB _ZEDAI
TYMER=TYMER-1 :: IF TYMER<=0 THEN _SCOREPENALTY ELSE _JOYCHK
_SCOREPENALTY:
CALL SOUND(100,110,15) :: SCORE=SCORE-1 ::  TYMER=BOARD*2 ::  GOSUB _GUI :: IF SCORE<=0 THEN _HEALTHPENALTY ELSE _JOYCHK
_HEALTHPENALTY:
SCORE=0 :: CALL SOUND(100,110,0,1200,0,2300,0) :: HEALTH=HEALTH-1 ::   TYMER=BOARD*2
GOSUB _GUI
IF HEALTH<=0 THEN _DEAD
_JOYCHK:
CALL JOYST(1,JX,JY) :: CALL KEY(1,K,S) :: IF K=0 AND S=-1 THEN _QUIT
IF K=16 THEN _BOARDPROG //DEVELOPER CHEAT TO TEST _LDS
IF K=6 THEN _RESET // :: IF K=3 THEN GOSUB _DEBUGGER
IF K=18 OR K=74 OR K=106 THEN _GSJMP 
IF JX<>0 OR JY<>0 THEN _JOYACTION ELSE _SPIDLE
_GSJMP: 
JMP=1 :: GOSUB _JUMP :: JMP=0 :: GOTO _JOYACTION 
 
_JOYACTION:
IF JY=0 THEN _MOVEIT ELSE _ATTACKIT
_ATTACKIT:
GOSUB _COMBAT
_MOVEIT:
GOSUB _COLDETROU :: GOSUB _ZEDAI
CALL KEY(1,K,S) :: IF K=16 THEN _BOARDPROG
IF K=18 OR K=74 OR K=106 THEN _JUMPER ELSE _JOYST
_JUMPER:
JMP=1 :: GOSUB _JUMP
JMP=0 // :: IF K=3 THEN GOSUB _DEBUGGER
 
_JOYST:
IF JX<>0 THEN _SPRUN
IF JY<>0 THEN _GSCBT ELSE _CONT
_GSCBT:
GOSUB _COMBAT
_CONT:
GOTO _SPIDLE
_SPRUN:
IF JX=-4 THEN _CHCKL ELSE _CHCKR
_CHCKL:
GOSUB _SPLEFT
_CHCKR:
IF JX=4 THEN _GSSPR ELSE _SPIDLE
_GSSPR:
GOSUB _SPRIGHT
GOTO _SPIDLE
_SPRIGHT:
IF XP>=250 THEN _FLIPL ELSE _RUNR
_FLIPL:
XP=2
_RUNR:
PD=1 :: CALL SPRITE(#1,105,6,YP,XP)
FOR PAT=105 TO 110 :: CALL PATTERN(#1,PAT) :: CALL SOUND(1,-2,20) :: XP=XP+PS
IF XP>=250 THEN _FLIPL2 ELSE _MOVEIT2
_FLIPL2:
XP=2
_MOVEIT2: 
CALL LOCATE(#1,YP,XP) :: CALL KEY(1,K,S) :: IF K=16 THEN _BOARDPROG // :: IF K=3 THEN GOSUB _DEBUGGER
IF K=18 OR K=74 OR K=106 THEN _GOJMP ELSE _NOGOJMP 
_GOJMP:
JMP=1 :: PAT=110 :: GOTO _650
_NOGOJMP:
GOSUB _COLDETROU :: GOSUB _ZEDAI
CALL JOYST(1,JX,JY) :: IF JY=0 THEN _610 ELSE _GOSCOM1
_GOSCOM1:
GOSUB _COMBAT
_610:
IF JX<>0 THEN _630
CALL SPRITE(#1,104,6,YP,XP) :: RETURN
_630:
IF JX=4 THEN _650
IF JX=-4 THEN _635 ELSE _650
_635:
RETURN
_650:
NEXT PAT
IF JMP=1 THEN _670 ELSE _680
_670:
GOSUB _JUMP ::JMP=0
_680: 
IF JX=4 THEN _SPRIGHT ELSE _GORET 
_SPLEFT:
IF XP<=1 THEN _685 ELSE _686
_685:
XP=249
_686:
PD=-1 :: CALL SPRITE(#1,113,6,YP,XP)
FOR PAT=113 TO 118 :: CALL PATTERN(#1,PAT) :: CALL SOUND(1,-2,20) :: XP=XP-PS
IF XP<=1 THEN _690 ELSE _700
_690:
XP=249
_700:
CALL LOCATE(#1,YP,XP) :: CALL KEY(1,K,S)// :: IF K=3 THEN GOSUB _DEBUGGER
IF K=16 THEN _BOARDPROG //DEVELOPER CHEAT TO TEST _LDS
IF K=18 THEN _720
IF K=74 THEN _720
IF K=106 THEN _720 ELSE _732
_720:
JMP=1 :: PAT=118 :: GOTO _820
_732:
GOSUB _COLDETROU :: GOSUB _ZEDAI
CALL JOYST(1,JX,JY) :: IF JY=0 THEN _780 ELSE _GOSCOM2
_GOSCOM2:
GOSUB _COMBAT
_780:
IF JX<>0 THEN _800
CALL SPRITE(#1,44,6,YP,XP) :: RETURN
_800:
IF JX=-4 THEN _820
IF JX=4 THEN _810 ELSE _820
_810:
RETURN
_820: 
NEXT PAT
IF JMP=1 THEN _840 ELSE _850
_840:
GOSUB _JUMP :: JMP=0
_850:
IF JX=-4 THEN _SPLEFT
RETURN
_JUMP:
//// ********JUMP ROUTINE CHECK********
IF PD<>-1 THEN _5710
S1=128 :: J1=131 :: L1=134 :: JSND=18 :: S2=130 :: J2=133 :: L2=135 :: JMPDIS=-7//JUMPLEFT
GOTO _5750
_5710:
IF PD<>1 THEN _GORET
S1=120 :: J1=123 :: L1=126 :: JSND=10 :: S2=122 :: J2=125 :: L2=127 :: JMPDIS=7 //JUMP RIGHT
_5750:
CALL LOCATE(#1,YP,XP)  //FROM RUNNING TO STOPPING LEFT
FOR PTS=S1 TO S2 :: CALL SOUND(1,(PTS-JSND),5) :: CALL PATTERN(#1,PTS) :: NEXT PTS
FOR UDELAY=1 TO JDELAY :: GOSUB _ZEDAI :: NEXT UDELAY
YP=YP-3 :: CALL LOCATE(#1,YP,XP)
FOR PTJ=J1 TO J2  //JUMP (JUMPING)
XP=XP+JMPDIS
IF XP<=1 THEN _CREATEPLAYERRIGHT ELSE _CHECKPLAYERRIGHT
_CREATEPLAYERRIGHT:
XP=248 :: GOTO _NOMOREEDGES
_CHECKPLAYERRIGHT:
IF XP>=249 THEN _CREATEPLAYERLEFT ELSE _NOMOREEDGES
_CREATEPLAYERLEFT:
XP=2
_NOMOREEDGES:
CALL PATTERN(#1,PTJ) :: CALL SOUND(1,(PTJ-JSND),5) :: CALL LOCATE(#1,YP,XP) :: GOSUB _ZEDAI :: NEXT PTJ
YP=YP+3 :: CALL LOCATE(#1,YP,XP) 
FOR PTL=L1 TO L2
IF PTL=L1 THEN _NXTPTL // SKIP THE DELAY UNTIL LAST FRAME
FOR DDELAY=1 TO JDELAY :: CALL PATTERN(#1,L2)  :: GOSUB _ZEDAI :: NEXT DDELAY
 
_NXTPTL:
CALL PATTERN(#1,PTL) :: CALL SOUND(1,(PTL-JSND),5) :: NEXT PTL
CALL COINC(ALL,C) :: IF C<>0 THEN _GSCOLDET ELSE _GORESET
_GSCOLDET:
GOSUB _COLDETROU :: GOSUB _ZEDAI :: RETURN
_GORESET:
ATDELAY=10 :: RETURN 
_COMBAT:
////*****JOYS COMBAT CHOICE*****
IF JY=4 AND MELEE>=1 THEN _5360 :: IF JY=4 AND MELEE<=0 THEN _5350
IF JY=-4 THEN _5330 ELSE _GORET
_5330:
GOSUB _ATTACKR :: RETURN
_5350:
CALL SOUND(100,-3,0) :: RETURN
_5360:
MELEE=MELEE-1 :: GOSUB _GUI
GOSUB _ATTACKM :: RETURN
IF JY=-4 THEN _5400 ELSE _5405
_5405:
CALL SOUND(100,-6,0) :: RETURN
_5400:
GOSUB _ATTACKR :: RETURN
_ATTACKM:
CALL PATTERN(#1,136) 
IF XP+8>=250 THEN _S2OTHER1 
CALL SPRITE(#24,82,12,YP,XP+ ::  GOTO _S2SOWND
_S2OTHER1:
CALL SPRITE(#24,82,12,YP,XP)
_S2SOWND:
CALL SOUND(125,-5,0)
GOSUB _MELCOLLOO
IF XP+8>=250 THEN _S2OTHER2 //SKIP TO SOUND
CALL DELSPRITE(#24) :: IF XP-8<=1 THEN _S2OTHER2
CALL SPRITE(#25,82,12,YP,XP- :: GOTO _S2SOWND2
_S2OTHER2:
CALL SPRITE(#25,82,12,YP,XP)
_S2SOWND2:
CALL SOUND(125,-6,0)
GOSUB _COLCKM2
CALL DELSPRITE(#25) :: CALL PATTERN(#1,136) :: CALL COLOR(#DET,4)
RETURN
_MELCOLLOO:
FOR DET=10 TO 23 :: CALL COINC(#24,#DET,7,C) :: IF C<>0 THEN _5470
NEXT DET :: RETURN
_COLCKM2:
FOR DET=10 TO 23 :: CALL COINC(#25,#DET,7,C) :: IF C<>0 THEN _5470
NEXT DET :: RETURN
_5470:
TLOOP1=DET-9
_5490:
IF LO0T(1,TLOOP1)<>96 THEN _LOOTCOL //NOT A ZED HIT
_ZOMBIEHITMELEE: //WHAT ZOMBIE IS HIT? 
CALL COLOR(#DET,7) :: LSPRN=LO0T(2,TLOOP1) //GETS SPRITE NUMBER OF LOOT HIT TO CHECK
FOR ZCHEK=1 TO 14 //NEED TO FIND ZOMBIE IN ZOMBIE ARRAY FOR STATS
ZPRN=ZEDZ(ZCHEK,1)
IF LSPRN<>ZPRN THEN _NXZCK
ZHELTH=ZEDZ(ZCHEK,5) //GET ZOMBIE CURRENT HEALTH
ZHELTH=ZHELTH-1 // HEALTH PENALTY TO ZED FOR MELEE HIT.
ZEDZ(ZCHEK,5)=ZHELTH //STORE ZOMBIE NEW HEALTH
IF ZHELTH>=1 THEN _GORET // :: IF ZOMBIE STILL STANDING END THE ATTACK ROUND OR ELSE KILL IT.
SCORE=SCORE+15 :: ZEDZ(ZCHEK,6)=0 :: CALL DELSPRITE(#LSPRN) :: ZOMBEZ=ZOMBEZ-1 :: RETURN
_NXZCK:
NEXT ZCHEK
RETURN
_LOOTCOL: //OTHER THAN ZED LOOT HIT BY MELEE
IF LO0T(1,TLOOP1)<>90 THEN _5540 ELSE _5560
_5540:
IF LO0T(1,TLOOP1)<>91 THEN _5550 ELSE _5560
_5550:
IF LO0T(1,TLOOP1)<>92 THEN _GORET
_5560:
FOR LCHEK=1 TO 14 :: IF DET=LO0T(LCHEK,2) THEN _WRLC5 ELSE _NXTLCHEK4
_WRLC5:
LCHEK=14 
_NXTLCHEK4:
NEXT LCHEK :: CALL DELSPRITE(#DET)
_5570:
RETURN 
_ATTACKR:
IF RANGED<=0 THEN _CLSND ELSE _3570
_CLSND:
CALL SOUND(100,-3,0) :: RETURN 
_3570:
RANGED=RANGED-1 :: CALL SOUND(100,-6,0) :: GOSUB _GUI
YB=YP
//*********************************SHOOT RIGHT
IF PD<>1 THEN _4210
CALL PATTERN(#1,138)
BULL=1
XB=XP+32
GOTO _BULFIRE
//*********************************SHOOT LEFT
_4210:
IF PD<>-1 THEN _GORET
CALL PATTERN(#1,137)
BULL=-1
XB=XP-32 
//*********************************BULLET FIRE RIGHT
_BULFIRE:
_4910:
CALL SPRITE(#26,83,6,YB,XB)
CALL COINC(ALL,C) :: IF C<>0 THEN _BULHIT
_BULLCONT:
XB=XB+BULL :: IF XB<=2 OR XB>=249 THEN _ATTACKEND ELSE _4910 
_BULHIT:  //WHAT DID THE BULLET HIT?
CALL LOCATE(#26,YB,XB) 
FOR LCHECK=1 TO 14
LSPRN=LO0T(2,LCHECK)  //GETS SPRITE NUMBER OF LOOT HIT TO CHECK
LCHKB=LO0T(1,LCHECK)  //GETS CHARCODE OF LOOT HIT TO CHECK
_BUHOCK: //BULLET HOLE CHECK
IF LSPRN<=9 OR LSPRN>=24 THEN _GSBULCON ELSE _CONLC  //MAKE SURE IT IS A PROPER LOOT HIT AND NOT A HOLE HIT.
_GSBULCON:  // THIS IS MEANT TO SPEED UP THE BULLET WHEN IN COTACT WITH A HOLE SPRITE INSTEAD OF _BULLCONT
XB=XB+BULL :: CALL LOCATE(#26,YB,XB) :: CALL COINC(#26,#LSPRN,8,C) :: IF C<>0 THEN _BUHOCK
_CONLC: //CONTINUE LOOT CHECK (NOT A HOLE)
CALL COINC(#26,#LSPRN,8,C)  //CHECK FOR COLLISION WITH SAID LOOT.
IF C=0 THEN _NEXTCOLCHECKLB  // NO COLLISION BETWEEN THIS GUY AND THE NEXT.
IF LCHKB=96 THEN _ZOMBIEHIT ELSE _LOOTHIT  //IF IT EQUALS A ZOMBIE, GOTO ZOMBIE HIT
_ZOMBIEHIT:  //WHAT ZOMBIE IS HIT? 
CALL COLOR(#LSPRN,7)
FOR ZCHEK=1 TO 14  //NEED TO FIND ZOMBIE IN ZOMBIE ARRAY FOR STATS
AZED=ZEDZ(ZCHEK,6)
IF AZED=0 THEN _NXTZCHEK
ZPRN=ZEDZ(ZCHEK,1)
IF LSPRN<>ZPRN THEN _NXTZCHEK
ZHELTH=ZEDZ(ZCHEK,5)  //GET ZOMBIE CURRENT HEALTH
ZHELTH=ZHELTH-2  // HEALTH PENALTY TO ZED FOR BULLET HIT.
ZEDZ(ZCHEK,5)=ZHELTH  //STORE ZOMBIE NEW HEALTH
IF ZHELTH>=1 THEN _ATTACKEND  // :: IF ZOMBIE STILL STANDING END THE ATTACK ROUND OR ELSE KILL IT.
SCORE=SCORE+15 :: ZEDZ(ZCHEK,6)=0 :: CALL DELSPRITE(#LSPRN) :: ZOMBEZ=ZOMBEZ-1 :: GOTO _ATTACKEND
_LOOTHIT:  //DESTROY HIT LOOT 
CALL COLOR(#LSPRN,7)
CALL DELSPRITE(#LSPRN) :: LO0T(2,LCHECK)=1 :: GOTO _ATTACKEND
_NXTZCHEK:
NEXT ZCHEK :: GOTO _ATTACKEND
_NEXTCOLCHECKLB:
NEXT LCHECK :: GOTO _BULLCONT
_ATTACKEND:  // ATTACK RANGED AGAIN OR END *********************
CALL DELSPRITE(#26)
GOSUB _GUI :: CALL JOYST(1,JX,JY) :: IF JY=0 THEN _GORET
IF JY-4 THEN _GSATTR ELSE _GORET
_GSATTR:
GOSUB _ATTACKR :: RETURN
_COLDETROU:  //COLLISION DETECTION ROUTINES
FOR PCC=2 TO 23
 
CALL COINC(#1,#PCC,10,C) :: IF C<>0 THEN _CONCOLDET
NEXT PCC
RETURN
_CONCOLDET:
RLOOP=1 :: LLOOP=1
IF YP=9 THEN _YP9
IF YP=33 THEN _YP33
IF YP=57 THEN _YP57
IF YP=81 THEN _YP81
IF YP=105 THEN _YP105
IF YP=129 THEN _YP129
IF YP=153 THEN _YP153
IF YP=177 THEN _YP177
_YP9:
LDET=2 :: RDET=2 :: GOTO _BOTLVL
_YP33:
LDET=10 :: RDET=11 :: GOTO _BOTLVL
_YP57:
LDET=12 :: RDET=13 :: GOTO _BOTLVL
_YP81:
LDET=14 :: RDET=15 :: GOTO _BOTLVL
_YP105:
LDET=16 :: RDET=17 :: GOTO _BOTLVL
_YP129:
LDET=18 :: RDET=19 :: GOTO _BOTLVL
_YP153:
LDET=20 :: RDET=21 :: GOTO _BOTLVL
_YP177:
LDET=22 :: RDET=23 :: GOTO _COLDETS
_BOTLVL: 
//THERE ARE 7 HOLES TO CHECK AGAINST.
FOR HDET=2 TO 8 
CALL COINC(#1,#HDET,10,C)
IF C=0 THEN _NXHDT
FOR FALLIN=1 TO 12 :: YP=YP+2 :: CALL SOUND(1,666-(FALLIN*10),5) :: CALL SPRITE(#1,104,6,YP,XP) ::  GOSUB _ZEDAI :: NEXT FALLIN :: RETURN
_NXHDT:
NEXT HDET
//ARE THE COLLISION DETECTIONS OCCURING ON THE LEFT SIDE OF THE HOLE OR THE RIGHT?
_COLDETS:
CALL COINC(#1,#LDET,10,C)
IF C<>0 THEN _LEFDET
CALL COINC(#1,#RDET,10,C)
IF C<>0 THEN _RIGDET
RETURN
//COLLISION DETECTION HAPPENS ON LEFT - WHAT IS IT?
//A HEART?
_LEFDET: 
RLOOP=0 :: LLOOP=LDET-9
IF LO0T(1,LLOOP)<>90 THEN _LEFCHKMEL ELSE _COLHEART
//A MELEE WEAPON?
_LEFCHKMEL:
IF LO0T(1,LLOOP)<>91 THEN _LEFCHKRAN ELSE _COLMELE
//OR A RANGED WEAPON?
_LEFCHKRAN:
IF LO0T(1,LLOOP)=92 THEN _COLRANG
GOSUB _ZEDAI
_GORET:
RETURN
//COLLISION DETECTION HAPPENS ON RIGHT - WHAT IS IT?
//A HEART?
_RIGDET:
LLOOP=0 :: RLOOP=RDET-9
IF LO0T(1,RLOOP)<>90 THEN _RIGCHKMEL ELSE _COLHEART
_RIGCHKMEL:
IF LO0T(1,RLOOP)<>91 THEN _RIGCHKRAN ELSE _COLMELE
_RIGCHKRAN:
IF LO0T(1,RLOOP)=92 THEN _COLRANG
GOSUB _ZEDAI :: RETURN
_COLRANG:
SCORE=SCORE+5 :: IF RANGED<MAXRANGED THEN _CRAN ELSE _CONCRAN
_CRAN:
RANGED=RANGED+1
_CONCRAN:
CALL SOUND(1,1000,5) :: CALL SOUND(1,1200,2) :: GOSUB _GUI
IF LLOOP=0 THEN _3021
IF RLOOP=0 THEN _3020
_COLMELE:
SCORE=SCORE+3 :: IF MELEE<MAXMELEE THEN _COLM ELSE _CONCOLM
_COLM:
MELEE=MELEE+1
_CONCOLM:
CALL SOUND(1,1500,5) :: CALL SOUND(1,1600,2) :: GOSUB _GUI
IF LLOOP=0 THEN _3021
IF RLOOP=0 THEN _3020
_COLHEART:
SCORE=SCORE+10 :: CALL SOUND(1,500,5) :: CALL SOUND(1,600,2)
IF HEALTH<MAXHEALTH THEN _GSHEL ELSE _GSGUI2
_GSHEL:
HEALTH=HEALTH+1
_GSGUI2:
GOSUB _GUI
IF LLOOP=0 THEN _3021
IF RLOOP=0 THEN _3020
 
_3020:
IF LDET<>O THEN _3020A ELSE _GORET
_3020A:
CALL DELSPRITE(#LDET) :: RETURN
_3021:
IF RDET<>O THEN _3021A ELSE _GORET
_3021A:
CALL DELSPRITE(#RDET) :: RETURN
_ZEDAI:
GOSUB _CRAWLERAI
_ZEDCC:
IF ZOMBEZ=0 THEN _EXITCHK  //NO NEED TO CHECK ANY ZEDAI IF THERE ARE NO ZEDS
ZS=INT((RND*3)+1)  //RANDOMIZE ZOMBIE SPEED
FOR ZCK=1 TO 14  //UP TO 14 ZEDS POSSIBLE TO CHECK AGAINST
_ZOMB2:
TZEDZ=ZEDZ(ZCK,1) :: ZHOL=ZEDZ(ZCK,2) :: ZEDDIR=ZEDZ(ZCK,3) :: ZS=ZEDZ(ZCK,4) :: AZED=ZEDZ(ZCK,6)//SPRITE NUMBER:NEIGHBORING HOLE X POSITION:DIRECTION:SPEED:ACTIVE OR DEAD
IF AZED=O THEN _DBLCHK ELSE _NODBLCHK  // IF A ZED IS NOT ACTIVE, LET'S FIGURE OUT IF IT WAS KILLED OR THIS IS THE END OF THE LIST OF ZEDS TO CHECK
_DBLCHK:
IF TZEDZ=0 THEN _ALLDONE ELSE _NODBLCHK  // TZEDZ IS A SPRITE NUMBER. IF IT EQUALS 0 THEN IT'S THE END OF THE LIST IN THE ARRAY.
_ALLDONE:
ZCK=14 :: GOTO _NXZK2  //END THE LOOPED ZED CHECK.
_NODBLCHK:
CALL POSITION(#TZEDZ,ZY,ZX)  // THE ONLY POINT TO THIS CALL POSITIN IS TO GET THE XY FOR THIS PARTICULAR ZED STRAIGHT.
IF ZX=XP AND ZY=YP THEN _GSCOLZED ELSE _NOGSCZ  // HAD A BUG WHERE NO COINC WAS BEING DETECTED AND THOUGHT IT MIGHT HAVE TO DO WITH THIS LINE BEING TRUE. SO I FORCE IT.
_GSCOLZED:
GOSUB _COLPLAY
_NOGSCZ:
//*************************************CHECK FOR ZED CHASE LEVEL AND CODE HERE************************
CALL POSITION(#1,YP,XP)
IF BOARD>66 THEN _CONZMOV  //IF LEVEL IS 66 OR LOWER, ENABLE CHASING ZEDS.
IF YP<>ZY AND BOARD >33 THEN _CONZMOV  // IF BOARD >33 AND ZED/PLAYER NOT SAME LEVEL, DO NOT CHASE (CHASE LEVEL 33 DOWN REGARDLESS OF ZED/PLAYER LEVEL)
IF ZX<XP THEN _CHCD  //IF ZED IS LEFT OF PLAYER SET POSITIVE DIR TO CHASE PLAYER else keep going in same direction.
ZEDDIR=-1 :: GOTO _CONZMOV
_CHCD:
ZEDDIR=1
_CONZMOV:
GOSUB _ZEDPATTERN  //UPDATE ANIMATION FRAMES.
IF ZEDDIR=1 THEN _MOVER ELSE _MOVEL  //ADVANCE THE ZED'S MOVEMENT IN THE APPROPRIATE DIRECTION
_MOVER:  //MOVE RIGHT
ZX=ZX+ZS :: IF ZX>=250 THEN _JMPZED1 ELSE _ZEDZCONT //WRAP AROUND FROM RIGHT TO LEFT IF EDGE OF LEVEL REACHED. 
_JMPZED1:  //RESET XP POSTION TO COMPLETE WRAP AROUND
ZX=2 :: GOTO _ZEDZCONT  //CONTINUE ZED ADVANCEMENT
_MOVEL:  //MOVE LEFT
ZX=ZX-ZS :: IF ZX<=1 THEN _JMPZED2 ELSE _ZEDZCONT //WRAP AROUND FROM LEFT TO RIGHT IF EDGE OF LEVEL REACHED.
_JMPZED2:
ZX=249  //RESET XP POSTION TO COMPLETE WRAP AROUND
_ZEDZCONT:  //CONTINUE ZED ADVANCEMENT
CALL LOCATE(#TZEDZ,ZY,ZX)
CALL CHARPAT(97,ZPL1$) :: CALL CHARPAT(98,ZPL2$) //ZP=ZOMBIE PATTERN
CALL CHARPAT(99,ZPR1$) :: CALL CHARPAT(100,ZPR2$)
_ZOMBIE_COLLISION_CHECKS:
IF JMP=1 THEN _NGSPHIT  // IF THE PLAYERIS IN A JUMPING STATE, SKIP COINC WITH PLAYER CHECK = PLAYER DODGES.
IF ZX=XP AND ZY=YP THEN _GSPHIT  //INSURANCE THAT COINC IS PERFOMED WHEN PLAYER AND ZED OVERLAP.
CALL COINC(#TZEDZ,#1,8,C) :: IF C<>0 THEN _GSPHIT ELSE _GORESET2 //CHECK FOR ZED COLLISION WITH PLAYER. IF NO COLLISION, RESET THE ATSPEED COUNTER AND CONTINUE.
_GSPHIT: //CHECK IF PLAYER DODGES FIRST AND OTHER KEYBOARD INPUTS.
CALL KEY(1,K,S) :: IF S=0 THEN _GSCZ :: IF K=0 AND S=-1 THEN _QUIT
IF K=16 THEN _BOARDPROG //DEVELOPER CHEAT TO TEST _LDS
IF K=6 THEN _RESET // :: IF K=3 THEN GOSUB _DEBUGGER
IF K=18 OR K=74 OR K=106 THEN _GSAJMP  //PLAYER DODGES/JUMPS
_GSAJMP: 
JMP=1 :: GOSUB _JUMP :: JMP=0 :: GOTO _GORET
_GSCZ:
GOSUB _COLPLAY  //THERE IS A COINC BETWEEN PLAYER AND ZED
GOTO _NGSPHIT // CHECK FOR COINC BETWEEN ZED AND HOLE
_GORESET2:
ATDELAY=10 //RESET ZOMBIE ATTACK DELAY
_NGSPHIT:
CALL COINC(#TZEDZ,ZY,ZHOL,16,C) :: IF C<>0 THEN _CHDZEDHOL //CHECK ZED VS HOLE
FOR ZCD=10 TO 23 :: IF ZCD=TZEDZ THEN _NXZCD  //NO SELF COINC
CALL COINC(#TZEDZ,#ZCD,8,C) :: IF C<>0 THEN _GSZCR //CHECK ZED VS HEART
_NXZCD:
NEXT ZCD
GOTO _NXZK
_GSZCR:
GOSUB _ZCOLHEART
GOTO _NXZK
_CHDZEDHOL:
ZS=INT((RND*ZSS)+1) :: ZEDZ(ZCK,4)=ZS //SETS RANDOM ZED SPEED
IF ZY=177 THEN _NXZK
CALL PATTERN(#TZEDZ,96)
IF BOARD<=50 AND ZY<YP THEN _GSZFALL ELSE _CZGCC //CHECK FOR FALLING ZED ENABLE ELSE CONTINUE CHECK ZED HOLE COLLISION CHECKS
_GSZFALL:
GOSUB _ZFALL
_CZGCC:
IF ZEDDIR=1 THEN _POSH ELSE _NEGH
_POSH:
ZEDZ(ZCK,3)=-1 :: ZEDDIR=-1 :: CALL LOCATE(#TZEDZ,ZY,ZHOL-16) :: GOSUB _ZEDPATTERN
ZX=ZX-ZS
IF ZX<=1 THEN _JMPZED3 ELSE _ZEDZCONT1
_JMPZED3:
ZX=249
_ZEDZCONT1:
GOTO _NXZK
_NEGH:
ZEDZ(ZCK,3)=1 :: ZEDDIR=1 :: CALL LOCATE(#TZEDZ,ZY,ZHOL+16) :: GOSUB _ZEDPATTERN
ZX=(ZHOL+16)+ZS
IF ZX>=250 THEN _JMPZED4 ELSE _NXZK
_JMPZED4:
ZX=2
_NXZK:
IF ZOMBEZ=0 OR TZEDZ=0 THEN _EXITCHK
CALL LOCATE(#TZEDZ,ZY,ZX)
_NXZK2:
NEXT ZCK :: GOTO _EXITCHK
_COLPLAY:
IF ATDELAY=10 THEN _NOATDELAY
ATDELAY=ATDELAY-1 :: IF ATDELAY>=1 THEN _GORET
ATDELAY=10
_NOATDELAY: 
ATDELAY=ATDELAY-1 :: CALL SOUND(100,-4,0,110,0,1000,0) :: HEALTH=HEALTH-1 :: IF HEALTH<=0 THEN _DEAD ELSE _GSGUI
_GSGUI:
GOSUB _GUI
RETURN
_ZEDPATTERN:
IF ZEDDIR=1 THEN _ZPATR ELSE _ZPATL //FIGURE OUT WHICH DIRECTION THE ZED IS MOVING
_ZPATR:
IF ZEDSTEPR=0 THEN _ZPRSW1 ELSE _ZPRSW2 //FIGURE OUT WHICH ANIMATION FRAME THE ZED IS CURRENTLY ON
_ZPRSW1:
CALL SPRITE(#TZEDZ,100,4,ZY,ZX) :: ZEDSTEPR=1 :: RETURN //CHANGE TO APPROPRIATE PATTERN AND LOCATION, RECALL SPRITE AND CHANGE PATTERN RECORD FOR NEXT CHECK
_ZPRSW2:
CALL SPRITE(#TZEDZ,99,4,ZY,ZX) :: ZEDSTEPR=0 :: RETURN //SAME AS PREVIOUS COMMENT
_ZPATL:
IF ZEDSTEPL=0 THEN _ZPLSW1 ELSE _ZPLSW2 //FIGURE OUT WHICH ANIMATION FRAME THE ZED IS CURRENTLY ON
_ZPLSW1:
CALL SPRITE(#TZEDZ,98,4,ZY,ZX) :: ZEDSTEPL=1 :: RETURN //CHANGE TO APPROPRIATE PATTERN AND LOCATION, RECALL SPRITE AND CHANGE PATTERN RECORD FOR NEXT CHECK
_ZPLSW2:
CALL SPRITE(#TZEDZ,97,4,ZY,ZX) :: ZEDSTEPL=0 :: RETURN //SAME AS PREVIOUS COMMENT
//ZOMBIE COLLISION DETECTION ROUTINES FOR HEARTS
_ZCOLHEART: 
CALL LOCATE(#TZEDZ,ZY,ZX)
RLOOP=1 :: LLOOP=1
IF ZY=9 THEN _ZY9
IF ZY=33 THEN _ZY33
IF ZY=57 THEN _ZY57
IF ZY=81 THEN _ZY81
IF ZY=105 THEN _ZY105
IF ZY=129 THEN _ZY129
IF ZY=153 THEN _ZY153
IF ZY=177 THEN _ZY177
_ZY9:
LDET=2 :: RDET=2 :: GOTO _ZCOLDETS 
_ZY33:
LDET=10 :: RDET=11 :: GOTO _ZCOLDETS 
_ZY57:
LDET=12 :: RDET=13 :: GOTO _ZCOLDETS 
_ZY81:
LDET=14 :: RDET=15 :: GOTO _ZCOLDETS 
_ZY105:
LDET=16 :: RDET=17 :: GOTO _ZCOLDETS 
_ZY129:
LDET=18 :: RDET=19 :: GOTO _ZCOLDETS 
_ZY153:
LDET=20 :: RDET=21 :: GOTO _ZCOLDETS 
_ZY177:
LDET=22 :: RDET=23 :: GOTO _ZCOLDETS
_ZCOLDETS:
CALL COINC(#TZEDZ,#LDET,10,C)
IF C<>0 THEN _ZLEFDET
_COINCZR:
CALL COINC(#TZEDZ,#RDET,10,C)
IF C<>0 THEN _ZRIGDET
RETURN
//COLLISION DETECTION HAPPENS ON LEFT - WHAT IS IT?
//A HEART?
_ZLEFDET:
IF LDET=TZEDZ THEN _COINCZR //NO SELF COINC
RLOOP=0 :: LLOOP=LDET-9
IF LO0T(1,LLOOP)<>90 THEN _COINCZR 
GOTO _ZCOLHEART1
//COLLISION DETECTION HAPPENS ON RIGHT - WHAT IS IT?
//A HEART?
_ZRIGDET:
IF RDET=TZEDZ THEN _GORET //NO SELF COINC
LLOOP=0 :: RLOOP=RDET-9
IF LO0T(1,RLOOP)<>90 THEN _GORET
_ZCOLHEART1:
GOSUB _GUI
CALL SOUND(1,150,5) :: CALL SOUND(1,200,2) 
IF LLOOP=0 THEN _Z3021
IF RLOOP=0 THEN _Z3020
 
_Z3020:
IF LDET<>O THEN _Z3020A ELSE _GORET
_Z3020A:
CALL DELSPRITE(#LDET) :: RETURN
_Z3021:
IF RDET<>O THEN _Z3021A ELSE _GORET
_Z3021A:
CALL DELSPRITE(#RDET) :: RETURN
_ZFALL: 
IF ZY=177 THEN _GORET //***VERY BUGGY. NEED TO CHECK ALL COINC CALLS AND ENSURE THEY ARE NOT ZY DEPENDANT.
FOR ZFALLIN=1 TO 12 :: ZY=ZY+2 :: CALL SOUND(1,666-(FALLIN*10),5) :: CALL SPRITE(#TZDEZ,96,6,ZY,ZX) :: NEXT ZFALLIN :: RETURN
_CRAWLERAI:
//CHASES AND DESTROYS HEARTS IF ANY, THEN GOES AFTER PLAYER. NEED CZHELTH DEFINED. MOVE CRAWLER LEVEL TO LEVEL LOOKING FOR HEARTS. LEVEL = PLAYER LEVEL THEN AGRO TO PLAYER
RETURN
_CRAWLERSPAWN:
//SPAWN ONE CRAWLER AT EACH 50< LEVEL - MAKE IT 2 AT LEVEL 25 AND 3 AT LEVEL 0
 
 
//Charecter Code Records
//104=IDLE CG:2
//136=MAN MELEE ATTACK 
//137=MAN RANGED LEFT
//138=MAN RANGED RIGHT
//NUMBER 0-9 = 48-57 = 3,4
//105-110 RR = 6 PATTERNS
//120-122 SJR = 3 PAT
//123-125 JR = 3 PAT
//126-127 LR = 2 PAT
//104 = IDLE
//113-118 RL = 6 PAT
//128-130 SJL = 3 PAT 
//131-133 JL = 3 PAT
//134-135 LL = 2 PAT
 
//32,112,111,119,139-142: BLANK COLOR: N/A Color Sets: N/A
//33-47:W,G,Z,I,i,+,J,C,K,Q,U,L,F,H COLOR: 12* Color Sets: 1, 2
//48-57: NUMBERS 0-9 COLOR: 12* Color Sets: 3, 4
//58-74:M,V,A,Y,v,w,X,T,O,Q,G,B,P,R,E,S,N COLOR: 12* Color Sets: 4, 5, 6
//75-77: SCORE CHAR  COLOR: 12 Color Sets: 6
//78-79:Level CHAR.  COLOR: 12 Color Sets: 6
//80-89:*, ~, MELEE ATTACK, BULLET, :, &, (, ), =, .CLR: 12*6 Color Sets: 7, 8
//90:HEART.  COLOR: 7 Color Sets: 8
//91:MELEE WEAPON.  COLOR: 8  Color Sets: 8
//92:RANGED WEAPON. COLOR: 8 Color Sets: 8
//93:BAD GIRDER.  COLOR: 15 Color Sets: 8
//94:GIRDER.  COLOR: 15* Color Sets: 8
//95:THE HOLE.  ASSIGNED VARIABLE HCLR COLOR: 15 Color Sets: 8
//96:ZOMBIE.  COLOR: 4 Color Sets: 9
//97-98: Zombie run left COLOR: 4 Color Sets: 9
//99-100: Zombie run right COLOR: 4 Color Sets: 9
//101-102&103:Zombie crawler&ZCrawler Idle COLOR: 13 Color Sets: 9
//104:PLAYER IDLE COLOR: 6 Color Sets: 10
//105-110:PLAYER RUN RIGHT COLOR: 6 Color Sets: 10
//113-118:PLAYER RUN LEFT COLOR: 6 Color Sets: 11
//120-127:PLAYER STOP,JUMP,LAND RIGHT COLOR: 6 Color Sets: 12
//128-135:PLAYER STOP,JUMP,LAND LEFT COLOR: 6 Color Sets: 13
//136: PLAYER MELEE ATTACK COLOR: 6 Color Sets: 14
//137-138:PLAYER RANGED ATTACK LEFT AND RIGHT. COLOR: 6 Color Sets: 14
//143:THE EXIT.  COLOR: 10* Color Sets: 14
//*USE CALL COLOR - THE REST ARE SPRITES AND GET ASSIGNED UPON CREATION.
 

 

 

Edited by Sinphaltimus
  • Like 1
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...