Prev: 6B70 Up: Map Next: 6BC7
6BA5: Create Weapon
Used by the routines at FireRepellentSpray and FireStreamer.
Writes the position and the colour of a new weapon into its object and plays the sound for the type of the weapon. The weapon starts 0C pixels above Robbie.
Input
A The X position of the weapon
B The colour of the weapon
DE State_Robbie_Pos_X (the X position of Robbie)
HL The weapon object (which has the state already written)
CreateWeapon 6BA5 INC HL Move onto the X position of the weapon.
6BA6 LD (HL),A Write the X position.
6BA7 INC DE Move onto the Y position of Robbie.
6BA8 INC HL Move onto the Y position of the weapon.
6BA9 LD A,(DE) A=the Y position of Robbie.
6BAA SUB $0C Subtract 0C.
6BAC LD (HL),A Write the Y position.
6BAD INC HL Move onto the colour of the weapon.
6BAE LD (HL),B Write the colour.
6BAF INC HL Move onto IX+04 of the weapon.
6BB0 XOR A A=00.
6BB1 LD (HL),A Write 00 to IX+04.
6BB2 INC HL Move onto IX+05 of the weapon (the "hit" flag).
6BB3 LD (HL),A Write 00 to IX+05.
6BB4 LD HL,($5E1C) HL=the weapon object from FreeWeaponSlot.
6BB7 LD A,(HL) A=the state of the weapon.
6BB8 AND %00111111 Keep only bits 0-5 (the type of the weapon).
6BBA CP $08 Jump to PlayRepellentSound to play the repellent sound if it matches.
6BBC JP Z,PlayRepellentSound
6BBF CP $12 Jump to PlayStreamerSound to play the streamer sound if it matches.
6BC1 JP Z,PlayStreamerSound
6BC4 JP PlaySmokeSound Jump to PlaySmokeSound to play the smoke sound.
Prev: 6B70 Up: Map Next: 6BC7