;^-----------------------------------<1 ;-120=$78
nrenemies = 10 ;max. nr of enemies
-enemysize = 6
+enemysize = 7
enemies = storepos2 ; +0 ;info about each enemy (6byt)
nrybuls = 10
;level_info:
; [0000:damage 0:directfire 0:ground 0:ceiling 0:diagfire]
;enemies:
-; [000000:HP left 00:(00=no enemy 01=exploding 10=normal 11=moving)]
+; [HP] [000000:HP left 00:(00=no enemy 01=exploding 10=normal 11=moving)]
; [ship type or explosion frame] [x] [y] [move] [fire]
;---------------------- introduction ------------------------------------------
cal Display_Screen ;display all
halt ;delay
- jp game_main_loop ;LOOP
+ jp game_main_loop ;LOOP^^^^^^^^^^^^^
;--------------------------- ground -------------------------------------------
check_laserhits: ;de = (x,y)
ld b,nrenemies
- ld hl,enemies
+ ld hl,enemies+1
laserhits: ;Hits with normal enemies
psh hl
check_bullethits: ;INPUT: de=X,Y; (temp1)=bullet
ld b,nrenemies
- ld hl,enemies
+ ld hl,enemies+1
hit_enemies: ;Hits with normal enemies
psh hl
standby_event:
ld b,nrenemies
- ld hl,enemies-enemysize
+ ld hl,enemies+1-enemysize
ld de,enemysize
chk_enemyleft:
add hl,de
do_event:
- ld hl,enemies-enemysize
+ ld hl,enemies+1-enemysize
ld bc,enemysize
xor a ;a=0
chk_noenemy:
ld a,(hl) ;load hitpoints+occ of this enemy class
ld (de),a ;save occ
+ dec de ;goto hp
+ xor a
+ ld (de),a ;save hp64
+ inc de ;next byte (or previous): occ again
+
inc hl ;next enemyInfo byte
inc de ;next byte of current enemy
ld a,(hl) ;load enemy class (nr)
;--------------------------- handle enemies -----------------------------------
Handle_enemies:
- ld hl,enemies
+ ld hl,enemies+1
ld b,nrenemies ;handle all enemies
handle_enemy:
ld d,h
ld e,l ;e = X+7, d = Y+7
- ld hl,enemies
+ ld hl,enemies+1
ld b,nrenemies ;check all 20 enemies
check_collision:
psh hl