[4.1.5] Unlocking additional projectile weapon (and firing two at same time)

vanderblade

Active member
This is a little specific, but might also be something other users will benefit from.

I'm trying to figure out the best way to go about unlocking weapon upgrades after picking up a Powerup and having an additional, different projectile object automatically start firing along with my default projectile.

I know I need to assign an individual script to the correct powerup slot in Script Settings. I also already have the additional projectile ready to go as the 03 game object.

My issue is working out the code to unlock the projectile (the script assigned to the powerup slot) and also the corresponding code to add to the existing shooter "a_create_projectile" input script to make it all work together.

Finally, I know I'll have to also modify my Handle Player Death script to take all powerups away upon death.

This older post seems to offer some info: http://nesmakers.com/viewtopic.php?t=2124

I could, for instance, use this script in the correct Powerup slot in script settings:

Code:
;; give the Weapon 3:
LDA weaponsUnlocked
ORA #%00000100
STA weaponsUnlocked

Okay, but then how do I modify the "a_projectile_create" script to start firing both the default player projectile AND the newly unlocked projectile?

I imagine I need a check. So I could use this.

Code:
;; test if the player has the Weapon 3:
LDA weaponsUnlocked
AND #%00000100
BEQ playerDoesNotHaveWeapon3
;; else he has unlocked the Weapon3

What else do I need to add to make it work if the check comes back positive?

I also figure, if I do use this weaponsUnlocked method, I could insert this somewhere in Handle Player Death to take the powerup away.

Code:
;; remove the Weapon 3:
LDA weaponsUnlocked
AND #%11111011
STA weaponsUnlocked

I also tried to use Baardbi's tutorial, but it had way more than I needed and I couldn't figure out how to extract only what would solve my issue: viewtopic.php?f=35&t=4841
 
Top Bottom