| Prev: 6FEA | Up: Map | Next: 7038 |
6FF6: Spawn and render enemy on screen
|
Creates a new enemy from level data and renders it. Handles different enemy types (helicopter, ship, tank, fighter, balloon) with appropriate sprites and attributes.
|
||||||||||||
| render_enemy | 6FF6 | CP $06 | If balloon (type 6), use separate balloon renderer at render_balloon. | |||||||||
| 6FF8 | JP Z,render_balloon | |||||||||||
| 6FFB | CP $05 | If fighter (type 5), set XOR blending mode. | ||||||||||
| 6FFD | CALL Z,blending_mode_xor_nop | |||||||||||
| 7000 | CP $04 | If tank (type 4), set XOR blending mode. | ||||||||||
| 7002 | CALL Z,blending_mode_xor_nop | |||||||||||
| 7005 | CALL ld_enemy_sprites | Get sprite pointer based on enemy direction. | ||||||||||
| 7008 | LD B,$00 | Add enemy to active objects set: BC = (0, X_pos), call add_object_to_set with HL = viewport_slots. | ||||||||||
| 700A | LD C,E | |||||||||||
| 700B | PUSH HL | |||||||||||
| 700C | LD HL,$5F00 | |||||||||||
| 700F | CALL add_object_to_set | |||||||||||
| 7012 | POP HL | |||||||||||
| 7013 | CALL setup_object_position | Set up screen position. | ||||||||||
| 7016 | LD BC,$0018 | Set sprite frame size ($18 = 24 bytes) and default attributes ($0E). | ||||||||||
| 7019 | LD E,$0E | |||||||||||
| 701B | LD A,D | Get object type (D AND $07). Load type-specific attributes: ship=ld_attributes_ship ($0D), fighter=ld_attributes_fighter ($00), tank=ld_attributes_tank ($00/$04). | ||||||||||
| 701C | AND $07 | |||||||||||
| 701E | CP $02 | |||||||||||
| 7020 | CALL Z,ld_attributes_ship | |||||||||||
| 7023 | CP $05 | |||||||||||
| 7025 | CALL Z,ld_attributes_fighter | |||||||||||
| 7028 | CP $04 | |||||||||||
| 702A | CALL Z,ld_attributes_tank | |||||||||||
| 702D | LD A,$03 | Set sprite dimensions: A=3 (width tiles), D=8 (height pixels). Render enemy. | ||||||||||
| 702F | LD D,$08 | |||||||||||
| 7031 | CALL render_sprite | |||||||||||
| 7034 | CALL blending_mode_or_or | |||||||||||
| 7037 | RET | |||||||||||
| Prev: 6FEA | Up: Map | Next: 7038 |