Turning off projectile power-up (2-player platform module)

vanderblade

Active member
I'm implementing power-ups and pickups in my Bubble Bobble-esque game as part of my finishing touches.

So far I have the obvious health pickup, which works fine.

I also have the projectile power-up operating.

However, I want the player to lose the projectile power-up when they finish the single-screen stage and start another. This way, they will only have the projectile on the screen where they pick up the power-up.

I've searched the forums for turning the projectile off, but so far have found nothing.

What's the easiest way to accomplish this? Can we add a line or two to the Level Win script (Collectable_DC.asm) to deactivate the projectile?
 

dale_coop

Moderator
Staff member
Yeah, great idea. You can implement that, here's the code to remove the projectile ability:
Code:
    ;; removes the Projectiles ability:
    LDA weaponsUnlocked
    AND #%11111101
    STA weaponsUnlocked

Two possibilities:
- you could add a piece of code in the Collectable_DC.asm script (just before the "JSR HandleNoMorePrizeTiles" line).
- or, you could add the piece of code directly at the end of the script assigned to the "Handle No More Prize Tiles" (from the Project Settings > Script Settings).

Both should work.
 

vanderblade

Active member
Awesome! Thanks, Dale. I will try it tonight; otherwise, I'm out of town for several days and will try when I return.
 

vanderblade

Active member
I just tested it and it works great. I wonder if we can't mess with the randomizer to make this powerup appear less often. I want it to feel a little more special when it appears. I don't care about this with my other drops so much.

I imagine we have to mess with this element of the handledrops code.

Code:
JSR GetRandomNumber
	AND #%00000111 ;; now, we have a number between 0 and 7
	BNE notPickup0 ;; 
	;; zero case here;
	LDA #OBJ_MONSTER_DROP_ITEM1
	BEQ notPickup0
	;;; here, we'll create health
	CreateObject temp, temp1, #OBJ_MONSTER_DROP_ITEM1, #$00, currentNametable
	JMP donePickup
notPickup0:
	CMP #$01
	BNE notPickup1
	;; one case here;
	LDA #OBJ_MONSTER_DROP_ITEM2
	BEQ notPickup1
;;; here, we'll create projectile powerup
	CreateObject temp, temp1, #OBJ_MONSTER_DROP_ITEM2, #$00, currentNametable
	JMP donePickup
notPickup1:
	CMP #$02
	BNE notPickup2
	;; two case here;
	LDA #OBJ_MONSTER_DROP_ITEM3
	BEQ notPickup2
	;;; here, we'll create score drop
	CreateObject temp, temp1, #OBJ_MONSTER_DROP_ITEM3, #$00, currentNametable
	JMP donePickup
notPickup2:
	;;;; do the same for each case.
	;;;; blank cases will simply return 'nothing'.

For Pickup1 specifically (the projectile), how do we make it so the drop is more rare, that it happens less frequently?
 

dale_coop

Moderator
Staff member
I guess you could modify that behavior...
something you could try, adding this code
Code:
	JSR GetRandomNumber
	AND #%00000011 ;; now, we have a number between 0 and 3
	BNE donePickup

Just before your :
Code:
;;; here, we'll create projectile powerup
	CreateObject temp, temp1, #OBJ_MONSTER_DROP_ITEM2, #$00, currentNametable

It would add another random factor (0-3), to make it less regular.
 

vanderblade

Active member
Thanks, Dale! It works maybe too good. I played over 30 levels of the game and never had it drop. But that's maybe how it should be since the game was not designed with the projectile in mind. I'll test a bunch more.
 

dale_coop

Moderator
Staff member
LOL
You could reduce the random factor...
Code:
	JSR GetRandomNumber
	AND #%00000001 ;; now, we have a number between 0 or 1
	BNE donePickup
 
Top Bottom